2 include_once('../slack.php');
3 include_once('security.php');
4 include_once('/var/www/secure.php'); //outside webserver
5 include_once('functions.php');
6 if ($_COOKIE['level'] == 'user'){
7 slack_general('ADMIN: Redirect User Home ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition');
8 header('Location: user_home.php');
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' ");
13 header('Location: analytics.php');
15 if (isset($_GET['clear_email'])){
16 $email = $_GET['clear_email'];
17 $petition->query("update presign set presign_status = 'DONE' where email_for_follow_up = '$email' ");
18 header('Location: analytics.php');
20 if (isset($_GET['sign_email'])){
21 $email = $_GET['sign_email'];
22 $petition->query("update presign set presign_status = 'SIGNED' where email_for_follow_up = '$email' ");
23 header('Location: analytics.php');
25 if (isset($_GET['sign_php_session_id'])){
26 $id = $_GET['sign_php_session_id'];
27 $petition->query("update presign set presign_status = 'SIGNED' where php_session_id = '$id' ");
28 header('Location: analytics.php');
30 if ($_COOKIE['level'] == 'manager'){
31 slack_general('ADMIN: Redirect Manager Home ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition');
32 header('Location: manager_home.php');
34 if (isset($_GET['flag_invalid_signature'])){
35 $id = $_GET['flag_invalid_signature'];
36 $petition->query("update signatures set signature_status = 'flag_invalid_signature' where id = '$id' ");
37 header('Location: analytics.php');
39 if (isset($_GET['flag_duplicate'])){
40 $id = $_GET['flag_duplicate'];
41 $petition->query("update signatures set signature_status = 'flag_duplicate' where id = '$id' ");
42 header('Location: analytics.php');
44 if (isset($_GET['flag_ip_address'])){
45 $ip = $_GET['flag_ip_address'];
46 $petition->query("update signatures set signature_status = 'flag_ip_address' where ip_address = '$ip' ");
47 header('Location: analytics.php');
49 if (isset($_GET['resign_requested'])){
50 $id = $_GET['resign_requested'];
51 $petition->query("update signatures set signature_status = 'resign_requested' where id = '$id' ");
52 header('Location: analytics.php');
54 if (isset($_GET['bot'])){
56 $petition->query("update signatures set signature_status = 'bot' where id = '$id' ");
57 header('Location: analytics.php');
59 if (isset($_GET['flag_VTRID'])){
60 $VTRID = $_GET['flag_VTRID'];
61 $petition->query("update signatures set signature_status = 'flag_VTRID' where VTRID = '$VTRID' ");
62 header('Location: analytics.php');
64 if (isset($_GET['flag_phone'])){
65 $flag_phone = $_GET['flag_phone'];
66 $petition->query("update signatures set signature_status = 'flag_phone' where contact_phone = '$flag_phone' ");
67 header('Location: analytics.php');
69 include_once('header.php');
70 if (isset($_GET['ip_address'])){
71 $ip = $_GET['ip_address'];
72 $petition_id = $_GET['petition_id'];
73 echo "<h1>Review $ip</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
74 $q = "SELECT * FROM signatures where ip_address = '$ip' and signature_status = 'verified' and petition_id = '$petition_id' order by signature_status desc ";
75 $r = $petition->query($q);
76 while($d = mysqli_fetch_array($r)){
78 $pos = strpos($d['date_time_signed'], date('Y-m-d'));
82 echo "<tr style='background-color:$color;'>
83 <td><b>$d[date_time_signed]</b></td>
84 <td><a href='?VTRID=$d[VTRID]'>$d[VTRID]</a></td>
85 <td>".id2petition($d['petition_id'])."</td>
86 <td>$d[signed_name_as]</td>
87 <td>$d[signed_name_as_circulator]</td>
88 <td>$d[contact_phone]</td>
89 <td>$d[printed_status]</td>
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>
95 <td><a href='?resign_requested=$d[id]'>resign requested</a></td>
96 <td><a href='?bot=$d[id]'>bot</a></td>
100 }elseif(isset($_GET['email'])){
101 $email = $_GET['email'];
102 echo "<h1>Review $email</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
103 $q = "SELECT * FROM presign where email_for_follow_up = '$email' order by id desc ";
104 $r = $petition->query($q);
105 while($d = mysqli_fetch_array($r)){
107 $test = date('Y-m-d',strtotime($d['action_on']));
108 $pos = strpos($test, date('Y-m-d'));
109 if ($pos !== false) {
112 echo "<tr style='background-color:$color;'>
113 <td style='white-space:pre;'><b>$d[action_on]</b></td>
114 <td style='white-space:pre;'><a href='?php_session_id=$d[php_session_id]'>$d[php_session_id]</a></td>
115 <td style='white-space:pre;'>$d[php_page]</td>
116 <td style='white-space:pre;'>".id2petition($d['petition'])."</td>
117 <td style='white-space:pre;'>$d[invite]</td>
118 <td style='white-space:pre;'>$d[invite_error]</td>
119 <td style='white-space:pre;'>$d[name]</td>
120 <td style='white-space:pre;'>$d[email_for_follow_up]</td>
121 <td style='white-space:pre;'>$d[phone_for_validation]</td>
122 <td style='white-space:pre;'>$d[presign_status]</td>
123 <td style='white-space:pre;'>$d[ip_address]</td>
124 <td style='white-space:pre;'>$d[browser_string]</td>
127 echo "</table><a href='?clear_email=$email'>CLEAR EMAIL</a> - <a href='?sign_email=$email'>SIGNATURE FOUND</a>";
128 }elseif(isset($_GET['php_session_id']) && empty($_GET['follow_up'])){
129 $php_session_id = $_GET['php_session_id'];
130 echo "<h1>Review $php_session_id</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
131 $q = "SELECT * FROM presign where php_session_id = '$php_session_id' order by id desc ";
132 $r = $petition->query($q);
133 while($d = mysqli_fetch_array($r)){
135 $test = date('Y-m-d',strtotime($d['action_on']));
136 $pos = strpos($test, date('Y-m-d'));
137 if ($pos !== false) {
140 echo "<tr style='background-color:$color;'>
141 <td style='white-space:pre;'><b>$d[action_on]</b></td>
142 <td style='white-space:pre;'>$d[php_page]</td>
143 <td style='white-space:pre;'>".id2petition($d['petition'])."</td>
144 <td style='white-space:pre;'>$d[invite]</td>
145 <td style='white-space:pre;'>$d[invite_error]</td>
146 <td style='white-space:pre;'>$d[name]</td>
147 <td style='white-space:pre;'><a href='?email=$d[email_for_follow_up]'>$d[email_for_follow_up]</a></td>
148 <td style='white-space:pre;'>$d[phone_for_validation]</td>
149 <td style='white-space:pre;'>$d[presign_status]</td>
150 <td style='white-space:pre;'>$d[ip_address]</td>
151 <td style='white-space:pre;'>$d[browser_string]</td>
154 echo "</table><a href='?clear_php_session_id=$php_session_id'>CLEAR SESSION</a> -
155 <a href='?sign_php_session_id=$php_session_id'>SIGNATURE FOUND</a><br>
156 - <a href='?php_session_id=$php_session_id&follow_up=X'>ADD TO FOLLOW UP LIST Maryland General</a><br>
157 - <a href='?php_session_id=$php_session_id&follow_up=1'>ADD TO FOLLOW UP LIST MGP</a><br>
158 - <a href='?php_session_id=$php_session_id&follow_up=2'>ADD TO FOLLOW UP LIST MLP</a><br>
159 - <a href='?php_session_id=$php_session_id&follow_up=3'>ADD TO FOLLOW UP LIST BTEC</a><br>
160 - <a href='?php_session_id=$php_session_id&follow_up=7'>ADD TO FOLLOW UP LIST PG</a><br>
161 - <a href='?php_session_id=$php_session_id&follow_up=8'>ADD TO FOLLOW UP LIST Ivey</a>
163 }elseif(isset($_GET['php_session_id']) && isset($_GET['follow_up'])){
164 $php_session_id = $_GET['php_session_id'];
165 echo "<h1>Adding Follow up for $php_session_id to $_GET[follow_up]</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
166 $q = "SELECT * FROM presign where php_session_id = '$php_session_id' order by id desc ";
167 $r = $petition->query($q);
168 while($d = mysqli_fetch_array($r)){
171 $test = date('Y-m-d',strtotime($d['action_on']));
172 $pos = strpos($test, date('Y-m-d'));
173 if ($pos !== false) {
179 if ($d[email_for_follow_up
] != ''){
180 $email = $d[email_for_follow_up
];
182 echo "<tr style='background-color:$color;'>
183 <td style='white-space:pre;'><b>$d[action_on]</b></td>
184 <td style='white-space:pre;'>$d[php_page]</td>
185 <td style='white-space:pre;'>".id2petition($d['petition'])."</td>
186 <td style='white-space:pre;'>$d[invite]</td>
187 <td style='white-space:pre;'>$d[invite_error]</td>
188 <td style='white-space:pre;'>$d[name]</td>
189 <td style='white-space:pre;'>$d[email_for_follow_up]</td>
190 <td style='white-space:pre;'>$d[phone_for_validation]</td>
191 <td style='white-space:pre;'>$d[presign_status]</td>
192 <td style='white-space:pre;'>$d[ip_address]</td>
193 <td style='white-space:pre;'>$d[browser_string]</td>
196 $petition->query("insert into follow_up (name, email, php_session, petition_id, date_sent) values ('$name','$email','$php_session_id','$_GET[follow_up]','".date('Y-m-d')."') ");
197 $petition->query("update presign set presign_status = 'DONE' where php_session_id = '$php_session_id' ");
198 $petition->query("update presign set presign_status = 'DONE' where email_for_follow_up = '$email' ");
200 }elseif (isset($_GET['VTRID'])){
201 $VTRID = $_GET['VTRID'];
202 $petition_id = $_GET['petition_id'];
203 echo "<h1>Review $VTRID</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
204 $q = "SELECT * FROM signatures where VTRID = '$VTRID' and signature_status = 'verified' and petition_id = '$petition_id' order by petition_id, id DESC ";
205 $r = $petition->query($q);
206 while($d = mysqli_fetch_array($r)){
208 $pos = strpos($d['date_time_signed'], date('Y-m-d'));
209 if ($pos !== false) {
212 echo "<tr style='background-color:$color;'>
213 <td><b>$d[date_time_signed]</b></td>
214 <td><a href='?ip_address=$d[ip_address]'>$d[ip_address]</a></td>
215 <td>".id2petition($d['petition_id'])."</td>
216 <td>$d[signed_name_as]</td>
217 <td>$d[signed_name_as_circulator]</td>
218 <td>$d[contact_phone]</td>
219 <td>$d[printed_status]</td>
220 <td><a href='?flag_invalid_signature=$d[id]'>flag invalid signature</a></td>
221 <td><a href='?flag_VTRID=$d[VTRID]'>flag VTRID</a></td>
222 <td><a href='?flag_ip_address=$d[ip_address]'>flag ip address</a></td>
223 <td><a href='?flag_duplicate=$d[id]'>flag duplicate</a></td>
224 <td><a href='?flag_phone=$d[contact_phone]'>contact phone</a></td>
225 <td><a href='?resign_requested=$d[id]'>resign requested</a></td>
226 <td><a href='?bot=$d[id]'>bot</a></td>
233 <h1
>Signature Analytics
</h1
>
234 <h2
>NEVER NEVER NEVER CALL
OR TEXT ANYONE
- ONLY EMAIL
!!!</h2
>
235 <h3
>SysOp Says
: Transparency
= Trust
</h3
>
239 <td valign
="top" colspan
='2'><?PHP
/*
241 <div>Watching for duplicates.</div><ol>
243 $q="SELECT ip_address, petition_id,VTRID, COUNT(*) as count FROM signatures where signature_status = 'verified' group by ip_address, petition_id, VTRID";
244 $r = $petition->query($q);
245 while($d = mysqli_fetch_array($r)){
246 if ($d['count'] > 1){
247 echo "<li><a href='?ip_address=$d[ip_address]&petition_id=$d[petition_id]'>$d[ip_address]</a> ".id2petition($d['petition_id'])." <b>$d[count]</b> $d[signed_name_as]</li>";
251 </td><td valign="top"> */ ?
>
253 <div
>Watching
for duplicates
.</div
><ol
>
255 $q="SELECT VTRID, petition_id, COUNT(*) as count FROM signatures where signature_status = 'verified' group by VTRID, petition_id";
256 $r = $petition->query($q);
257 while($d = mysqli_fetch_array($r)){
258 if ($d['count'] > 1){
259 echo "<li><a href='?VTRID=$d[VTRID]&petition_id=$d[petition_id]'>$d[VTRID]</a> ".id2petition($d['petition_id'])." <b>$d[count]</b> $d[signed_name_as]</li>";
267 <td valign
="top" colspan
='2'>
269 <div
>Follow up requested
- never signed
.</div
>
270 <form method
='GET'><input name
='email'><input type
='submit' value
='SEARCH E-MAIL'></form
><table
>
272 $q="SELECT distinct php_session_id FROM presign where presign_status = 'NEW' and email_for_follow_up <> '' order by id desc";
273 $r = $petition->query($q);
274 while($d = mysqli_fetch_array($r)){
275 $q2="SELECT * FROM presign where php_session_id = '$d[php_session_id]' order by id desc";
276 $r2 = $petition->query($q2);
277 $d2 = mysqli_fetch_array($r2);
278 echo "<tr><td><a href='?php_session_id=$d2[php_session_id]'>$d2[action_on]</a></td><td>$d2[name]</td><td><a href='?email=$d2[email_for_follow_up]'>$d2[email_for_follow_up]</a></td><td>".id2petition($d2['petition'])."</td><td>$d2[invite]</td></tr>";
284 <td valign
="top" colspan
='2'>
286 <div
>Last
10</div
><ol
>
288 $q="SELECT * FROM signatures where signature_status = 'verified' order by id desc limit 0, 10";
289 $r = $petition->query($q);
290 while($d = mysqli_fetch_array($r)){
291 echo "<li>$d[date_time_signed] ".id2petition($d['petition_id'])." $d[signed_name_as]</li>";
297 <tr
><td valign
="top">
299 <div
>Watching
for 0</div
><ol
>
301 $q="SELECT * FROM signatures where VTRID = '0' and signature_status <> 'bot' and signature_status <> 'flag_invalid_signature' and signature_status <> 'resign_requested'";
302 $r = $petition->query($q);
303 while($d = mysqli_fetch_array($r)){
304 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>";
307 </td
><td valign
="top">
308 <h2
>Petition ID Bugs
</h2
>
309 <div
>Watching
for 0</div
><ol
>
311 $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'";
312 $r = $petition->query($q);
313 while($d = mysqli_fetch_array($r)){
314 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>";
317 </td
></tr
><tr
><td valign
="top">
319 <h2
>resign_requested
</h2
>
320 <div
>These are most likely from early bugs
</div
><ol
>
322 $q="SELECT * FROM signatures where signature_status = 'resign_requested' order by ip_address";
323 $r = $petition->query($q);
325 while($d = mysqli_fetch_array($r)){
327 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>";
330 <?PHP
$html = ob_get_clean(); if ( $show == 1 ){ echo $html; } ?
>
336 <div
>These are bots on the site
.</div
><ol
>
338 $q="SELECT * FROM signatures where signature_status = 'bot' order by ip_address";
339 $r = $petition->query($q);
341 while($d = mysqli_fetch_array($r)){
343 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>";
346 <?PHP
$html = ob_get_clean(); if ( $show == 1 ){ echo $html; } ?
>
357 include_once('footer.php');