<?PHP
+global $order;
+$order = 'ASC';
+if (isset($_COOKIE['order'])){
+ $order = $_COOKIE['order'];
+}
-
-
-include_once('bots.php');
-include_once('../slack.php');
-include_once('security.php');
-include_once('/var/www/secure.php'); //outside webserver
-include_once('functions.php');
-
+if (empty($_GET['run'])){
+ if ($_COOKIE['name'] == ''){
+ die('no name');
+ }
+ include_once('bots.php');
+ include_once('../slack.php');
+ include_once('security.php');
+ include_once('/var/www/secure.php'); //outside webserver
+ include_once('functions.php');
+}else{
+ include_once('../slack.php');
+ include_once('/var/www/secure.php'); //outside webserver
+ include_once('functions.php');
+}
ob_start();
$sign_email = $_COOKIE['sign_email'];
function js_redirect($page){ // now header - prep for full auto
$base = 'https://www.md-petition.com/admin/';
- $url = $base.$page;
+ $url = $base.$page.'&run=1';
$pos = strpos($page, $_COOKIE['sign_email']);
+ global $order;
if ($pos === false) {
// email not found - good to redirect
//echo "<script>window.location.href = \"$url\";</script>";
slack_general('js_redirect('.$page.')','automation');
header('Location: '.$url);
//slack_general('CHECK COOKIE ('.$_COOKIE['sign_email'].') PAGE ('.$page.')','md-petition-admin');
+ $order = 'ASC';
+ setcookie("order", $order);
die();
} else {
slack_general('Loop Detected for '.$_COOKIE['sign_email'],'automation');
- echo "<h1>Automated Loop Detected - Skip</h1>";
+ echo "<h1>Automated Loop Detected - Skip Setting - Reverse Sort (DESC)</h1>";
+ $order = 'DESC';
+ setcookie("order", $order);
}
}
}elseif(isset($_GET['php_session_id']) && empty($_GET['follow_up'])){
$php_session_id = $_GET['php_session_id'];
echo "<h1>Review $php_session_id</h1><table width='100%' border='1' cellpadding='5' cellspacing='5'>";
- $q = "SELECT * FROM presign where php_session_id = '$php_session_id' order by id desc ";
+ $q = "SELECT * FROM presign where php_session_id = '$php_session_id' and email_for_follow_up <> '$_COOKIE[sign_email]' order by id DESC ";
$r = $petition->query($q);
while($d = mysqli_fetch_array($r)){
$color = 'white';
<div>Follow up requested - never signed.</div>
<form method='GET'><input name='email'><input type='submit' value='SEARCH E-MAIL'></form><table>
<?PHP
-$q="SELECT distinct php_session_id FROM presign where presign_status = 'NEW' and email_for_follow_up <> '' order by id";
+
+
+
+$q="SELECT distinct php_session_id FROM presign where presign_status = 'NEW' and email_for_follow_up <> '' order by id $order";
$r = $petition->query($q);
while($d = mysqli_fetch_array($r)){
$q2="SELECT * FROM presign where php_session_id = '$d[php_session_id]' order by id desc";
if( $presig == '' && $invite_error == '' && $sig == '' ){
if ($d2['invite'] == 'Ivey'){
js_redirect("analytics.php?php_session_id=$php_session_id&follow_up=8");
+ die();
}
if ($d2['invite'] == 'mlp'){
js_redirect("analytics.php?php_session_id=$php_session_id&follow_up=2");
+ die();
}
if ($d2['invite'] == 'BTEC'){
js_redirect("analytics.php?php_session_id=$php_session_id&follow_up=3");
+ die();
}
if ($d2['invite'] == 'RestorePGTermLimits'){
js_redirect("analytics.php?php_session_id=$php_session_id&follow_up=7");
+ die();
}
if (id2petition($d2['petition']) == 'RESTORE TWO TERM (8 YEAR) TERM LIMITS IN PRINCE GEORGE'){
js_redirect("analytics.php?php_session_id=$php_session_id&follow_up=7");
+ die();
}
if ($d2['invite'] == 'mgp'){
js_redirect("analytics.php?php_session_id=$php_session_id&follow_up=1");
+ die();
}
+ js_redirect("analytics.php?php_session_id=$php_session_id&follow_up=X"); // no invite found no petition found - send general follow/up
}
}
?></table>