-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlock.php
48 lines (36 loc) · 1009 Bytes
/
lock.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
<?php
require_once("configuration/main.php");
if(!$permissions['viewforum'])
{
redirect("errors/permissions.html");
}
$mQuery = $mysql->query("SELECT `poster`, `locked` 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['viewotherthreads'] && $mData['poster'] != $_SESSION['accountid'])
{
redirect("errors/permissions.html");
}
if(!$permissions['lockthreads'] && (!$permissions['lockownthreads'] || $mData['poster'] != $_SESSION['accountid']))
{
redirect("errors/permissions.html");
}
if($mData['locked'])
{
$mysql->query("UPDATE `threads` SET `locked` = '0' WHERE `id` = '" . escape($_GET['thread']) . "'");
}
else
{
$mysql->query("UPDATE `threads` SET `locked` = '1' WHERE `id` = '" . escape($_GET['thread']) . "'");
}
redirect("thread?id=" . $_GET['thread'] . "");
?>
<?php
require_once("includes/footer.php");
?>