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
It's not an ideal solution but here's a quick and dirty example that shows how you could store login info in the PHP code:
'password1',
'user2'=>'password2'
);
if(isset($_GET['logout'])) {
$_SESSION['username'] = '';
header('Location: ' . $_SERVER['PHP_SELF']);
}
if(isset($_POST['username'])) {
if($userinfo[$_POST['username']] == $_POST['password']) {
$_SESSION['username'] = $_POST['username'];
}else {
//Invalid Login
}
}
?>
Login
You are logged in as =$_SESSION['username']?>