Commit | Line | Data |
---|---|---|
5623205d PM |
1 | <?PHP |
2 | include_once('../slack.php'); | |
3 | include_once('security.php'); | |
c7d45ac6 | 4 | include_once('/var/www/secure.php'); //outside webserver |
6c9432fc | 5 | include_once('functions.php'); |
5623205d PM |
6 | if ($_COOKIE['level'] == 'user'){ |
7 | slack_general('ADMIN: Redirect User Home ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition'); | |
8 | header('Location: user_home.php'); | |
9 | } | |
28de89d0 PM |
10 | if (isset($_GET['clear_php_session_id'])){ |
11 | $id = $_GET['clear_php_session_id']; | |
12 | $petition->query("update presign set presign_status = 'DONE' where php_session_id = '$id' "); | |
cdaa5f15 | 13 | header('Location: analytics.php'); |
28de89d0 | 14 | } |
9e6d5e27 PM |
15 | if (isset($_GET['sign_php_session_id'])){ |
16 | $id = $_GET['sign_php_session_id']; | |
17 | $petition->query("update presign set presign_status = 'SIGNED' where php_session_id = '$id' "); | |
cdaa5f15 | 18 | header('Location: analytics.php'); |
9e6d5e27 | 19 | } |
5623205d PM |
20 | if ($_COOKIE['level'] == 'manager'){ |
21 | slack_general('ADMIN: Redirect Manager Home ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition'); | |
22 | header('Location: manager_home.php'); | |
23 | } | |
73a94d3f | 24 | if (isset($_GET['flag_invalid_signature'])){ |
68e387b9 | 25 | $id = $_GET['flag_invalid_signature']; |
73a94d3f | 26 | $petition->query("update signatures set signature_status = 'flag_invalid_signature' where id = '$id' "); |
cdaa5f15 | 27 | header('Location: analytics.php'); |
73a94d3f | 28 | } |
68e387b9 PM |
29 | if (isset($_GET['flag_duplicate'])){ |
30 | $id = $_GET['flag_duplicate']; | |
31 | $petition->query("update signatures set signature_status = 'flag_duplicate' where id = '$id' "); | |
cdaa5f15 | 32 | header('Location: analytics.php'); |
68e387b9 PM |
33 | } |
34 | if (isset($_GET['flag_ip_address'])){ | |
35 | $ip = $_GET['flag_ip_address']; | |
36 | $petition->query("update signatures set signature_status = 'flag_ip_address' where ip_address = '$ip' "); | |
cdaa5f15 | 37 | header('Location: analytics.php'); |
68e387b9 | 38 | } |
dcc3fc26 PM |
39 | if (isset($_GET['resign_requested'])){ |
40 | $id = $_GET['resign_requested']; | |
41 | $petition->query("update signatures set signature_status = 'resign_requested' where id = '$id' "); | |
cdaa5f15 | 42 | header('Location: analytics.php'); |
dcc3fc26 | 43 | } |
3f8c226b PM |
44 | if (isset($_GET['bot'])){ |
45 | $id = $_GET['bot']; | |
46 | $petition->query("update signatures set signature_status = 'bot' where id = '$id' "); | |
cdaa5f15 | 47 | header('Location: analytics.php'); |
3f8c226b | 48 | } |
68e387b9 PM |
49 | if (isset($_GET['flag_VTRID'])){ |
50 | $VTRID = $_GET['flag_VTRID']; | |
51 | $petition->query("update signatures set signature_status = 'flag_VTRID' where VTRID = '$VTRID' "); | |
cdaa5f15 | 52 | header('Location: analytics.php'); |
68e387b9 | 53 | } |
587d1da3 PM |
54 | if (isset($_GET['flag_phone'])){ |
55 | $flag_phone = $_GET['flag_phone']; | |
56 | $petition->query("update signatures set signature_status = 'flag_phone' where contact_phone = '$flag_phone' "); | |
cdaa5f15 | 57 | header('Location: analytics.php'); |
587d1da3 | 58 | } |
c7d45ac6 | 59 | include_once('header.php'); |
f49d1b19 PM |
60 | if (isset($_GET['ip_address'])){ |
61 | $ip = $_GET['ip_address']; | |
68e387b9 | 62 | echo "<h1>Review $ip</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>"; |
6c50c9f6 | 63 | $q = "SELECT * FROM signatures where ip_address = '$ip' order by signature_status desc "; |
45bc6a1e | 64 | $r = $petition->query($q); |
7ce3d9ec | 65 | while($d = mysqli_fetch_array($r)){ |
4fca24b9 PM |
66 | $color = 'white'; |
67 | $pos = strpos($d['date_time_signed'], date('Y-m-d')); | |
68 | if ($pos !== false) { | |
69 | $color= 'yellow'; | |
70 | } | |
71 | echo "<tr style='background-color:$color;'> | |
68e387b9 PM |
72 | <td><b>$d[date_time_signed]</b></td> |
73 | <td><a href='?VTRID=$d[VTRID]'>$d[VTRID]</a></td> | |
6c9432fc | 74 | <td>".id2petition($d['petition_id'])."</td> |
68e387b9 PM |
75 | <td>$d[signed_name_as]</td> |
76 | <td>$d[signed_name_as_circulator]</td> | |
77 | <td>$d[contact_phone]</td> | |
78 | <td>$d[signature_status]</td> | |
79 | <td>$d[printed_status]</td> | |
dcc3fc26 PM |
80 | <td><a href='?flag_invalid_signature=$d[id]'>flag invalid signature</a></td> |
81 | <td><a href='?flag_VTRID=$d[VTRID]'>flag VTRID</a></td> | |
82 | <td><a href='?flag_ip_address=$d[ip_address]'>flag ip address</a></td> | |
83 | <td><a href='?flag_duplicate=$d[id]'>flag duplicate</a></td> | |
84 | <td><a href='?flag_phone=$d[contact_phone]'>contact phone</a></td> | |
ff3013b8 | 85 | <td><a href='?resign_requested=$d[id]'>resign requested</a></td> |
3f8c226b | 86 | <td><a href='?bot=$d[id]'>bot</a></td> |
68e387b9 | 87 | </tr>"; |
7ce3d9ec | 88 | } |
3a0177c8 | 89 | echo "</table>"; |
d6495122 PM |
90 | }elseif(isset($_GET['email'])){ |
91 | $email = $_GET['email']; | |
92 | echo "<h1>Review $email</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>"; | |
93 | $q = "SELECT * FROM presign where email_for_follow_up = '$email' order by id desc "; | |
94 | $r = $petition->query($q); | |
95 | while($d = mysqli_fetch_array($r)){ | |
96 | $color = 'white'; | |
97 | $test = date('Y-m-d',strtotime($d['action_on'])); | |
98 | $pos = strpos($test, date('Y-m-d')); | |
99 | if ($pos !== false) { | |
100 | $color= 'yellow'; | |
101 | } | |
102 | echo "<tr style='background-color:$color;'> | |
103 | <td style='white-space:pre;'><b>$d[action_on]</b></td> | |
104 | <td style='white-space:pre;'><a href='$d[php_session_id]'>$d[php_session_id]</a></td> | |
105 | <td style='white-space:pre;'>$d[php_page]</td> | |
106 | <td style='white-space:pre;'>".id2petition($d['petition'])."</td> | |
107 | <td style='white-space:pre;'>$d[invite]</td> | |
108 | <td style='white-space:pre;'>$d[invite_error]</td> | |
109 | <td style='white-space:pre;'>$d[name]</td> | |
110 | <td style='white-space:pre;'>$d[email_for_follow_up]</td> | |
111 | <td style='white-space:pre;'>$d[phone_for_validation]</td> | |
112 | <td style='white-space:pre;'>$d[presign_status]</td> | |
113 | <td style='white-space:pre;'>$d[ip_address]</td> | |
114 | <td style='white-space:pre;'>$d[browser_string]</td> | |
115 | </tr>"; | |
116 | } | |
117 | echo "</table>"; | |
971585e7 | 118 | }elseif(isset($_GET['php_session_id']) && empty($_GET['follow_up'])){ |
b331a809 PM |
119 | $php_session_id = $_GET['php_session_id']; |
120 | echo "<h1>Review $php_session_id</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>"; | |
121 | $q = "SELECT * FROM presign where php_session_id = '$php_session_id' order by id desc "; | |
122 | $r = $petition->query($q); | |
123 | while($d = mysqli_fetch_array($r)){ | |
124 | $color = 'white'; | |
eea234c3 PM |
125 | $test = date('Y-m-d',strtotime($d['action_on'])); |
126 | $pos = strpos($test, date('Y-m-d')); | |
b331a809 PM |
127 | if ($pos !== false) { |
128 | $color= 'yellow'; | |
129 | } | |
130 | echo "<tr style='background-color:$color;'> | |
eea234c3 PM |
131 | <td style='white-space:pre;'><b>$d[action_on]</b></td> |
132 | <td style='white-space:pre;'>$d[php_page]</td> | |
133 | <td style='white-space:pre;'>".id2petition($d['petition'])."</td> | |
134 | <td style='white-space:pre;'>$d[invite]</td> | |
973dd966 | 135 | <td style='white-space:pre;'>$d[invite_error]</td> |
eea234c3 | 136 | <td style='white-space:pre;'>$d[name]</td> |
d6495122 | 137 | <td style='white-space:pre;'><a href='?email=$d[email_for_follow_up]'>$d[email_for_follow_up]</a></td> |
eea234c3 PM |
138 | <td style='white-space:pre;'>$d[phone_for_validation]</td> |
139 | <td style='white-space:pre;'>$d[presign_status]</td> | |
140 | <td style='white-space:pre;'>$d[ip_address]</td> | |
141 | <td style='white-space:pre;'>$d[browser_string]</td> | |
971585e7 PM |
142 | </tr>"; |
143 | } | |
e511d315 PM |
144 | echo "</table><a href='?clear_php_session_id=$php_session_id'>CLEAR ALERT</a> - |
145 | <a href='?sign_php_session_id=$php_session_id'>SIGNATURE FOUND</a> - | |
146 | - <a href='?php_session_id=$php_session_id&follow_up=1'>ADD TO FOLLOW UP LIST MGP</a> | |
147 | - <a href='?php_session_id=$php_session_id&follow_up=2'>ADD TO FOLLOW UP LIST MLP</a> | |
148 | - <a href='?php_session_id=$php_session_id&follow_up=3'>ADD TO FOLLOW UP LIST BTEC</a> | |
149 | - <a href='?php_session_id=$php_session_id&follow_up=7'>ADD TO FOLLOW UP LIST PG</a> | |
150 | - <a href='?php_session_id=$php_session_id&follow_up=8'>ADD TO FOLLOW UP LIST Ivey</a> | |
151 | "; | |
971585e7 PM |
152 | }elseif(isset($_GET['php_session_id']) && isset($_GET['follow_up'])){ |
153 | $php_session_id = $_GET['php_session_id']; | |
154 | echo "<h1>Adding Follow up for $php_session_id to $_GET[follow_up]</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>"; | |
155 | $q = "SELECT * FROM presign where php_session_id = '$php_session_id' order by id desc "; | |
156 | $r = $petition->query($q); | |
971585e7 | 157 | while($d = mysqli_fetch_array($r)){ |
f8753855 | 158 | |
971585e7 PM |
159 | $color = 'white'; |
160 | $test = date('Y-m-d',strtotime($d['action_on'])); | |
161 | $pos = strpos($test, date('Y-m-d')); | |
162 | if ($pos !== false) { | |
163 | $color= 'yellow'; | |
164 | } | |
f8753855 PM |
165 | if ($d[name] != ''){ |
166 | $name = $d[name]; | |
167 | } | |
168 | if ($d[email_for_follow_up] != ''){ | |
169 | $email = $d[email_for_follow_up]; | |
170 | } | |
971585e7 PM |
171 | echo "<tr style='background-color:$color;'> |
172 | <td style='white-space:pre;'><b>$d[action_on]</b></td> | |
173 | <td style='white-space:pre;'>$d[php_page]</td> | |
174 | <td style='white-space:pre;'>".id2petition($d['petition'])."</td> | |
175 | <td style='white-space:pre;'>$d[invite]</td> | |
176 | <td style='white-space:pre;'>$d[invite_error]</td> | |
177 | <td style='white-space:pre;'>$d[name]</td> | |
178 | <td style='white-space:pre;'>$d[email_for_follow_up]</td> | |
179 | <td style='white-space:pre;'>$d[phone_for_validation]</td> | |
180 | <td style='white-space:pre;'>$d[presign_status]</td> | |
181 | <td style='white-space:pre;'>$d[ip_address]</td> | |
182 | <td style='white-space:pre;'>$d[browser_string]</td> | |
b331a809 PM |
183 | </tr>"; |
184 | } | |
f8753855 | 185 | $petition->query("insert into follow_up (name, email, php_session, petition_id) values ('$name','$email','$php_session_id','$_GET[follow_up]') "); |
b739e778 | 186 | $petition->query("update presign set presign_status = 'DONE' where php_session_id = '$php_session_id' "); |
1f0c4bd2 | 187 | echo "</table>"; |
f49d1b19 PM |
188 | }elseif (isset($_GET['VTRID'])){ |
189 | $VTRID = $_GET['VTRID']; | |
68e387b9 | 190 | echo "<h1>Review $VTRID</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>"; |
783d17ee | 191 | $q = "SELECT * FROM signatures where VTRID = '$VTRID' and signature_status <> 'deleted' order by petition_id, id DESC "; |
45bc6a1e | 192 | $r = $petition->query($q); |
7ce3d9ec | 193 | while($d = mysqli_fetch_array($r)){ |
4fca24b9 PM |
194 | $color = 'white'; |
195 | $pos = strpos($d['date_time_signed'], date('Y-m-d')); | |
196 | if ($pos !== false) { | |
197 | $color= 'yellow'; | |
198 | } | |
199 | echo "<tr style='background-color:$color;'> | |
68e387b9 PM |
200 | <td><b>$d[date_time_signed]</b></td> |
201 | <td><a href='?ip_address=$d[ip_address]'>$d[ip_address]</a></td> | |
b6545efe | 202 | <td>".id2petition($d['petition_id'])."</td> |
68e387b9 PM |
203 | <td>$d[signed_name_as]</td> |
204 | <td>$d[signed_name_as_circulator]</td> | |
205 | <td>$d[contact_phone]</td> | |
206 | <td>$d[signature_status]</td> | |
207 | <td>$d[printed_status]</td> | |
dcc3fc26 PM |
208 | <td><a href='?flag_invalid_signature=$d[id]'>flag invalid signature</a></td> |
209 | <td><a href='?flag_VTRID=$d[VTRID]'>flag VTRID</a></td> | |
210 | <td><a href='?flag_ip_address=$d[ip_address]'>flag ip address</a></td> | |
211 | <td><a href='?flag_duplicate=$d[id]'>flag duplicate</a></td> | |
212 | <td><a href='?flag_phone=$d[contact_phone]'>contact phone</a></td> | |
ff3013b8 | 213 | <td><a href='?resign_requested=$d[id]'>resign requested</a></td> |
3f8c226b | 214 | <td><a href='?bot=$d[id]'>bot</a></td> |
68e387b9 | 215 | </tr>"; |
7ce3d9ec | 216 | } |
3a0177c8 | 217 | echo "</table>"; |
f49d1b19 | 218 | } |
5623205d | 219 | ?> |
4b205268 | 220 | |
cdaa5f15 | 221 | <h1>Signature Analytics</h1> |
d5dffc27 | 222 | <h2>NEVER NEVER NEVER CALL OR TEXT ANYONE - ONLY EMAIL!!!</h2> |
cdaa5f15 | 223 | <h3>SysOp Says: Transparency = Trust</h3> |
797efc8e | 224 | <table><tr> |
d1dcf736 PM |
225 | <tr> |
226 | <td valign="top"> | |
227 | <h2>Pre-Sign</h2> | |
228 | <div>Follow up requested - never signed.</div><ol> | |
229 | <?PHP | |
230 | $q="SELECT distinct php_session_id FROM presign where presign_status = 'NEW' and email_for_follow_up <> '' order by id desc"; | |
231 | $r = $petition->query($q); | |
232 | while($d = mysqli_fetch_array($r)){ | |
233 | $q2="SELECT * FROM presign where php_session_id = '$d[php_session_id]' order by id desc"; | |
234 | $r2 = $petition->query($q2); | |
235 | $d2 = mysqli_fetch_array($r2); | |
236 | echo "<li><a href='?php_session_id=$d2[php_session_id]'>$d2[name] $d2[email_for_follow_up] ".id2petition($d2['petition'])." $d2[invite]</a></li>"; | |
237 | } | |
238 | ?></ol> | |
239 | </td> | |
240 | <td valign="top"> | |
cdaa5f15 | 241 | <h2>Signatures</h2> |
d1dcf736 PM |
242 | <div>Last 10</div><ol> |
243 | <?PHP | |
244 | $q="SELECT * FROM signatures where signature_status = 'verified' order by id desc limit 0, 10"; | |
245 | $r = $petition->query($q); | |
246 | while($d = mysqli_fetch_array($r)){ | |
247 | echo "<li>$d[date_time_signed] ".id2petition($d['petition_id'])." $d[signed_name_as]</li>"; | |
248 | } | |
249 | ?></ol> | |
250 | </td> | |
797efc8e | 251 | |
d1dcf736 | 252 | </tr> |
797efc8e | 253 | <td valign="top"> |
e0bd2eda | 254 | <h2>IP Address</h2> |
cdaa5f15 | 255 | <div>Watching for duplicates.</div><ol> |
5623205d | 256 | <?PHP |
babf0707 | 257 | $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 |
258 | $r = $petition->query($q); |
259 | while($d = mysqli_fetch_array($r)){ | |
4b205268 | 260 | if ($d['count'] > 1){ |
cdaa5f15 | 261 | echo "<li><a href='?ip_address=$d[ip_address]'>$d[ip_address]</a> ".id2petition($d['petition_id'])." <b>$d[count]</b> $d[signed_name_as]</li>"; |
4b205268 | 262 | } |
5623205d | 263 | } |
cc84dbb5 | 264 | ?></ol> |
797efc8e | 265 | </td><td valign="top"> |
e0bd2eda | 266 | <h2>VTRID</h2> |
cdaa5f15 | 267 | <div>Watching for duplicates.</div><ol> |
1b0319d4 | 268 | <?PHP |
870eafe2 | 269 | $q="SELECT VTRID, petition_id, COUNT(*) as count FROM signatures where signature_status = 'verified' group by VTRID, petition_id"; |
1b0319d4 | 270 | $r = $petition->query($q); |
4b205268 PM |
271 | while($d = mysqli_fetch_array($r)){ |
272 | if ($d['count'] > 1){ | |
cdaa5f15 | 273 | echo "<li><a href='?VTRID=$d[VTRID]'>$d[VTRID]</a> ".id2petition($d['petition_id'])." <b>$d[count]</b> $d[signed_name_as]</li>"; |
4b205268 | 274 | } |
1b0319d4 | 275 | } |
cc84dbb5 | 276 | ?></ol> |
e8d1541d | 277 | </td></tr><tr><td valign="top"> |
cdaa5f15 PM |
278 | <h2>VTRID Bugs</h2> |
279 | <div>Watching for 0</div><ol> | |
e0bd2eda | 280 | <?PHP |
e8d1541d | 281 | $q="SELECT * FROM signatures where VTRID = '0' and signature_status <> 'bot' and signature_status <> 'flag_invalid_signature' and signature_status <> 'resign_requested'"; |
e0bd2eda PM |
282 | $r = $petition->query($q); |
283 | while($d = mysqli_fetch_array($r)){ | |
55fd7459 | 284 | 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 | 285 | } |
cc84dbb5 | 286 | ?></ol> |
797efc8e | 287 | </td><td valign="top"> |
cdaa5f15 PM |
288 | <h2>Petition ID Bugs</h2> |
289 | <div>Watching for 0</div><ol> | |
9b75965d | 290 | <?PHP |
e8d1541d | 291 | $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 | 292 | $r = $petition->query($q); |
4931af50 | 293 | while($d = mysqli_fetch_array($r)){ |
55fd7459 | 294 | 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 |
295 | } |
296 | ?></ol> | |
e8d1541d | 297 | </td></tr><tr><td valign="top"> |
cdaa5f15 | 298 | <?PHP ob_start(); ?> |
4931af50 | 299 | <h2>resign_requested</h2> |
3f8c226b | 300 | <div>These are most likely from early bugs</div><ol> |
4931af50 | 301 | <?PHP |
68fde5b1 | 302 | $q="SELECT * FROM signatures where signature_status = 'resign_requested' order by ip_address"; |
4931af50 | 303 | $r = $petition->query($q); |
cdaa5f15 | 304 | $show = 0; |
9b75965d | 305 | while($d = mysqli_fetch_array($r)){ |
cdaa5f15 | 306 | $show = 1; |
55fd7459 | 307 | 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 | 308 | } |
3f8c226b | 309 | ?></ol> |
cdaa5f15 | 310 | <?PHP $html = ob_get_clean(); if ( $show == 1 ){ echo $html; } ?> |
3f8c226b PM |
311 | </td> |
312 | ||
313 | <td valign="top"> | |
cdaa5f15 | 314 | <?PHP ob_start(); ?> |
3f8c226b PM |
315 | <h2>bots</h2> |
316 | <div>These are bots on the site.</div><ol> | |
317 | <?PHP | |
68fde5b1 | 318 | $q="SELECT * FROM signatures where signature_status = 'bot' order by ip_address"; |
3f8c226b | 319 | $r = $petition->query($q); |
cdaa5f15 | 320 | $show = 0; |
3f8c226b | 321 | while($d = mysqli_fetch_array($r)){ |
cdaa5f15 | 322 | $show = 1; |
ab89bfc5 | 323 | 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 | 324 | } |
cc84dbb5 | 325 | ?></ol> |
cdaa5f15 PM |
326 | <?PHP $html = ob_get_clean(); if ( $show == 1 ){ echo $html; } ?> |
327 | ||
797efc8e | 328 | </td> |
5623205d | 329 | |
9b75965d | 330 | |
05fddd22 | 331 | </tr> |
05fddd22 | 332 | |
05fddd22 | 333 | </table> |
9b75965d PM |
334 | |
335 | ||
5623205d PM |
336 | <?PHP |
337 | include_once('footer.php'); | |
338 | ?> |