Hi everyone, this is my problem and I can't seem to solve it.
I have three files. Admin.php, Authenticate.php and LoggedIn.php. The user goes to Admin.php types their username, password and presses submit which goes to the authenticate.php to check to see if it is valid, if it is valid then it sends the person to Loggedin.php otherwise back to Admin.php. In Authenticate.php, if the user enters the correct username, password I create a cookie named Auth with the value = "Logged In". I put the following code in Loggedin.php:
if($_COOKIE[auth] != "Logged in")
{
?>
<pre>
You must login to authenticate yourself. Press the back button on
your browser to go back. Thank you!
</pre>
<?php
exit;
}
?>
The reason I put this code is to not allow the person to directly bypass the username/password screen and come directly to logged in screen. I get this error message:
Notice: Use of undefined constant auth - assumed 'auth' in C:\Inetpub\wwwroot\page1\admin\Loggedin.php on line 11
Notice: Undefined index: auth in C:\Inetpub\wwwroot\page1\admin\Loggedin.php.php on line 11
I got this piece of code from the "PHP FAST AND EASY DEVELOPMENT BOOK" which says it should prevent users going directly to certain pages. Why doesn't it work or is there another solution. Please someone help me. Thank you =)
Armond