Logged Out Please use the form below to login again.';
break;
//If they don't want to logout then they obviously want to login ...
default:
//If the users has submitted a login then validate and check the login details
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$uname = $_POST['username'];
$pword = $_POST['password'];
$area = $_POST['area'];
//security
$uname = htmlspecialchars($uname);
$pword = htmlspecialchars($pword);
$area = htmlspecialchars($area);
//now MD5 the password they submitted
$pword = md5($pword);
//Include then run the username & password through the valid list of users to see if they match anyone
include ("users.inc.php");
foreach($ID as $key => $value) {
if (($key == $uname) && ($value == $pword)) {
$security = true;
break;
} else {
$security = false;
}
}
//Then check to see if user password the test above, then set the session if they are valid
if ($security) {
session_start();
$_SESSION['login'] = "1";
$_SESSION['user_ip'] = $_SERVER['REMOTE_ADDR'];
if ($area == "banners") {
header ("Location: banners.php");
} else {
header ("Location: content.php");
}
}
//Else if no matches in valid users then send an error and deny the session
else {
$errorMessage = "Sorry, but the login you entered is invalid. Please try again.
";
$area2 = $area;
session_start();
$_SESSION['login'] = '';
}
}
}
// Shows the error message and puts the p class around if there is one
if ($errorMessage !='') {
$errorOutput.= '
'; $errorOutput .= $errorMessage; $errorOutput .= "
"; } //Outputs everything created above if ($area == '') { $area2 = $_GET['area']; } else { $area2 = $area; } ?>![]() |
|||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||