problem with session
Posted: Fri May 23, 2003 3:30 pm
I have a page Admin.php, at the top is the following code. it is supposed to direct the user to the Login.html page if he is not authorized first. However, when I type http://localhost/Admin.php, I can still view this page, not being directed to the login page instead. Please advise.
Of couse, in the authorization page, I have some code like this:
if (ocifetch($stmt)){
session_start();
session_register('username');
header("Location: Main.php");
}
else {
header("Location: index.html");
}
------------------Admin.php----------------
<?php
session_start();
if(!(session_is_registered('username'))){
header ("Location Login.html");
} else {
?>
<html>blah....</html>
Of couse, in the authorization page, I have some code like this:
if (ocifetch($stmt)){
session_start();
session_register('username');
header("Location: Main.php");
}
else {
header("Location: index.html");
}
------------------Admin.php----------------
<?php
session_start();
if(!(session_is_registered('username'))){
header ("Location Login.html");
} else {
?>
<html>blah....</html>