-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhidepost.php
69 lines (52 loc) · 1.51 KB
/
hidepost.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
<?php
require_once("configuration/main.php");
if(!$permissions['viewforum'])
{
redirect("errors/permissions.html");
}
if($_GET['thread'])
{
$mQuery = $mysql->query("SELECT `section`, `poster`, `hidden` FROM `threads` WHERE `id` = '" . escape($_GET['thread']) . "'");
if($mQuery->num_rows)
{
$mData = $mQuery->fetch_assoc();
}
else
{
die("You have followed an invalid link.");
}
if(!$permissions['hidepost'] && (!$permissions['hideownthreads'] || $mData['poster'] != $_SESSION['accountid']))
{
redirect("errors/permissions.html");
}
$hidden = ($mData['hidden']) ? 0 : 1;
$mysql->query("UPDATE `threads` SET `hidden` = '$hidden' WHERE `id` = '" . escape($_GET['thread']) . "'");
redirect("section?id=" . $mData['section'] . "");
}
else if($_GET['comment'])
{
$mQuery = $mysql->query("SELECT `thread`, `poster`, `hidden` FROM `comments` WHERE `id` = '" . escape($_GET['comment']) . "'");
if($mQuery->num_rows)
{
$mData = $mQuery->fetch_assoc();
}
else
{
die("You have followed an invalid link.");
}
if(!$permissions['hidepost'] && (!$permissions['hideownposts'] || $mData['poster'] != $_SESSION['accountid']))
{
redirect("errors/permissions.html");
}
$hidden = ($mData['hidden']) ? 0 : 1;
$mysql->query("UPDATE `comments` SET `hidden` = '$hidden' WHERE `id` = '" . escape($_GET['comment']) . "'");
redirect("thread?id=" . $mData['thread'] . "");
}
else
{
die("You have followed an invalid link.");
}
?>
<?php
require_once("includes/footer.php");
?>