-
Notifications
You must be signed in to change notification settings - Fork 0
/
assets.php
81 lines (68 loc) · 2.23 KB
/
assets.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
<?php require("verify.php");
#### User has logged in and been verified ####
header("Cache-Control: no-cache");
header("Pragma: no-cache");
header("Expires: 0");?>
<HTML>
<head>
<TITLE>ThreeD - Manage Assets</TITLE>
<LINK REL="StyleSheet" HREF="style.css" TYPE="text/css">
<META HTTP-EQUIV="Expires" CONTENT="Fri, Jun 12 1981 08:20:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
</head>
<BODY onload="document.forms[0].xname.focus()">
<?php
if (!$admin) {
echo "<p><font color=red><b>Must be an Administrator to do that!</b></font><p>";
echo "</BODY></HTML>";
exit;
}
settype ($xid, "integer");
if ($togactive && $xid != $cid) {
$query = "SELECT * FROM bookingthing WHERE id = $q$xid$q;";
$result = pg_query($db, $query);
$num = pg_num_rows($result);
if ($num == 1) {
$row = pg_Fetch_array($result, 0, PGSQL_ASSOC);
if ($row[active] == 't') { $newin = 'f'; } else { $newin = 't'; }
$uquery = "UPDATE bookingthing SET active = $q$newin$q WHERE id = $q$xid$q;";
$uresult = pg_query($db, $uquery);
}
}
echo "<b>ASSET LIST</b>";
$query = "SELECT * FROM bookingthing ORDER by UPPER(name), id;";
$result = pg_query($db, $query);
$num = pg_num_rows($result);
if ($num) {
echo "<p>\n";
echo "<p><TABLE border=1 cellpadding=2 cellspacing=0 bgcolor=#CCCCCC>\n";
echo "<tr><td align=left><b>Name</b></td><td align=center><b>Active</b></td><td align=center><b>Action</b></td></tr>\n";
for ($i=0;$i<$num;$i++) {
echo "<TR valign=top bgcolor=#";
if ($i % 2 == 0) { echo "AAAAFF"; } else { echo "CCCCFF"; }
echo ">";
$r = pg_Fetch_array($result, $i, PGSQL_ASSOC);
$a = htmlentities($r[name]);
echo "<td>";
if ($a) { echo "$a"; }
else { echo " "; }
echo "</td>\n";
$a = "no";
if ($r[active] == 't') { $a = "<font color=red>yes</font>"; }
echo "<td align=center>";
echo '<A HREF="assets.php?xid='.$r[id].'&togactive=1'.'">'.$a.'</A>';
echo "</td>\n";
echo "<td align=center>";
echo "<a HREF=assetedit.php?";
echo 'gid=' . $r[id] . ">Edit<a>";
echo "</td></TR>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
}
else { echo "<p><b><font color=red>NO ASSETS FOUND</font></b>\n"; }
?>
<p><B><a href=assetnew.php target=main>CREATE NEW ASSET</a></B>
</BODY>
</HTML>