This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathremovelistitem.php
153 lines (137 loc) · 4.12 KB
/
removelistitem.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
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
147
148
149
150
151
152
153
<?
require("include/top.php");
if ($SESSION_LEVEL=='administrator' || $SESSION_LEVEL=='moderator' || $SESSION_LEVEL=='gloperator'):
unset($submitok);
// check the submitted data
if($itemid)
{
$query = "SELECT upkeeper FROM lists where id='".$which."'";
$result=mysql_query($query);
$upkeeper=mysql_result($result,0);
if($_SESSION["SCENEID_ID"]!=$upkeeper) {
$errormessage[] = "you're not the upkeeper of this list sonnyboy";
}
if(!$type) {
$errormessage[] = "you must select a type";
}
$query = "SELECT itemid FROM listitems where ";
$query.= "listitems.list='".$which."' and ";
$query.= "listitems.itemid='".$itemid."' and ";
$query.= "listitems.type='".$type."'";
$query.= " LIMIT 1";
$result=mysql_query($query);
$itemcheck=mysql_result($result,0);
if($itemcheck!=$itemid) {
$errormessage[] = "no such item on this list dude! what you been smoking?";
}
if(!$errormessage)
$submitok=true;
}
// delete the submitted item
if($submitok){
$query = "DELETE FROM listitems where ";
$query.= "listitems.list='".$which."' and ";
$query.= "listitems.itemid='".$itemid."' and ";
$query.= "listitems.type='".$type."'";
$query.= " LIMIT 1";
// print($query);
mysql_query($query);
}
// get data to build the page
$result = mysql_query("DESC listitems type");
$row = mysql_fetch_row($result);
$types = explode("'",$row[1]);
?>
<br />
<form action="removelistitem.php" method="post" enctype="multipart/form-data">
<table bgcolor="#000000" cellspacing="1" cellpadding="0"><tr><td>
<table bgcolor="#000000" cellspacing="1" cellpadding="2">
<? if($submitok): ?>
<tr><th bgcolor="#224488">this listitem has been deleted</th></tr>
<tr>
<td bgcolor="#446688" align="center">
feel free to remove another one<br />
<a href="lists.php?which=<? print($which); ?>">see what you've done</a><br />
</td>
</tr>
<? endif; ?>
<? if($errormessage): ?>
<tr><th bgcolor="#224488">errors found</th></tr>
<? for($i=0;$i<count($errormessage);$i++): ?>
<? if($i%2): ?>
<tr><td bgcolor="#557799"> <b>- <font color="#FF8888"><? print($errormessage[$i]); ?></font></b></td></tr>
<? else: ?>
<tr><td bgcolor="#446688"> <b>- <font color="#FF8888"><? print($errormessage[$i]); ?></font></b></td></tr>
<? endif; ?>
<? endfor; ?>
<? endif; ?>
<tr>
<th bgcolor="#224488">remove list item</th>
</tr>
<tr>
<td bgcolor="#446688">
<table>
<tr>
<td>list:</td>
<td><input type="hidden" name="which" value="<? print($which); ?>"><? print($which); ?></td>
</tr>
<tr>
<td>itemid:</td>
<td><input type="text" name="itemid" value="<? print($itemid); ?>"><br /></td>
</tr>
<tr>
<td>type:</td>
<td>
<select name="type">
<option value="0"></option>
<?
for($i=1;$i<count($types);$i+=2) {
print("<option value=\"".$types[$i]."\">".strtolower($types[$i])."</option>\n");
}
?>
</select>
</td>
</tr>
<? //<tr>
//<td colspan="2">if there is a HQ type missing <a href="topic.php?which=1024">just inform us</a>, use plain HQ in the meantime..</td>
//</tr>
?>
</table>
</td>
</tr>
<tr>
<td bgcolor="#224488" align="right"><input type="image" src="gfx/submit.gif" style="border: 0px"></td>
</tr>
</table>
</td></tr></table>
</form>
<? else : ?>
<? if(isset($_SESSION['SESSION'])): ?>
<p>the lobster says "SOD OFF PUNK!"</p>
<p></p>
<p>you need special priveligies to access this page.</p>
<? else: ?>
<br />
<table width="20%"><tr><td>
<form action="login.php" method="post">
<table cellspacing="1" cellpadding="2" class="box">
<tr><th>login</th></tr>
<tr bgcolor="#446688">
<td nowrap align="center">
You need to be logged in to remove a listitem :: <a href="account.php">register here</a><br />
<input type="text" name="login" value="SceneID" size="15" maxlength="16" onfocus="this.value=''">
<input type="password" name="password" value="password" size="15" onfocus="javascript:if(this.value=='password') this.value='';"><br />
</td>
</tr>
<tr>
<td bgcolor="#6688AA" align="right">
<input type="image" src="gfx/submit.gif">
</td>
</tr>
</table>
</form>
</td></tr></table>
<? endif; ?>
<? endif; ?>
<br />
<? require("include/bottom.php"); ?>