Log in

View Full Version : Stopping Just Anyone From Viewing Pages



tomyknoker
03-13-2007, 06:56 PM
Hi all,

Ok well I set up a username/password scenario and was able to get it to work and the add the header to the main.php page, which loaded if the user/pass is correct. But then I realised I can access any of the pages just by typing in the link directly... What do I need to add, so that if people link to the page they need to login first...???

mburt
03-13-2007, 07:03 PM
On the page when logged in, use the following at the top of the document:

<?php
if ($user != "myusername" || $pass != "mypassword") {
die("Incorrect username or password");
}
?>