How do I create an easy login script that does not require a database. I would like it to be safe.
Alright, what about this script, i just made it by my knowledge in
Try this:
'5d41402abc4b2a76b9719d911017c592', //Hello...
);
if(isset($_GET['logout'])) {
$_SESSION['username'] = '';
header('Location: ' . $_SERVER['PHP_SELF']);
}
if(isset($_POST['username'])) {
if($userinfo[$_POST['username']] == md5($_POST['password'])) {
$_SESSION['username'] = $_POST['username'];
}else {
header("location:403.html"); //replace with 403
}
}
?>
Logged In
You're logged in.
LOG OUT
Log In
Login needed
You will need a logout, something like this (logout.php):
// Below is not needed, unless header above is missing. In that case, put logged out text here.
Untitled Document