Update analytics.php
[clinton/MarylandElectronicPetitionSignature.git] / admin / print.php
index 0b1a522..ec79a1b 100644 (file)
@@ -1,25 +1,24 @@
 <?php
-foreach ($POST['print'] as $k => $v) {
-    echo "\$a[$k] => $v.\n";
-}
-die();
 include_once('/var/www/secure.php'); 
-include_once('slack.php'); 
+include_once('../slack.php'); 
 $id = intval($_GET['id']);
+$name=$_GET['name'];
+$now = date('r');
+if ($id == 0 || $name  == ''){
+ die("Error #".__LINE__);
+}
+$petition->query("update signatures set printed_status = '$name printed on $now' where id = '$id' ");
 $q = "select * from signatures where id = '$id' ";
 $r = $petition->query($q);
 $d = mysqli_fetch_array($r);
-
 $DOB    = $d['date_of_birth'];
 $SIGNED = $d['date_time_signed'];
 $PETITION_ID = $d['petition_id'];
 $signed_name_as = $d['signed_name_as'];
 $signed_name_as_circulator = $d['signed_name_as_circulator'];
-if ($_COOKIE['pVTRID'] != $d['VTRID']){
- slack_general('SECURITY INVALID: soft_copy.php ('.$_COOKIE['invite'].')','md-petition');
- die('Error #294');
-}
+$contact_phone = $d['contact_phone'];
 
+slack_general("$name printing petition $id",'md-petition');
 $q2 = "select * from VoterList where VTRID = '$d[VTRID]' ";
 $r2 = $petition->query($q2);
 $d2 = mysqli_fetch_array($r2);
@@ -33,7 +32,9 @@ $d2 = mysqli_fetch_array($r2);
  $full_name         = "$FIRSTNAME $MIDDLENAME $LASTNAME";
  $address           = "$ADDRESS $RESIDENTIALCITY $RESIDENTIALZIP5";
  
-$contact_phone            = $d2['contact_phone'];
+$address1 = $ADDRESS;
+$address2 = "$RESIDENTIALCITY, MD $RESIDENTIALZIP5";
+
 
 
 $qX = "select * from petitions where petition_id = '$PETITION_ID'";
@@ -55,17 +56,17 @@ $offset_y_circulator = $dX['offset_y_cords_circulator'];
 header('Content-type: image/jpeg');
 
 // Create Image From Existing File -- going to have to make this a reqired size??? 2550x3300
-$jpg_image = imagecreatefromjpeg($dX['petition_jpg']);
+$jpg_image = imagecreatefromjpeg("../".$dX['petition_jpg']);
 
 // Allocate A Color For The Text
 $black = imagecolorallocate($jpg_image, 0, 0, 0);
 
 // Set Path to Font File
-$font_path = 'files/coolvetica rg.ttf';
-$font_path_sig = 'files/Claston Script.ttf';
+$font_path = '../files/coolvetica rg.ttf';
+$font_path_sig = '../files/Claston Script.ttf';
 
 if ($hide_county == 'NO'){
- if ( $_COOKIE['pCOUNTY'] == 'Baltimore City'){
+ if ( $COUNTY == 'Baltimore City'){
    // City Checkbox
    $cord = $dX['text_cord_cityX'];
    $array = explode(",",$cord);
@@ -75,7 +76,7 @@ if ($hide_county == 'NO'){
    // County on Petition
    $cord = $dX['text_cord_county'];
    $array = explode(",",$cord);
-   imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, str_replace('County','',$_COOKIE['pCOUNTY']) );
+   imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, str_replace('County','',$COUNTY) );
  }
 }
 // name
@@ -94,13 +95,13 @@ imagettftext($jpg_image, 50, 0, 1900+$offset_x, 1200+$offset_y, $black, $font_pa
 
 
 // name
-imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2880+$offset_y_circulator, $black, $font_path, $_COOKIE['pNAME']);
+imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2880+$offset_y_circulator, $black, $font_path, $full_name);
 // address
-imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2975+$offset_y_circulator, $black, $font_path, $_COOKIE['pADDRESS1']);
+imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2975+$offset_y_circulator, $black, $font_path, $address1);
 // city state zip
-imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3065+$offset_y_circulator, $black, $font_path, $_COOKIE['pADDRESS2']);
+imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3065+$offset_y_circulator, $black, $font_path, $address2);
 // phone
-imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3160+$offset_y_circulator, $black, $font_path, $_COOKIE['pPHONE']);
+imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3160+$offset_y_circulator, $black, $font_path, $contact_phone);
 // signed
 imagettftext($jpg_image, 70, 0, 1290+$offset_x_circulator, 3160+$offset_y_circulator, $black, $font_path_sig, $signed_name_as_circulator);
 // date signed