-
Notifications
You must be signed in to change notification settings - Fork 0
/
filecats.php
74 lines (62 loc) · 1.99 KB
/
filecats.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
<?php require("verify.php");
#### User has logged in and been verified ####?>
<HTML>
<head>
<TITLE>ThreeD - File Category List</TITLE>
<LINK REL="StyleSheet" HREF="style.css" TYPE="text/css">
</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 filecat 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 filecat SET active = $q$newin$q WHERE id = $q$xid$q;";
$uresult = pg_query($db, $uquery);
}
}
echo "<b>FILE CATEGORY LIST</b>";
$query = "SELECT * FROM filecat 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="filecats.php?xid='.$r[id].'&togactive=1'.'">'.$a.'</A>';
echo "</td>\n";
echo "<td align=center>";
echo "<a HREF=filecatedit.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 CATEGORIES FOUND</font></b>\n"; }
?>
<p><B><a href=filecatnew.php target=main>CREATE NEW CATEGORY</a></B>
</BODY>
</HTML>