Update report.php
[clinton/MarylandElectronicPetitionSignature.git] / admin / print.php
CommitLineData
f2f95132
PM
1<?php
2include_once('/var/www/secure.php');
2451b52f 3include_once('../slack.php');
f2f95132
PM
4$id = intval($_GET['id']);
5$q = "select * from signatures where id = '$id' ";
6$r = $petition->query($q);
7$d = mysqli_fetch_array($r);
f2f95132
PM
8$DOB = $d['date_of_birth'];
9$SIGNED = $d['date_time_signed'];
10$PETITION_ID = $d['petition_id'];
11$signed_name_as = $d['signed_name_as'];
12$signed_name_as_circulator = $d['signed_name_as_circulator'];
2451b52f
PM
13//if ($_COOKIE['pVTRID'] != $d['VTRID']){
14// slack_general('SECURITY INVALID: soft_copy.php ('.$_COOKIE['invite'].')','md-petition');
15// die('Error #294');
16//}
17slack_general("$_COOKIE[name] printing petition $id",'md-petition');
f2f95132
PM
18$q2 = "select * from VoterList where VTRID = '$d[VTRID]' ";
19$r2 = $petition->query($q2);
20$d2 = mysqli_fetch_array($r2);
21 $FIRSTNAME = $d2['FIRSTNAME'];
22 $MIDDLENAME = $d2['MIDDLENAME'];
23 $LASTNAME = $d2['LASTNAME'];
24 $ADDRESS = $d2['ADDRESS'];
25 $RESIDENTIALCITY = $d2['RESIDENTIALCITY'];
26 $COUNTY = $d2['COUNTY'];
27 $RESIDENTIALZIP5 = $d2['RESIDENTIALZIP5'];
28 $full_name = "$FIRSTNAME $MIDDLENAME $LASTNAME";
29 $address = "$ADDRESS $RESIDENTIALCITY $RESIDENTIALZIP5";
30
31$contact_phone = $d2['contact_phone'];
32
33
34$qX = "select * from petitions where petition_id = '$PETITION_ID'";
35$rX = $petition->query($qX);
36$dX = mysqli_fetch_array($rX);
37
38$hide_county = $dX['hide_county_on_petition'];
39$offset_x = $dX['offset_x_cords'];
40$offset_y = $dX['offset_y_cords'];
41$offset_x_circulator = $dX['offset_x_cords_circulator'];
42$offset_y_circulator = $dX['offset_y_cords_circulator'];
43
44// imagettftext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text )
45// x how far from left
46// y how far from top
47
48
49//Set the Content Type
50header('Content-type: image/jpeg');
51
52// Create Image From Existing File -- going to have to make this a reqired size??? 2550x3300
53$jpg_image = imagecreatefromjpeg($dX['petition_jpg']);
54
55// Allocate A Color For The Text
56$black = imagecolorallocate($jpg_image, 0, 0, 0);
57
58// Set Path to Font File
59$font_path = 'files/coolvetica rg.ttf';
60$font_path_sig = 'files/Claston Script.ttf';
61
62if ($hide_county == 'NO'){
63 if ( $_COOKIE['pCOUNTY'] == 'Baltimore City'){
64 // City Checkbox
65 $cord = $dX['text_cord_cityX'];
66 $array = explode(",",$cord);
67 $debug = "$id : $cord : $array[0]";
68 imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, 'X');
69 }else{
70 // County on Petition
71 $cord = $dX['text_cord_county'];
72 $array = explode(",",$cord);
73 imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, str_replace('County','',$_COOKIE['pCOUNTY']) );
74 }
75}
76// name
77imagettftext($jpg_image, 50, 0, 350+$offset_x, 1070+$offset_y, $black, $font_path, $full_name);
78// signed
79imagettftext($jpg_image, 70, 0, 400+$offset_x, 1180+$offset_y, $black, $font_path_sig, $signed_name_as);
80// address
81imagettftext($jpg_image, 50, 0, 400+$offset_x, 1300+$offset_y, $black, $font_path, $address);
82
83// date of birth
84if($DOB != ''){
85 imagettftext($jpg_image, 50, 0, 1900+$offset_x, 1070+$offset_y, $black, $font_path, date('m d Y',strtotime($DOB)));
86}
87// date signed
88imagettftext($jpg_image, 50, 0, 1900+$offset_x, 1200+$offset_y, $black, $font_path, date('m d Y',strtotime($SIGNED)));
89
90
91// name
92imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2880+$offset_y_circulator, $black, $font_path, $_COOKIE['pNAME']);
93// address
94imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2975+$offset_y_circulator, $black, $font_path, $_COOKIE['pADDRESS1']);
95// city state zip
96imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3065+$offset_y_circulator, $black, $font_path, $_COOKIE['pADDRESS2']);
97// phone
98imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3160+$offset_y_circulator, $black, $font_path, $_COOKIE['pPHONE']);
99// signed
100imagettftext($jpg_image, 70, 0, 1290+$offset_x_circulator, 3160+$offset_y_circulator, $black, $font_path_sig, $signed_name_as_circulator);
101// date signed
102imagettftext($jpg_image, 50, 0, 2150+$offset_x_circulator, 3160+$offset_y_circulator, $black, $font_path, date('m / d / y',strtotime($SIGNED)));
103
104
105
106// Send Image to Browser
107imagejpeg($jpg_image);
108
109// Clear Memory
110imagedestroy($jpg_image);
111?>