Update abuse.php
[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)){
68e387b9
PM
56 echo "<tr>
57 <td><b>$d[date_time_signed]</b></td>
58 <td><a href='?VTRID=$d[VTRID]'>$d[VTRID]</a></td>
6c9432fc 59 <td>".id2petition($d['petition_id'])."</td>
68e387b9
PM
60 <td>$d[signed_name_as]</td>
61 <td>$d[signed_name_as_circulator]</td>
62 <td>$d[contact_phone]</td>
63 <td>$d[signature_status]</td>
64 <td>$d[printed_status]</td>
dcc3fc26
PM
65 <td><a href='?flag_invalid_signature=$d[id]'>flag invalid signature</a></td>
66 <td><a href='?flag_VTRID=$d[VTRID]'>flag VTRID</a></td>
67 <td><a href='?flag_ip_address=$d[ip_address]'>flag ip address</a></td>
68 <td><a href='?flag_duplicate=$d[id]'>flag duplicate</a></td>
69 <td><a href='?flag_phone=$d[contact_phone]'>contact phone</a></td>
ff3013b8 70 <td><a href='?resign_requested=$d[id]'>resign requested</a></td>
3f8c226b 71 <td><a href='?bot=$d[id]'>bot</a></td>
68e387b9 72 </tr>";
7ce3d9ec 73 }
3a0177c8 74 echo "</table>";
f49d1b19
PM
75}elseif (isset($_GET['VTRID'])){
76 $VTRID = $_GET['VTRID'];
68e387b9 77 echo "<h1>Review $VTRID</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
b6545efe 78 $q = "SELECT * FROM signatures where VTRID = '$VTRID' and signature_status = 'verified' order by petition_id, id DESC ";
45bc6a1e 79 $r = $petition->query($q);
7ce3d9ec 80 while($d = mysqli_fetch_array($r)){
68e387b9
PM
81 echo "<tr>
82 <td><b>$d[date_time_signed]</b></td>
83 <td><a href='?ip_address=$d[ip_address]'>$d[ip_address]</a></td>
b6545efe 84 <td>".id2petition($d['petition_id'])."</td>
68e387b9
PM
85 <td>$d[signed_name_as]</td>
86 <td>$d[signed_name_as_circulator]</td>
87 <td>$d[contact_phone]</td>
88 <td>$d[signature_status]</td>
89 <td>$d[printed_status]</td>
dcc3fc26
PM
90 <td><a href='?flag_invalid_signature=$d[id]'>flag invalid signature</a></td>
91 <td><a href='?flag_VTRID=$d[VTRID]'>flag VTRID</a></td>
92 <td><a href='?flag_ip_address=$d[ip_address]'>flag ip address</a></td>
93 <td><a href='?flag_duplicate=$d[id]'>flag duplicate</a></td>
94 <td><a href='?flag_phone=$d[contact_phone]'>contact phone</a></td>
ff3013b8 95 <td><a href='?resign_requested=$d[id]'>resign requested</a></td>
3f8c226b 96 <td><a href='?bot=$d[id]'>bot</a></td>
68e387b9 97 </tr>";
7ce3d9ec 98 }
3a0177c8 99 echo "</table>";
f49d1b19 100}
5623205d 101?>
4b205268 102
5623205d 103<h1>Abuses</h1>
797efc8e
PM
104
105<table><tr>
106
107 <td valign="top">
e0bd2eda 108<h2>IP Address</h2>
cc84dbb5 109<div>Watch for duplicates.</div><ol>
5623205d 110<?PHP
babf0707 111$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
112$r = $petition->query($q);
113while($d = mysqli_fetch_array($r)){
4b205268 114 if ($d['count'] > 1){
55fd7459 115 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 116 }
5623205d 117}
cc84dbb5 118?></ol>
797efc8e 119 </td><td valign="top">
e0bd2eda 120<h2>VTRID</h2>
cc84dbb5 121<div>Watch for duplicates.</div><ol>
1b0319d4 122<?PHP
870eafe2 123$q="SELECT VTRID, petition_id, COUNT(*) as count FROM signatures where signature_status = 'verified' group by VTRID, petition_id";
1b0319d4 124$r = $petition->query($q);
4b205268
PM
125while($d = mysqli_fetch_array($r)){
126 if ($d['count'] > 1){
ea380aa9 127 echo "<li><a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> $d[petition_id] <b>$d[count]</b> $d[signed_name_as]</li>";
4b205268 128 }
1b0319d4 129}
cc84dbb5 130 ?></ol>
e8d1541d 131 </td></tr><tr><td valign="top">
e0bd2eda 132<h2>VTRID</h2>
cc84dbb5 133<div>Watch for 0</div><ol>
e0bd2eda 134<?PHP
e8d1541d 135$q="SELECT * FROM signatures where VTRID = '0' and signature_status <> 'bot' and signature_status <> 'flag_invalid_signature' and signature_status <> 'resign_requested'";
e0bd2eda
PM
136$r = $petition->query($q);
137while($d = mysqli_fetch_array($r)){
55fd7459 138 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 139}
cc84dbb5 140?></ol>
797efc8e 141 </td><td valign="top">
9b75965d 142<h2>petition_id</h2>
cc84dbb5 143<div>Watch for 0</div><ol>
9b75965d 144<?PHP
e8d1541d 145$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 146$r = $petition->query($q);
4931af50 147while($d = mysqli_fetch_array($r)){
55fd7459 148 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
149}
150?></ol>
e8d1541d 151 </td></tr><tr><td valign="top">
4931af50 152<h2>resign_requested</h2>
3f8c226b 153<div>These are most likely from early bugs</div><ol>
4931af50
PM
154<?PHP
155$q="SELECT * FROM signatures where signature_status = 'resign_requested'";
156$r = $petition->query($q);
9b75965d 157while($d = mysqli_fetch_array($r)){
55fd7459 158 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 159}
3f8c226b
PM
160?></ol>
161 </td>
162
163 <td valign="top">
164<h2>bots</h2>
165<div>These are bots on the site.</div><ol>
166<?PHP
167$q="SELECT * FROM signatures where signature_status = 'bot'";
168$r = $petition->query($q);
169while($d = mysqli_fetch_array($r)){
ab89bfc5 170 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 171}
cc84dbb5 172?></ol>
797efc8e 173 </td>
5623205d 174
9b75965d 175
797efc8e 176</tr></table>
9b75965d
PM
177
178
5623205d
PM
179<?PHP
180include_once('footer.php');
181?>