Create robots.txt
[clinton/MarylandElectronicPetitionSignature.git] / admin / abuse.php
CommitLineData
5623205d
PM
1<?PHP
2include_once('../slack.php');
3include_once('security.php');
c7d45ac6 4include_once('/var/www/secure.php'); //outside webserver
6c9432fc 5include_once('functions.php');
5623205d
PM
6if ($_COOKIE['level'] == 'user'){
7 slack_general('ADMIN: Redirect User Home ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition');
8 header('Location: user_home.php');
9}
10if ($_COOKIE['level'] == 'manager'){
11 slack_general('ADMIN: Redirect Manager Home ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition');
12 header('Location: manager_home.php');
13}
73a94d3f 14if (isset($_GET['flag_invalid_signature'])){
68e387b9 15 $id = $_GET['flag_invalid_signature'];
73a94d3f 16 $petition->query("update signatures set signature_status = 'flag_invalid_signature' where id = '$id' ");
c7d45ac6 17 header('Location: abuse.php');
73a94d3f 18}
68e387b9
PM
19if (isset($_GET['flag_duplicate'])){
20 $id = $_GET['flag_duplicate'];
21 $petition->query("update signatures set signature_status = 'flag_duplicate' where id = '$id' ");
c7d45ac6 22 header('Location: abuse.php');
68e387b9
PM
23}
24if (isset($_GET['flag_ip_address'])){
25 $ip = $_GET['flag_ip_address'];
26 $petition->query("update signatures set signature_status = 'flag_ip_address' where ip_address = '$ip' ");
c7d45ac6 27 header('Location: abuse.php');
68e387b9 28}
dcc3fc26
PM
29if (isset($_GET['resign_requested'])){
30 $id = $_GET['resign_requested'];
31 $petition->query("update signatures set signature_status = 'resign_requested' where id = '$id' ");
32 header('Location: abuse.php');
33}
3f8c226b
PM
34if (isset($_GET['bot'])){
35 $id = $_GET['bot'];
36 $petition->query("update signatures set signature_status = 'bot' where id = '$id' ");
37 header('Location: abuse.php');
38}
68e387b9
PM
39if (isset($_GET['flag_VTRID'])){
40 $VTRID = $_GET['flag_VTRID'];
41 $petition->query("update signatures set signature_status = 'flag_VTRID' where VTRID = '$VTRID' ");
c7d45ac6 42 header('Location: abuse.php');
68e387b9 43}
587d1da3
PM
44if (isset($_GET['flag_phone'])){
45 $flag_phone = $_GET['flag_phone'];
46 $petition->query("update signatures set signature_status = 'flag_phone' where contact_phone = '$flag_phone' ");
47 header('Location: abuse.php');
48}
c7d45ac6 49include_once('header.php');
f49d1b19
PM
50if (isset($_GET['ip_address'])){
51 $ip = $_GET['ip_address'];
68e387b9 52 echo "<h1>Review $ip</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
6c50c9f6 53 $q = "SELECT * FROM signatures where ip_address = '$ip' order by signature_status desc ";
45bc6a1e 54 $r = $petition->query($q);
7ce3d9ec 55 while($d = mysqli_fetch_array($r)){
4fca24b9
PM
56 $color = 'white';
57 $pos = strpos($d['date_time_signed'], date('Y-m-d'));
58 if ($pos !== false) {
59 $color= 'yellow';
60 }
61 echo "<tr style='background-color:$color;'>
68e387b9
PM
62 <td><b>$d[date_time_signed]</b></td>
63 <td><a href='?VTRID=$d[VTRID]'>$d[VTRID]</a></td>
6c9432fc 64 <td>".id2petition($d['petition_id'])."</td>
68e387b9
PM
65 <td>$d[signed_name_as]</td>
66 <td>$d[signed_name_as_circulator]</td>
67 <td>$d[contact_phone]</td>
68 <td>$d[signature_status]</td>
69 <td>$d[printed_status]</td>
dcc3fc26
PM
70 <td><a href='?flag_invalid_signature=$d[id]'>flag invalid signature</a></td>
71 <td><a href='?flag_VTRID=$d[VTRID]'>flag VTRID</a></td>
72 <td><a href='?flag_ip_address=$d[ip_address]'>flag ip address</a></td>
73 <td><a href='?flag_duplicate=$d[id]'>flag duplicate</a></td>
74 <td><a href='?flag_phone=$d[contact_phone]'>contact phone</a></td>
ff3013b8 75 <td><a href='?resign_requested=$d[id]'>resign requested</a></td>
3f8c226b 76 <td><a href='?bot=$d[id]'>bot</a></td>
68e387b9 77 </tr>";
7ce3d9ec 78 }
3a0177c8 79 echo "</table>";
b331a809
PM
80}elseif(isset($_GET['php_session_id'])){
81 $php_session_id = $_GET['php_session_id'];
82 echo "<h1>Review $php_session_id</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
83 $q = "SELECT * FROM presign where php_session_id = '$php_session_id' order by id desc ";
84 $r = $petition->query($q);
85 while($d = mysqli_fetch_array($r)){
86 $color = 'white';
eea234c3
PM
87 $test = date('Y-m-d',strtotime($d['action_on']));
88 $pos = strpos($test, date('Y-m-d'));
b331a809
PM
89 if ($pos !== false) {
90 $color= 'yellow';
91 }
92 echo "<tr style='background-color:$color;'>
eea234c3
PM
93 <td style='white-space:pre;'><b>$d[action_on]</b></td>
94 <td style='white-space:pre;'>$d[php_page]</td>
95 <td style='white-space:pre;'>".id2petition($d['petition'])."</td>
96 <td style='white-space:pre;'>$d[invite]</td>
97 <td style='white-space:pre;'>$d[name]</td>
98 <td style='white-space:pre;'>$d[email_for_follow_up]</td>
99 <td style='white-space:pre;'>$d[phone_for_validation]</td>
100 <td style='white-space:pre;'>$d[presign_status]</td>
101 <td style='white-space:pre;'>$d[ip_address]</td>
102 <td style='white-space:pre;'>$d[browser_string]</td>
b331a809
PM
103 </tr>";
104 }
105 echo "</table>";
f49d1b19
PM
106}elseif (isset($_GET['VTRID'])){
107 $VTRID = $_GET['VTRID'];
68e387b9 108 echo "<h1>Review $VTRID</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
783d17ee 109 $q = "SELECT * FROM signatures where VTRID = '$VTRID' and signature_status <> 'deleted' order by petition_id, id DESC ";
45bc6a1e 110 $r = $petition->query($q);
7ce3d9ec 111 while($d = mysqli_fetch_array($r)){
4fca24b9
PM
112 $color = 'white';
113 $pos = strpos($d['date_time_signed'], date('Y-m-d'));
114 if ($pos !== false) {
115 $color= 'yellow';
116 }
117 echo "<tr style='background-color:$color;'>
68e387b9
PM
118 <td><b>$d[date_time_signed]</b></td>
119 <td><a href='?ip_address=$d[ip_address]'>$d[ip_address]</a></td>
b6545efe 120 <td>".id2petition($d['petition_id'])."</td>
68e387b9
PM
121 <td>$d[signed_name_as]</td>
122 <td>$d[signed_name_as_circulator]</td>
123 <td>$d[contact_phone]</td>
124 <td>$d[signature_status]</td>
125 <td>$d[printed_status]</td>
dcc3fc26
PM
126 <td><a href='?flag_invalid_signature=$d[id]'>flag invalid signature</a></td>
127 <td><a href='?flag_VTRID=$d[VTRID]'>flag VTRID</a></td>
128 <td><a href='?flag_ip_address=$d[ip_address]'>flag ip address</a></td>
129 <td><a href='?flag_duplicate=$d[id]'>flag duplicate</a></td>
130 <td><a href='?flag_phone=$d[contact_phone]'>contact phone</a></td>
ff3013b8 131 <td><a href='?resign_requested=$d[id]'>resign requested</a></td>
3f8c226b 132 <td><a href='?bot=$d[id]'>bot</a></td>
68e387b9 133 </tr>";
7ce3d9ec 134 }
3a0177c8 135 echo "</table>";
f49d1b19 136}
5623205d 137?>
4b205268 138
5623205d 139<h1>Abuses</h1>
797efc8e
PM
140
141<table><tr>
142
143 <td valign="top">
e0bd2eda 144<h2>IP Address</h2>
cc84dbb5 145<div>Watch for duplicates.</div><ol>
5623205d 146<?PHP
babf0707 147$q="SELECT ip_address, petition_id,VTRID, COUNT(*) as count FROM signatures where signature_status = 'verified' group by ip_address, petition_id, VTRID";
5623205d
PM
148$r = $petition->query($q);
149while($d = mysqli_fetch_array($r)){
4b205268 150 if ($d['count'] > 1){
55fd7459 151 echo "<li><a href='?ip_address=$d[ip_address]'>$d[ip_address]</a> <a target='_Blank' href='https://ipinfo.io/$d[ip_address]'>IP INFO</a> <a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> $d[petition_id] <b>$d[count]</b> $d[signed_name_as]</li>";
4b205268 152 }
5623205d 153}
cc84dbb5 154?></ol>
797efc8e 155 </td><td valign="top">
e0bd2eda 156<h2>VTRID</h2>
cc84dbb5 157<div>Watch for duplicates.</div><ol>
1b0319d4 158<?PHP
870eafe2 159$q="SELECT VTRID, petition_id, COUNT(*) as count FROM signatures where signature_status = 'verified' group by VTRID, petition_id";
1b0319d4 160$r = $petition->query($q);
4b205268
PM
161while($d = mysqli_fetch_array($r)){
162 if ($d['count'] > 1){
ea380aa9 163 echo "<li><a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> $d[petition_id] <b>$d[count]</b> $d[signed_name_as]</li>";
4b205268 164 }
1b0319d4 165}
cc84dbb5 166 ?></ol>
e8d1541d 167 </td></tr><tr><td valign="top">
e0bd2eda 168<h2>VTRID</h2>
cc84dbb5 169<div>Watch for 0</div><ol>
e0bd2eda 170<?PHP
e8d1541d 171$q="SELECT * FROM signatures where VTRID = '0' and signature_status <> 'bot' and signature_status <> 'flag_invalid_signature' and signature_status <> 'resign_requested'";
e0bd2eda
PM
172$r = $petition->query($q);
173while($d = mysqli_fetch_array($r)){
55fd7459 174 echo "<li>$d[date_time_signed] <a href='?ip_address=$d[ip_address]'>$d[ip_address]</a> <a target='_Blank' href='https://ipinfo.io/$d[ip_address]'>IP INFO</a> $d[petition_id] $d[signed_name_as]</li>";
9b75965d 175}
cc84dbb5 176?></ol>
797efc8e 177 </td><td valign="top">
9b75965d 178<h2>petition_id</h2>
cc84dbb5 179<div>Watch for 0</div><ol>
9b75965d 180<?PHP
e8d1541d 181$q="SELECT * FROM signatures where (petition_id = '0' or petition_id = '') and signature_status <> 'bot' and signature_status <> 'flag_invalid_signature' and signature_status <> 'resign_requested'";
9b75965d 182$r = $petition->query($q);
4931af50 183while($d = mysqli_fetch_array($r)){
55fd7459 184 echo "<li>$d[date_time_signed] <a href='?ip_address=$d[ip_address]'>$d[ip_address]</a> <a target='_Blank' href='https://ipinfo.io/$d[ip_address]'>IP INFO</a> $d[petition_id] $d[signed_name_as]</li>";
4931af50
PM
185}
186?></ol>
e8d1541d 187 </td></tr><tr><td valign="top">
4931af50 188<h2>resign_requested</h2>
3f8c226b 189<div>These are most likely from early bugs</div><ol>
4931af50 190<?PHP
68fde5b1 191$q="SELECT * FROM signatures where signature_status = 'resign_requested' order by ip_address";
4931af50 192$r = $petition->query($q);
9b75965d 193while($d = mysqli_fetch_array($r)){
55fd7459 194 echo "<li>$d[date_time_signed] <a href='?ip_address=$d[ip_address]'>$d[ip_address]</a> <a target='_Blank' href='https://ipinfo.io/$d[ip_address]'>IP INFO</a> <a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> $d[petition_id] $d[signed_name_as]</li>";
e0bd2eda 195}
3f8c226b
PM
196?></ol>
197 </td>
198
199 <td valign="top">
200<h2>bots</h2>
201<div>These are bots on the site.</div><ol>
202<?PHP
68fde5b1 203$q="SELECT * FROM signatures where signature_status = 'bot' order by ip_address";
3f8c226b
PM
204$r = $petition->query($q);
205while($d = mysqli_fetch_array($r)){
ab89bfc5 206 echo "<li>$d[date_time_signed] <a href='?ip_address=$d[ip_address]'>$d[ip_address]</a> <a target='_Blank' href='https://ipinfo.io/$d[ip_address]'>IP INFO</a> <a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> $d[petition_id] $d[signed_name_as]</li>";
3f8c226b 207}
cc84dbb5 208?></ol>
797efc8e 209 </td>
5623205d 210
9b75965d 211
05fddd22
PM
212</tr>
213<tr>
214<td valign="top">
bdc1dd01 215<h2>Pre-Sign</h2>
9fa521d8 216<div>Follow up requested - never signed.</div><ol>
05fddd22 217<?PHP
0ef8188c 218$q="SELECT distinct email_for_follow_up, php_session_id, name, petition, invite FROM presign where presign_status = 'NEW' and email_for_follow_up <> '' order by id desc";
05fddd22
PM
219$r = $petition->query($q);
220while($d = mysqli_fetch_array($r)){
e010f7e6 221 echo "<li><a href='?php_session_id=$d[php_session_id]'>$d[name] $d[email_for_follow_up] ($d[petition])</a></li>";
05fddd22
PM
222}
223?></ol>
224 </td>
225<td valign="top">
bdc1dd01
PM
226<h2>Signature</h2>
227<div>Last 10</div><ol>
05fddd22 228<?PHP
7b154908 229$q="SELECT * FROM signatures where signature_status = 'verified' order by id desc limit 0, 10";
05fddd22
PM
230$r = $petition->query($q);
231while($d = mysqli_fetch_array($r)){
9390413f 232 echo "<li>$d[date_time_signed] ".id2petition($d['petition_id'])." $d[signed_name_as]</li>";
05fddd22
PM
233}
234?></ol>
235 </td>
236
237 </tr>
238</table>
9b75965d
PM
239
240
5623205d
PM
241<?PHP
242include_once('footer.php');
243?>