hi ive been using a login code which uses sql & db its quite simple and has been working great.....but as i have just gone to do a final test on the site i've built starting from the login page i get the following error message...
"Warning: session_registe r() [function.sessio n-register]: Cannot send session cache limiter - headers already sent (output started at /home/theau10/public_html/resources/checklogin.php: 1) in /home/theau10/public_html/resources/checklogin.php on line 30
Warning: Cannot modify header information - headers already sent by (output started at /home/theau10/public_html/resources/checklogin.php: 1) in /home/theau10/public_html/resources/checklogin.php on line 32"
I don't know why it is doing this as it has been working great before.
here is the login code
"Warning: session_registe r() [function.sessio n-register]: Cannot send session cache limiter - headers already sent (output started at /home/theau10/public_html/resources/checklogin.php: 1) in /home/theau10/public_html/resources/checklogin.php on line 30
Warning: Cannot modify header information - headers already sent by (output started at /home/theau10/public_html/resources/checklogin.php: 1) in /home/theau10/public_html/resources/checklogin.php on line 32"
I don't know why it is doing this as it has been working great before.
here is the login code
Code:
<title>: : : members online resource centre</title><?php
$username="theau10_tawUser";
$password="auction10";
$database="theau10_resources";
// Connect to server and select databse.
$connection=mysql_connect("localhost" ,"$username", "$password") or die("Unable to connect!");
mysql_select_db("$database") or die("Unable to select database!");
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:tsandcs.php");
}
else {
header("location:incorrect.php");
}
?>
Comment