I fixed the invalid password problem I was having, but now...
when i hit the submit button:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/public_html/login/index.php:3) in /home/public_html/login/index.php on line 22
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/public_html/login/index.php:3) in /home/public_html/login/index.php on line 22
Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/login/index.php:3) in /home/public_html/login/index.php on line 36
Here is my current code:
<html>
<head>
<? include("inc/config.php"); ?>
<title><? echo $title_h ?></title>
<link rel="stylesheet" href="inc/login.css" type="text/css">
<script language="">
<!--
function cursor(){document.login.name.focus();}
// -->
</script>
</head>
<body>
<center>
<div id="login_box">
<div class="error">
<?
if (isset($_POST['submit'])) {
include("inc/config.php");
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
$query = "SELECT * FROM clients WHERE name = '$name' AND password = PASSWORD('$password')";
$result = mysql_db_query($database, $query, $connection);
if (mysql_num_rows($result) == 1)
{
session_start();
session_register("client_id");
session_register("client_name");
session_register("client_email");
session_register("client_ref");
session_register("client_title");
list($clientid, $name, $pass, $email, $ref, $title) = mysql_fetch_row($result);
$client_id = $clientid;
$client_name = $name;
$client_email = $email;
$client_ref = $ref;
$client_title = $title;
header("Location: menu.php");
mysql_free_result ($result);
mysql_close($connection);
}
else
{
mysql_free_result ($result);
mysql_close($connection);
echo "Invalid username or password\n";
}
}
?></div>
<form action="<?=$_SERVER['PHP_SELF']; ?> " method="post" name="login">
<b>Username:</b> <input type="text" class="input_txt" name="name" />
<br /><br />
<b>Password:</b> <input type="password" class="input_txt" name="password" />
<br />
<br />
<div class="sub_pos">
<input type="submit" name="submit" value="Login" class="input_sub" />
</div>
</form>
</center>
</body>
</html>
I really confused myself here.