-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathname.php
More file actions
executable file
·154 lines (125 loc) · 4.31 KB
/
Copy pathname.php
File metadata and controls
executable file
·154 lines (125 loc) · 4.31 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<html>
<head>
<title>login</title>
<style>
h1 {
vertical-align:middle;
text-align:middle;
font-family:Verdana;
padding:50px;
}
form {
width:60%;
margin:auto;
padding:50px;
}
select {
padding:10px;
height:35px;
margin: 0;
-webkit-border-radius:0;
-moz-border-radius:0;
border-radius:0;
-webkit-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
-moz-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
box-shadow: none;
background: #f8f8f8;
color:#888;
border:none;
outline:none;
display: inline-block;
-moz-appearance:none;
appearance:none;
cursor:pointer;
}
input[type="text"], input[type="password"] {
padding: 10px;
margin:3px;
width:40%;
border: none;
border-bottom: solid 2px #c9c9c9;
transition: border 0.3s;
}
input[type="text"]:focus, input[type="password"]:focus,
input[type="text"].focus, input[type="password"].focus {
outline:none;
border-bottom: solid 2px #969696;
}
input[type="submit"] {
border-radius:0;
color:white;
border:none;
padding:10px;
margin:10px;
background-color:gray;
}
#container {
width:60vw;
height:60vh;
margin:auto;
margin-top:10vh;
background-color:yellow;
border: thick dotted black;
}
</style>
</head>
<body>
<?php
session_start();
$users = array('mak2vr','mpm5mh','iap5fk','kml4bz','bjm3j');
$passwords = array('glhkj','shutup','khourtney','kimothy','cats');
$fishbowl = array_merge(array('fishbowl'), $users);
$fishpass = array_merge(array('fishbowl'), $passwords);
$normal = array('normal', 'mak2vr');
$normpass = array('normal', 'glhkj');
function login($cookie, $home, $userlist, $passlist) {
echo '<div id="container"><h1>' . $cookie . ' login.</h1><form name="login" method="POST" action="name.php"><input type="text" name="user" placeholder="user"><input type="password" name="pass" placeholder="password"><input type="submit" id="submit" name="submit" value="login"></form></div>';
if ($cookie == 'normal') {
echo '<h3>usr:normal, pass:normal</h3>';
}
if (isset($_POST['user'])) {
$user_in = $_POST['user'];
$pass_in = $_POST['pass'];
if (in_array($user_in,$userlist)) {
$index = array_search($user_in, $userlist);
if ($passlist[$index] == $pass_in) {
echo success;
$_SESSION[$cookie] = $user_in;
header('Location:' . $home . '?');
}
else {
echo "wrong password";
}
}
else {
echo "log in to your " . $cookie . " account.";
}
}
}
if ($_SESSION['login'] == "choose") {
echo '<h3 style="font-family:Verdana">please choose below</h3><form name="login" method="POST" action="name.php" autocomplete="off"><select name="choice"><option value="user">Engineering/ESCIRC</option><option value="fishbowl">Fishbowl/IRC</option><option value="normal">Normal Template</option></select><input type="submit"></form>';
if (isset($_POST['choice'])) {
$_SESSION['login'] = $_POST['choice'];
header('Location: name.php');
echo 'do not resubmit';
}
}
elseif (isset($_SESSION['login']) && $_SESSION['login'] != "choose") {
$login = $_SESSION['login'];
if ($login == "normal") {
login($login, "normal.html", $normal, $normpass);}
if ($login == "fishbowl") {
login($login, "irc.html", $fishbowl, $fishpass);}
if ($login == "user") {
login($login, "escirc.html", $users, $passwords);}
}
elseif (!isset($_SESSION['login'])) {
$_SESSION['login'] = "user";
login("user", "escirc.html", $users, $passwords);
}
else {
echo "use <a href='terminal.php'>jack/ logout</a>";
}
?>
</body>
</html>