-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathpostradar.php
More file actions
86 lines (70 loc) · 2.47 KB
/
postradar.php
File metadata and controls
86 lines (70 loc) · 2.47 KB
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
<?php
require 'lib/function.php';
$windowtitle = "Editing Post Radar";
if (!$log) {
require 'lib/layout.php';
print "$header
<br>$tblstart$tccell1>You must be logged in to edit your post radar.<br>
".redirect('index.php','return to the board',0).$tblend.$footer;
printtimedif($startingtime);
die();
}
// Login confirmed from here on out
// Changes above form to save a redirect
if ($_POST['action'] == 'dochanges') {
$user = $sql->resultq("SELECT name FROM users WHERE id=$loguserid");
if ($rem) $sql->query("DELETE FROM postradar WHERE user=$loguserid and comp=". intval($rem) ."");
if ($add) $sql->query("INSERT INTO postradar (user,comp) VALUES ($loguserid,". intval($add) .")");
if ($submit2) {
require 'lib/layout.php';
print "$header
<br>$tblstart$tccell1>Thank you, $user, for editing your post radar.<br>
".redirect('index.php','return to the board',0).$tblend.$footer;
printtimedif($startingtime);
die();
}
}
// Form
// Include layout now so post radar on top of page is properly updated
require 'lib/layout.php';
// Deletions before additions
$users1 = $sql->query("SELECT p.comp, u.name, u.posts FROM postradar p, users u WHERE u.id=p.comp AND user=$loguserid");
while($user = $sql->fetch($users1)){
$remlist.="<option value=$user[comp]>$user[name] -- $user[posts] posts";
$idlist[] = $user['comp'];
}
$remlist="
<select name=rem>
<option value=0 selected>Do not remove anyone
$remlist
</select>";
// Remove those already added
if ($idlist && count($idlist))
$qwhere = "AND id NOT IN (". implode(",", $idlist).")";
else $qwhere = '';
// Additions
$users1 = $sql->query("SELECT id,name,posts FROM users WHERE posts > 0 {$qwhere} ORDER BY name");
while($user = $sql->fetch($users1)){
$addlist.="<option value=$user[id]>$user[name] -- $user[posts] posts";
}
$addlist="
<select name=add>
<option value=0 selected>Do not add anyone
$addlist
</select>";
$prtable="
$tccellh> </td>$tccellh> <tr>
$tccell1><b>Add an user</td>$tccell2l>$addlist<tr>
$tccell1><b>Remove an user</td>$tccell2l>$remlist<tr>
$tccellh> </td>$tccellh> <tr>
$tccell1> </td>$tccell2l>
$inph=action VALUE=dochanges>
$inph=userpass VALUE=\"$user[password]\">
$inps=submit1 VALUE=\"Submit and continue\">
$inps=submit2 VALUE=\"Submit and finish\"></td></FORM>
";
print "$header<br>
<FORM ACTION=postradar.php NAME=REPLIER METHOD=POST>
$tblstart$prtable$tblend$footer";
printtimedif($startingtime);
?>