[SOLVED] protect page
Posted: Fri Aug 20, 2004 10:40 am
What I want to do is have user1.php (the page the user logs into) protected so only the user loging in can go to that page but I don't want any thing to complicated. Here is my code:
login.php
login.php
Code: Select all
<?php
session_start();
if (($username == 'user1') && ($password == 'pass1'))
{
$_SESSION['username'] = $username;
header('location: user1.php');
}
elseif (($username == 'user2') && ($password == 'pass2'))
{
$_SESSION['username'] = $username;
header('location: user2.php');
}
elseif (($username == 'user3') && ($password == 'pass3'))
{
$_SESSION['username'] = $username;
header('location: user3.php');
}
else
{
header('location: error.html');
}
?>