Here is the script for simple php authentication, setting a session variable indicating that a user is logged in then redirecting them to the members.php page. If the login credentials are incorrect it will redirect the user to the homepage.
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if( $username == 'admin' && $password == 'password' )
{
$_SESSION['loggedin'] = 'true';
}
fclose($handle);
if(isset($_SESSION['loggedin']))
{
header('Location: member.php');
}
else
{
header('Location: home.php');
}
?>






Comments