I cannot get the session to last at all on this... What Am I doing wrong???
if (!$_SESSION["loggedin"] == "true") {
if ((! isset($_REQUEST["usr"])) || (! isset($_REQUEST["pwd"]))) {
echo("<html><head><title>Please Login</title></head><body><form method='post' action='cmd_sql.php'><font face='verdana' size='1'>");
echo("<font size='4'><b>You are not currently logged in<br></b></font>");
echo("Username: <input type='text' name='usr' value=''><br>Password: <input type='password' name='pwd' value=''><br><input type='submit'>");
echo("</font></body></html>");
exit;
} else {
$usr = $_REQUEST["usr"];
$pwd = $_REQUEST["pwd"];
if ($usr == "*****") {
if ($pwd == "*****") {
$_SESSION["loggedin"] = "true";
} else {
header("location:[url]http://scottb/dev/cmd_sql.php?e=Bad_Password[/url]");
}
} else {
header("location: [url]http://scottb/dev/cmd_sql.php?e=Bad_User[/url]");
}
}
}
There's more code in this page, but its way down below here. This appears before any html code, etc. You go to the page the first time, log in, if its the right username/password combination, you see the rest of the page. Since this little app is all on one page, when you click a link below and go back to cmd_sql.php, it just refuses to work...
What am I doing wrong here???
P.S: PHP 4.2.2, Windows NT 5.0 build 2195