real_escape_string($_POST['name']);
$email = $petition->real_escape_string($_POST['email']);
$sec_level = $petition->real_escape_string($_POST['sec_level']);
$group_id = $petition->real_escape_string($_POST['group_id']);
$petition_id = $petition->real_escape_string($_POST['petition_id']);
$q = "insert into users (name, email, sec_level, group_id, petition_id) values ('$name','$email','$sec_level','$group_id','$petition_id') ";
$petition->query($q);
slack_general_admin('SQL: '.$q,'md-petition-signed');
include_once('../email.php');
$pass = rand(1000,9999);
$salt = md5(rand(1000,9999));
$hash = md5($pass.$salt);
$encrypted = $hash.':'.$salt;
$subject = 'MD Petition Login';
$body = 'Login with '.$email.' and your new password '.$pass.' at https://www.md-petition.com/admin/login.php';
meps_mail($email,$body,$subject);
$petition->query("update users set pass = '$encrypted' WHERE email = '$email'");
echo "
Password has been Sent.
";
slack_general_admin('DEBUG: '.$body,'md-petition-signed');
}
if(isset($_GET['approve'])){
$id = $_GET['approve'];
$petition->query("update petitions set admin_status = 'approved' where petition_id = '$id' ");
}
slack_general('ADMIN: Home Page Loaded ('.$_COOKIE['name'].') ('.$_COOKIE['level'].')','md-petition');
?>
Admin Home
Admin Sessions
Last 50
'Patrick McGuire' ORDER BY id DESC LIMIT 50";
$r = $petition->query($q);
while($d = mysqli_fetch_array($r)){
echo "- $d[ip] $d[username] $d[php_page]
";
}
?>
|
User Sessions
Last 50
query($q);
while($d = mysqli_fetch_array($r)){
echo "- $d[php_page] $d[browser_string]
";
}
?>
|
Users
query($q);
while($d = mysqli_fetch_array($r)){
$alert='';
if ($d[pass] == ''){
$alert='NEEDS PASSWORD RESET';
}
echo "ID $d[id] EM $d[email] NM $d[name] GI $d[group_id] PI $d[petition_id] SL $d[sec_level] $alert";
}
?>
New Petitions
query($q);
while($d = mysqli_fetch_array($r)){
echo "$d[petition_id] $d[web_short_name] $d[web_color] $d[group_id] $d[petition_name] $d[eligibleVoterListField] $d[eligibleVoterListEquals] $d[eligibleVoterListEnforce]";
}
?>
Approved Petitions
query($q);
while($d = mysqli_fetch_array($r)){
echo "$d[petition_id] $d[web_short_name] $d[web_color] $d[group_id] $d[petition_name] $d[eligibleVoterListField] $d[eligibleVoterListEquals] $d[eligibleVoterListEnforce]";
}
?>
Groups
query($q);
while($d = mysqli_fetch_array($r)){
echo "$d[id] $d[name]";
}
?>
Website
query($q);
while($d = mysqli_fetch_array($r)){
echo "$d[id] $d[text_title]";
}
?>
";
$chart='';
$chart2='';
$chart3='';
$q3 = "SELECT just_date FROM signatures where just_date <> '0000-00-00' group by just_date";
//echo "$q3";
$r3 = $petition->query($q3);
$total=0;
$total2=0;
$goal = $d['signature_goal'];
if ($goal == 0){
$goal = 10000;
}
$trader_sma_timePeriod=0;
while ($d3 = mysqli_fetch_array($r3)){
$just_date = $d3['just_date'];
$q2 = "SELECT * FROM signatures where just_date = '$just_date' and signature_status = 'verified' ";
//echo "$q2";
$r2 = $petition->query($q2);
$count = mysqli_num_rows($r2);
$chart .= '{ label: "'.$just_date.'", y: '.intval($count).' }, ';
$total = $total + intval($count);
$chart2 .= '{ label: "'.$just_date.'", y: '.intval($total).' }, ';
$goal = $goal - intval($count);
$chart3 .= '{ label: "'.$just_date.'", y: '.intval($goal).' }, ';
$q2 = "SELECT * FROM follow_up where date_sent = '$just_date' ";
$r2 = $petition->query($q2);
$count = mysqli_num_rows($r2);
$chart4 .= '{ label: "'.$just_date.'", y: '.intval($count).' }, ';
$total2 = $total2 + $count;
$chart5 .= '{ label: "'.$just_date.'", y: '.intval($total2).' }, ';
$q2 = "SELECT * FROM presign where only_date = '$just_date' ";
$r2 = $petition->query($q2);
$count = mysqli_num_rows($r2);
if($count > 0){ // start this graph when there is data
$chart6 .= '{ label: "'.$just_date.'", y: '.intval($count).' }, ';
// graph latest sma
$trader_sma_real[] = intval($count);
$trader_sma_timePeriod++;
$trader_sma = trader_sma($trader_sma_real,7);
//print_r($trader_sma);
$the_index = $trader_sma_timePeriod - 1;
$this_sma = $trader_sma[$the_index]; // should be last value?
$chart7 .= '{ label: "'.$just_date.'", y: '.intval($this_sma).' }, ';
}
}
$chart = rtrim(trim($chart), ",");
$chart2 = rtrim(trim($chart2), ",");
$chart3 = rtrim(trim($chart3), ",");
$chart4 = rtrim(trim($chart4), ",");
$chart5 = rtrim(trim($chart5), ",");
$chart6 = rtrim(trim($chart6), ",");
$chart7 = rtrim(trim($chart7), ",");
ob_start(); ?>
var chart = new CanvasJS.Chart("chartContainer", {
theme:"light2",
animationEnabled: true,
exportEnabled: true,
title:{
text: "MD-Petition.com Signature Tracker"
},
axisY :{
includeZero: false,
title: "Number of Signatures",
suffix: "",
scaleBreaks: {
autoCalculate: true
}
},
toolTip: {
shared: "true"
},
legend:{
cursor:"pointer",
itemclick : toggleDataSeries
},
data: [{
type: "line",
visible: true,
showInLegend: true,
yValueFormatString: "#####",
name: "Total Signatures Count",
dataPoints: [
]
},{
type: "line",
visible: true,
showInLegend: true,
yValueFormatString: "#####",
name: "Total Follow Up Count",
dataPoints: [
]
},{
type: "column",
visible: true,
showInLegend: true,
yValueFormatString: "#####",
name: "New Daily Signatures",
dataPoints: [
]
},{
type: "column",
visible: true,
showInLegend: true,
yValueFormatString: "#####",
name: "Follow Up Sent",
dataPoints: [
]
}]
}
);
chart.render();
var chart = new CanvasJS.Chart("chartContainer", {
theme:"light2",
animationEnabled: true,
exportEnabled: true,
title:{
text: "MD-Petition.com Web Monitor"
},
axisY :{
includeZero: false,
title: "Number of Pages Loaded",
suffix: "",
scaleBreaks: {
autoCalculate: true
}
},
toolTip: {
shared: "true"
},
legend:{
cursor:"pointer",
itemclick : toggleDataSeries
},
data: [{
type: "line",
visible: true,
showInLegend: true,
yValueFormatString: "#####",
name: "Web Activity",
dataPoints: [
]
},{
type: "line",
visible: true,
showInLegend: true,
yValueFormatString: "#####",
name: "7 Day Simple Moving Average",
dataPoints: [
]
}]
}
);
chart.render();