header function
Posted: Mon Sep 04, 2006 6:16 pm
In my script I use the header function to move the user to a menu type of page (after a successful login...)
That seems to work and it sends me to ranchmain.htm
however, I would like to be able to verify that the user got to the menu page by logging in, so in the script ranchmain calls, I check for whether the user is authorized
What's happening is that I get the following error message
"Warning: Cannot modify header information - headers already sent by (output started at /home/thunde9/public_html/cgi-bin/lookup.php:6) in /home/thunde9/public_html/cgi-bin/lookup.php on line 11"
From my research I've discovered that the error is generated because I've already used the header function once during this session, I can't seem to find how to clear it, so I can reuse it, or is there a better way to accomplish what I'm trying to do.
Thanks
[/quote]
Code: Select all
// check user
if($num_rows < 1){
header("Location: http://www.thunderhillranch.com/sorry.htm");
exit();
}
while ($row = mysql_fetch_array($result1)) {
extract($row);
// set username and password into session vars
$_SESSION[user] = username;
$_SESSION[pass] = password;
$_SESSION[auth] = "Yes";
}
header("Location: http://www.thunderhillranch.com/ranchmain.htm");
exit();however, I would like to be able to verify that the user got to the menu page by logging in, so in the script ranchmain calls, I check for whether the user is authorized
Code: Select all
if (@$_SESSION['auth'] !="Yes")
{
header("location:http://www.thunderhillranch.com/ranchmain.htm");
exit();
}"Warning: Cannot modify header information - headers already sent by (output started at /home/thunde9/public_html/cgi-bin/lookup.php:6) in /home/thunde9/public_html/cgi-bin/lookup.php on line 11"
From my research I've discovered that the error is generated because I've already used the header function once during this session, I can't seem to find how to clear it, so I can reuse it, or is there a better way to accomplish what I'm trying to do.
Thanks
[/quote]