hi, i have an error when i correctly submit the username and password infos. here is the description of an error:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\login.php:8) in C:\Program Files\Apache Group\Apache2\htdocs\login.php on line 20
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\login.php:8) in C:\Program Files\Apache Group\Apache2\htdocs\login.php on line 20
and here is the code: login.php
//HTML Form to log in...
<form action="login.php" method="post">
Username <input type="text" name="username"><br />
Password <input type="password" name="pass"><br />
<input type="submit" name="submit" value="login"></form>
<? //end of form ?>
<?include("database.inc");?>
<?
if(isset($submit)){
#check if account exists
$qstring="SELECT * FROM uyebilgiler WHERE kullaniciadi = '".$POST['username']."' AND parola = '".$POST['pass']."'";
// echo "SQL Statement: ".$qstring;
$qry = mysql_query($qstring) or die(mysql_error());
$numrows = mysql_num_rows($qry);
if($numrows < 1){ // If no return fr. database, the account doesn't exist....
}else{
session_start(); // start the session...
$SESSION['username'] = $POST['username']; // Registers the session user.
checklog();
}
//End of Validating
}
//The Check log
function checkLog(){
global $_SESSION;
if(session_is_registered("username")){
#add code to validate the user in the db
}else{
session_unregister("username"); // unregister the session
header("location: index.php"); // send them to the "home page"....
}
}
?>