<myPHP>
free PHP scripts
<?php
$usererror = "";
$passerror = "";
if(isset($_POST['submit']))
{
$user = "admin"; // change username
$pass = "gh3dgue7sber"; // change password
$page = "secretpage.php"; // change secretpage
$username = $_POST['username'];
$password = $_POST['password'];
if($username == $user) { $u_proceed = "1"; } else { $u_proceed = "0"; $usererror = "Wrong username !!!"; }
if($password == $pass) { $p_proceed = "1"; } else { $p_proceed = "0"; $passerror = "Wrong password !!!"; }
if($u_proceed == "1" && $p_proceed = "1")
{
$_SESSION['loggedin'] = 1;
header('Location: '.$page );
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Simple Login System / myPHP.se</title>
</head>
<body>
<div align="center">
<div style="width: 330px;">
<h2>Easy Login System</h2>
<form action="index.php" method="post">
<input type="text" name="username" placeholder="Username" id="username" required><BR><?php echo $usererror;?><BR>
<input type="password" name="password" placeholder="Password" id="password" required><BR><?php echo $passerror;?><BR>
<input type="submit" value="Login" name="submit">
</form>
</div>
</div>
</body>
</html>
<?php
session_start();
if(!isset($_SESSION['loggedin'])) {
header('Location: index.php');
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SecretPage / myPHP.se</title>
</head>
<body>
<H2>Secret page</H2>
</body>
</html>