-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
146 lines (143 loc) · 3.38 KB
/
index.php
File metadata and controls
146 lines (143 loc) · 3.38 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
<!doctype html>
<html>
<head>
<title>Lab Queue Form</title>
<meta charset = "utf-8" />
<script>
document.cookie="height="+window.innerHeight;
function Time()
{
var t = new Date();
var h = f(t.getHours());
var m = f(t.getMinutes());
var s = f(t.getSeconds());
document.getElementById('time').innerHTML = "Current time: " + h + ":" + m + ":" + s;
var x = setTimeout(Time, 1000);
}
function f(i)
{
if (i<10)
{
i="0"+i;
}
return i;
}
function submit()
{
document.cookie = "name="+document.getElementById("name").value;
document.cookie = "id="+document.getElementById("id").value;
window.location = "http://<?php echo $_SERVER[HTTP_HOST];?>/write.php";
}
</script>
<style>
input[readonly]
{
background-color: #ccc;
}
body
{
background-color: #f1f1f1;
}
.middleimg
{
display: flex;
justify-content: center;
font-size: 16px;
font-weight: bold;
color: blue;
}
img
{
display: block;
margin-left: auto;
margin-right: auto;
}
input
{
height: 20px;
border-color: #f1f1f1;
background: #fbfbfb;
}
button
{
background-color: #5bc0de;
border-color: #46b8da;
border-radius: 4px;
color: #fff;
cursor: pointer;
margin-left: 45%;
padding: 5px;
}
button:hover
{
background-color: #31b0d5;
border-color: #269abc;
}
.container
{
background-color: #fff;
width: 400px;
border: 2px solid blue;
border-radius: 25px;
padding: 25px;
display: flex;
margin-left: calc((100vw - 450px) / 2);
justify-content: center;
}
</style>
</head>
<body onload="Time()">
<?php
mkdir("/tmp/$_SERVER[HTTP_HOST]");
// print_r(scandir("/tmp"));
?>
<div style="font-size: 20px">Please enter your first name below in order to stand in the queue:</div>
<hr>
<div class="container"><div>
Your first name:<br>
<input type="text" id="name" title="Your first name, at most 10 characters" maxlength="10">
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$str = file_get_contents("/tmp/$_SERVER[HTTP_HOST]/Labqueue_ips.txt");
$s = "";
$found = 0;
for ($i = 0; $i < strlen($str); $i++)
{
$c = $str[$i];
if ($c == " ")
{
if ($s == $ip)
{
echo "<input type=\"number\" id=\"id\" value=\"".$str[$i+1].$str[$i+2]."\" readonly style=\"display: none\">";
$found = 1;
break;
}
$i = $i + 3;
$s = "";
}
else
{
$s = $s.$c;
}
}
if ($found == 0) echo "<br><br>Your pc number (find out from the picture below):<br><input type=\"number\" id=\"id\" min=\"1\" max=\"42\">";
?>
<br><br>
<button type="button" onclick="submit()">Submit</button>
</div></div>
<br>
<br>
<div id="time" style="font-size: 20px;"></div>
<br>
<a href="/queue.php" target="_blank" style="font-size: 20px;">Current queue</a>
<br><br><br>
<?php
$str1 = file_get_contents("/tmp/$_SERVER[HTTP_HOST]/Labqueue_TA1.txt");
$str2 = file_get_contents("/tmp/$_SERVER[HTTP_HOST]/Labqueue_TA2.txt");
if ($found == 0) echo "<img src=\"Lab1.png\"><br><div class=\"middleimg\"> TA:".$str1."</div><br><img src=\"Lab2.png\"><br><div class=\"middleimg\"> TA: ".$str2."</div><br><img src=\"Lab3.png\">";
else echo "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
?>
<hr>
<div style="text-align: center;">© 2018 Ziya Mukhtarov</div>
</body>
</html>