-
Notifications
You must be signed in to change notification settings - Fork 1
/
delete.php
114 lines (109 loc) · 3.75 KB
/
delete.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
<?php
$title="Forum Management";
include("../config.php");
include("../header.php");
checks();
$result = mysql_query("SELECT level FROM Players WHERE id='{$_COOKIE['id']}'");
$row = mysql_fetch_array ($result);
$lvl = $row[0];
if ($lvl < 0) {
$url .= '/members/forums/vforum.php?page=1';
header("Location: $url");
exit();
} else {
$a = $_POST['checkbox'];
if ($a == NULL) {
echo "<div align=\"center\" id='crimestext'>No topics were selected!<br /><a href=\"javascript: history.go(-1)\">Go back.</a></div>";
include("../footer.php");
exit();
}
if ($_REQUEST['delete']) {
foreach ($a as $id)
{
$row=mysql_fetch_array(mysql_query("SELECT id, postid FROM thread WHERE fid='$id' LIMIT 1;"));
$car = $row[0];
$pid=$row[1];
if ($car == NULL) {
echo "<div align=\"center\" id='crimestext'>Please select At least one topic!<br /><a href=\"javascript: history.go(-1)\">Go back.</a></div>";
include("../footer.php");
exit();
}
mysql_query("DELETE FROM post WHERE id='$pid' LIMIT 1;");
mysql_query("DELETE FROM thread WHERE fid='$id' LIMIT 1;");
$sql=mysql_query("SELECT postid FROM reply WHERE topicid='$id'");
while ($row=mysql_fetch_array($sql)){
$rid=$row[0];
mysql_query("DELETE FROM post WHERE id='$rid'");
mysql_query("DELETE FROM reply WHERE topicid='$id'");
}
}
echo "<div align=\"center\" id='crimestext'>Selected topics were deleted!<br /><a href=\"vforum.php?page=1\">Go back.</a></div>";
include("../footer.php");
exit();
} elseif ($_REQUEST['stick']) {
foreach ($a as $id)
{
$query = mysql_query("SELECT id, stick FROM thread WHERE fid='$id'");
$row = mysql_fetch_array($query);
$car = $row[0];
$s = $row[1];
if ($car == NULL) {
echo "<div align=\"center\" id='crimestext'>Please select At least one topic!<br /><a href=\"javascript: history.go(-1)\">Go back.</a></div>";
include("../footer.php");
exit();
}
if($s == 0) {
$sql = mysql_query("UPDATE thread SET stick=1 WHERE fid='$id' LIMIT 1");
} elseif ($s == 1) {
$sql = mysql_query("UPDATE thread SET stick=0 WHERE fid='$id' LIMIT 1");
}
}
echo"<div align=\"center\" id='crimestext'>Selected topics were stuck/unstuck!<br /><a href=\"vforum.php?page=1\">Go back.</a></div>";
include("../footer.php");
} elseif ($_REQUEST['move']) {
foreach ($a as $id)
{
$query = mysql_query("SELECT id, sales FROM thread WHERE fid='$id'");
$row = mysql_fetch_array($query);
$car = $row[0];
$sales = $row[1];
if ($car == NULL) {
echo "<div align=\"center\" id='crimestext'>Please select At least one topic!<br /><a href=\"javascript: history.go(-1)\">Go back.</a></div>";
include("../footer.php");
exit();
}
if ($sales == 'yes') {
mysql_query("UPDATE thread SET sales='' WHERE fid='$id'");
echo "<div align=\"center\" id='crimestext'>The selected thread(s) were moved to the General forum.<br /><a href=\"vforum.php?page=1\">Go back.</a></div>";
include("../footer.php");
exit();
} else {
mysql_query("UPDATE thread SET sales='yes' WHERE fid='$id'");
echo "<div align=\"center\" id='crimestext'>The selected thread(s) were moved to the Sales forum.<br /><a href=\"sforum.php?page=1\">Go back.</a></div>";
include("../footer.php");
exit();
}
}
} elseif ($_REQUEST['lock']) {
foreach ($a as $id)
{
$query = mysql_query("SELECT id, lo FROM thread WHERE fid='$id'");
$row = mysql_fetch_array($query);
$car = $row[0];
$s = $row[1];
if ($car == NULL) {
echo "<div align=\"center\" id='crimestext'>Please select at least one topic!<br /><a href=\"javascript: history.go(-1)\">Go back.</a></div>";
include("../footer.php");
exit();
}
if($s == 0) {
$sql = mysql_query("UPDATE thread SET lo=1 WHERE fid='$id' LIMIT 1");
} elseif ($s == 1) {
$sql = mysql_query("UPDATE thread SET lo=0 WHERE fid='$id' LIMIT 1");
}
}
echo "<div align=\"center\" id=\"crimestext\">Selected topics were locked/unlocked!<br /><a href=\"vforum.php?page=1\">Go back.</a></div>";
include("../footer.php");
}
}
?>