-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomputerlist.php
More file actions
executable file
·63 lines (58 loc) · 1.84 KB
/
Copy pathcomputerlist.php
File metadata and controls
executable file
·63 lines (58 loc) · 1.84 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
<?php
include("config.php");
$computerlistsql = mysql_query("SELECT `id`, `status` FROM `computers`") or die(mysql_error());
echo '
<table name="computertable" border="0" width="100%" height="750">
<tr style="font-weight: bold;">
<td width="10%">ID</td>
<td>Name</td>
</tr>
';
while($computerlist = mysql_fetch_array($computerlistsql)) {
switch($computerlist['status']) {
default:
echo '
<tr style="background: #a2ff85">
<td>#'.$computerlist['id'].'</td>
<td>Computer Available! Book Now.</td>
</tr>
';
break;
case "2":
// Get the current user
$gamessql = mysql_query("SELECT `id`, `computer`, `name`, `games`, `status` FROM `bookings` WHERE `computer` = '$computerlist[id]' AND `status` = '1' LIMIT 1") or die(mysql_error());
$games = mysql_fetch_array($gamessql);
if($games['games'] >= 2) {
echo '
<tr>
<td>#'.$computerlist['id'].'</td>
<td>'.$games['name'].' - Remaining Games: '.$games['games'].'</td>
</tr>
';
}elseif($games['games'] == 1) {
echo '
<tr style="background: #eda700;">
<td>#'.$computerlist['id'].'</td>
<td>'.$games['name'].' - Last Round</td>
</tr>
';
}elseif($games['games'] == 0) {
echo '
<tr style="background: red;">
<td>#'.$computerlist['id'].'</td>
<td>'.$games['name'].' - YOUR GAME IS NOW FINISHED.</td>
</tr>
';
}
break;
case "3":
echo '
<tr style="background: #9c9c9c">
<td>#'.$computerlist['id'].'</td>
<td>This computer is out of order</td>
</tr>
';
break;
}
}
?>