The following files exists in this folder. Click to view.
login.php65 lines ASCII Unix (LF) 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
<?php
$users = array("Philip","user","user2","user3");
$pass = array("Philip123", "password", "password2", "password3");
$status = array("admin", "user", "user", "user");
session_start();
$_SESSION["username"]=$_POST["username"];
$_SESSION["password"]=$_POST["password"];
if(isset($_POST["remember"]) and !isset($_COOKIE["username"]) and isset($_POST["username"]) and isset($_POST["password"])){
setcookie("username", $_POST["username"]);
setcookie("password", $_POST["password"]);
}
if(isset($_COOKIE["username"])){
$_SESSION["username"]=$_COOKIE["username"];
$_SESSION["password"]=$_COOKIE["password"];
}
if(!isset($_POST["remember"]) and isset($_POST["username"]) and isset($_POST["password"])){
$_SESSION["username"]=$_POST["username"];
$_SESSION["password"]=$_POST["password"];
}
$uIndex = array_search($_SESSION["username"], $users);
if (in_array($_SESSION["username"], $users) and in_array($_SESSION["password"], $pass) and $pass[$uIndex]==$_SESSION["password"]){
if ($status[$uIndex] == "admin"){
$_SESSION["user"]="Intentionally removed by CSource";
header("location: admin.php");
exit();
}
if ($status[$uIndex] == "user"){
$_SESSION["user"]="Intentionally removed by CSource";
header("location: user.php");
exit();
}
}
/*
if (in_array($_SESSION["username"], $admins) and array_search($_SESSION["username"], $admins)==array_search($_SESSION["password"], $aPass)){
$_SESSION["user"]="Intentionally removed by CSource";
header("location: admin.php");
exit();
}
else if(in_array($_SESSION["username"], $users) and array_search($_SESSION["username"], $users)==array_search($_SESSION["password"], $uPass)){
$_SESSION["user"]="Intentionally removed by CSource";
header("location: user.php");
exit();
}
*/
else{
setcookie('username', '', time() - 070414);
setcookie('password', '', time() - 070414);
header("location: index.php?mess=ERROR");
exit();
}
?>