View sourcecode

The following files exists in this folder. Click to view.

login.php

65 lines ASCII Unix (LF)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?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();
}
?>