PHP 4.3.6
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /web/htdocs/htdocs/index.php:1) in auth.php on line 2
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /web/htdocs/htdocs/index.php:1) in auth.php on line 2
You are not authenticated. Please login.
Are the errors I am gettting usin ght efollowing code:
<?
session_start();
include ("connect.php");
// convert username and password from POST or SESSION
if($POST["username"])
{
$username=$POST["username"];
$password=$POST["password"];
}
elseif($SESSION["username"])
{
$username=$SESSION["username"];
$password=$SESSION["password"];
}
// start and register session variables
session_register("username");
session_register("password");
// query for a user/pass match
$result=mysql_query("select * from users
where username='" . $username . "' and password='" . $password . "'");
// retrieve number of rows resulted
$num=mysql_num_rows($result);
// print login form and exit if failed.
if($num < 1){
session_destroy();
echo "You are not authenticated. Please login.<br><br>
<form method=POST action=index.php>
username: <input type=text name=\"username\">
password: <input type=password name=\"password\">
<input type=submit>
</form>";
exit;
}
?>