-
Notifications
You must be signed in to change notification settings - Fork 0
/
allequip.php
105 lines (78 loc) · 2.47 KB
/
allequip.php
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
<!DOCTYPE html>
<html>
<head>
<link rel = "stylesheet" href = "/portal/style.css?v=<?=time();?>">
<title>DMG Portal - All Equipment</title>
</head>
<body>
<?php
session_start();
$_SESSION['ref'] = "allequip.php";
include 'topbar.php';
include 'db_connect.php';
$username = $_COOKIE[DMGuser];
$result = $conn_users->query("SELECT role FROM USER_LIST WHERE usern = '".$username."'");
foreach($result as $value){
if($value['role'] != 'admin'){
header("location:main.php");
}
}
?>
<br>
<?php
$sql = 'SELECT * FROM EQ_LIST ORDER BY fullname';
$result = $conn_equipt->query($sql);
echo '<div class="bulk">';
echo "<table style='width:70%' id='customers'>";
echo "<tr>";
foreach($result as $value){
echo "<td>" . $value['fullname'] . "</td>";
echo "<td>" . $value['abbrev'] . "</td>";
echo "<td>" . $value['RA'] . "</td>";
if(empty( $value['Room'])){
echo "<td>No room!</td>";
}else{
echo "<td>" . $value['Room'] . "</td>";
}
echo "<td>";
echo '<form method="post" action="setadmineqcookie.php">';
echo '<input type="hidden" name="eq" value="'.$value["abbrev"].'">';
echo "<input type='submit' value='Manage' style='width:100%'>";
echo '</form>';
echo "</td>";
if($value['bookable']!= '0'){
echo '<td>';
echo '<form method="post" action="webcal/login.php">';
//echo '<form method="post" action="webcal/newacc.php">';
echo '<input type="hidden" name="eq" value="'.$value["abbrev"].'">';
/* if(($value["abbrev"] == "MiniHe3")||($value["abbrev"] == "MiniHe4")){
echo '<input type="hidden" name="login" value="mini"/>';
}elseif (($value["abbrev"] == "TcR")||($value["abbrev"] == "NewP")){
echo '<input type="hidden" name="login" value="dewar"/>';
}else{
echo '<input type="hidden" name="login" value="'.$value["abbrev"].'"/>';
}*/
echo '<input type="hidden" name="login" value="'.$value["abbrev"].'">';
echo '<input type="hidden" name="password" value="admin">';
echo "<input type='submit' value='Booking' style='width:100%'>";
echo '</form>';
echo ' </td>';
}else{
echo "<td></td>";
}
echo "<td>";
echo '<form method="post" action="confirmdelete.php")>';
echo '<input type="hidden" name="del_eq" value="'.$value["abbrev"].'">';
echo '<input type="hidden" name="act" value="delete">';
echo '<input type="hidden" name="refpage" value="allequip.php">';
echo "<input type='submit' value='Delete Equipment' style='width:100%'>";
echo '</form>';
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo '<br><a href="createequip.php"> Create New Equipment</a>';
?>
</div>
</body>
</html>