Update index.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}
68e387b9
PM
34if (isset($_GET['flag_VTRID'])){
35 $VTRID = $_GET['flag_VTRID'];
36 $petition->query("update signatures set signature_status = 'flag_VTRID' where VTRID = '$VTRID' ");
c7d45ac6 37 header('Location: abuse.php');
68e387b9 38}
587d1da3
PM
39if (isset($_GET['flag_phone'])){
40 $flag_phone = $_GET['flag_phone'];
41 $petition->query("update signatures set signature_status = 'flag_phone' where contact_phone = '$flag_phone' ");
42 header('Location: abuse.php');
43}
c7d45ac6 44include_once('header.php');
f49d1b19
PM
45if (isset($_GET['ip_address'])){
46 $ip = $_GET['ip_address'];
68e387b9 47 echo "<h1>Review $ip</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
cab9e7bf 48 $q = "SELECT * FROM signatures where ip_address = '$ip' order by signature_status ";
45bc6a1e 49 $r = $petition->query($q);
7ce3d9ec 50 while($d = mysqli_fetch_array($r)){
68e387b9
PM
51 echo "<tr>
52 <td><b>$d[date_time_signed]</b></td>
53 <td><a href='?VTRID=$d[VTRID]'>$d[VTRID]</a></td>
6c9432fc 54 <td>".id2petition($d['petition_id'])."</td>
68e387b9
PM
55 <td>$d[signed_name_as]</td>
56 <td>$d[signed_name_as_circulator]</td>
57 <td>$d[contact_phone]</td>
58 <td>$d[signature_status]</td>
59 <td>$d[printed_status]</td>
dcc3fc26
PM
60 <td><a href='?flag_invalid_signature=$d[id]'>flag invalid signature</a></td>
61 <td><a href='?flag_VTRID=$d[VTRID]'>flag VTRID</a></td>
62 <td><a href='?flag_ip_address=$d[ip_address]'>flag ip address</a></td>
63 <td><a href='?flag_duplicate=$d[id]'>flag duplicate</a></td>
64 <td><a href='?flag_phone=$d[contact_phone]'>contact phone</a></td>
65 <td><a href='?flag_phone=$d[resign_requested]'>resign requested</a></td>
68e387b9 66 </tr>";
7ce3d9ec 67 }
3a0177c8 68 echo "</table>";
f49d1b19
PM
69}elseif (isset($_GET['VTRID'])){
70 $VTRID = $_GET['VTRID'];
68e387b9 71 echo "<h1>Review $VTRID</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
b6545efe 72 $q = "SELECT * FROM signatures where VTRID = '$VTRID' and signature_status = 'verified' order by petition_id, id DESC ";
45bc6a1e 73 $r = $petition->query($q);
7ce3d9ec 74 while($d = mysqli_fetch_array($r)){
68e387b9
PM
75 echo "<tr>
76 <td><b>$d[date_time_signed]</b></td>
77 <td><a href='?ip_address=$d[ip_address]'>$d[ip_address]</a></td>
b6545efe 78 <td>".id2petition($d['petition_id'])."</td>
68e387b9
PM
79 <td>$d[signed_name_as]</td>
80 <td>$d[signed_name_as_circulator]</td>
81 <td>$d[contact_phone]</td>
82 <td>$d[signature_status]</td>
83 <td>$d[printed_status]</td>
dcc3fc26
PM
84 <td><a href='?flag_invalid_signature=$d[id]'>flag invalid signature</a></td>
85 <td><a href='?flag_VTRID=$d[VTRID]'>flag VTRID</a></td>
86 <td><a href='?flag_ip_address=$d[ip_address]'>flag ip address</a></td>
87 <td><a href='?flag_duplicate=$d[id]'>flag duplicate</a></td>
88 <td><a href='?flag_phone=$d[contact_phone]'>contact phone</a></td>
89 <td><a href='?flag_phone=$d[resign_requested]'>resign requested</a></td>
68e387b9 90 </tr>";
7ce3d9ec 91 }
3a0177c8 92 echo "</table>";
f49d1b19 93}
5623205d 94?>
4b205268 95
5623205d 96<h1>Abuses</h1>
797efc8e
PM
97
98<table><tr>
99
100 <td valign="top">
e0bd2eda 101<h2>IP Address</h2>
cc84dbb5 102<div>Watch for duplicates.</div><ol>
5623205d 103<?PHP
babf0707 104$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
105$r = $petition->query($q);
106while($d = mysqli_fetch_array($r)){
4b205268 107 if ($d['count'] > 1){
ea380aa9 108 echo "<li><a href='?ip_address=$d[ip_address]'>$d[ip_address]</a> <a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> $d[petition_id] <b>$d[count]</b> $d[signed_name_as]</li>";
4b205268 109 }
5623205d 110}
cc84dbb5 111?></ol>
797efc8e 112 </td><td valign="top">
e0bd2eda 113<h2>VTRID</h2>
cc84dbb5 114<div>Watch for duplicates.</div><ol>
1b0319d4 115<?PHP
870eafe2 116$q="SELECT VTRID, petition_id, COUNT(*) as count FROM signatures where signature_status = 'verified' group by VTRID, petition_id";
1b0319d4 117$r = $petition->query($q);
4b205268
PM
118while($d = mysqli_fetch_array($r)){
119 if ($d['count'] > 1){
ea380aa9 120 echo "<li><a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> $d[petition_id] <b>$d[count]</b> $d[signed_name_as]</li>";
4b205268 121 }
1b0319d4 122}
cc84dbb5 123 ?></ol>
797efc8e 124 </td><td valign="top">
e0bd2eda 125<h2>VTRID</h2>
cc84dbb5 126<div>Watch for 0</div><ol>
e0bd2eda 127<?PHP
dcc3fc26 128$q="SELECT * FROM signatures where VTRID = '0' and signature_status <> 'flag_invalid_signature'";
e0bd2eda
PM
129$r = $petition->query($q);
130while($d = mysqli_fetch_array($r)){
ea380aa9 131 echo "<li>$d[date_time_signed] <a href='?ip_address=$d[ip_address]'>$d[ip_address]</a> <a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> $d[petition_id] $d[signed_name_as]</li>";
9b75965d 132}
cc84dbb5 133?></ol>
797efc8e 134 </td><td valign="top">
9b75965d 135<h2>petition_id</h2>
cc84dbb5 136<div>Watch for 0</div><ol>
9b75965d 137<?PHP
dcc3fc26 138$q="SELECT * FROM signatures where petition_id = '0' or petition_id = '' and signature_status <> 'flag_invalid_signature'";
9b75965d
PM
139$r = $petition->query($q);
140while($d = mysqli_fetch_array($r)){
ea380aa9 141 echo "<li>$d[date_time_signed] <a href='?ip_address=$d[ip_address]'>$d[ip_address]</a> <a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> $d[petition_id] $d[signed_name_as]</li>";
e0bd2eda 142}
cc84dbb5 143?></ol>
797efc8e 144 </td>
5623205d 145
9b75965d 146
797efc8e 147</tr></table>
9b75965d
PM
148
149
5623205d
PM
150<?PHP
151include_once('footer.php');
152?>