Update sign.php
[clinton/MarylandElectronicPetitionSignature.git] / soft_copy.php
CommitLineData
abf66c7d
PM
1<?php
2include_once('/var/www/secure.php');
3
a31f6083 4$id = $_GET['id'];
582bfef8 5$q = "select * from signatures where id = '$id' ";
abf66c7d
PM
6$r = $petition->query($q);
7$d = mysqli_fetch_array($r);
8
9$DOB = $d['date_of_birth'];
10$SIGNED = $d['date_time_signed'];
a31f6083 11$PETITION_ID = $d['petition_id'];
abf66c7d 12
fdf73aa0
PM
13if ($_COOKIE['pVTRID'] != $d['VTRID']){
14 die('Error #294');
15}
2b687fba 16
abf66c7d
PM
17$q2 = "select * from VoterList where VTRID = '$d[VTRID]' ";
18$r2 = $petition->query($q2);
19$d2 = mysqli_fetch_array($r2);
0d39482c
PM
20 $FIRSTNAME = $d2['FIRSTNAME'];
21 $MIDDLENAME = $d2['MIDDLENAME'];
22 $LASTNAME = $d2['LASTNAME'];
319f0db1 23 $ADDRESS = $d2['ADDRESS'];
abf66c7d
PM
24 $RESIDENTIALCITY = $d2['RESIDENTIALCITY'];
25 $COUNTY = $d2['COUNTY'];
26 $RESIDENTIALZIP5 = $d2['RESIDENTIALZIP5'];
0d39482c 27 $full_name = "$FIRSTNAME $MIDDLENAME $LASTNAME";
319f0db1 28 $address = "$ADDRESS $RESIDENTIALCITY $RESIDENTIALZIP5";
0d39482c 29
abf66c7d 30
2b687fba 31
abf66c7d
PM
32// imagettftext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text )
33// x how far from left
34// y how far from top
35
36
37//Set the Content Type
38header('Content-type: image/jpeg');
39
40// Create Image From Existing File -- going to have to make this a reqired size??? 2550x3300
41$jpg_image = imagecreatefromjpeg('files/Green-Party-petition-1-page-001.jpg');
42
43// Allocate A Color For The Text
44$black = imagecolorallocate($jpg_image, 0, 0, 0);
45
46// Set Path to Font File
47$font_path = 'files/coolvetica rg.ttf';
48$font_path_sig = 'files/Claston Script.ttf';
49
50if ( $COUNTY == 'Baltimore City'){
51 // City Checkbox
52 imagettftext($jpg_image, 50, 0, 115, 365, $black, $font_path, 'X');
53}else{
54 // County on Petition
55 imagettftext($jpg_image, 50, 0, 220, 260, $black, $font_path, str_replace('County','',$COUNTY) );
56}
57
58// name
59imagettftext($jpg_image, 50, 0, 350, 1070, $black, $font_path, $full_name);
60// signed
61imagettftext($jpg_image, 60, 0, 400, 1180, $black, $font_path_sig, $full_name);
62// address
63imagettftext($jpg_image, 50, 0, 400, 1300, $black, $font_path, $address);
64// date of birth
65imagettftext($jpg_image, 50, 0, 1900, 1070, $black, $font_path, date('m d Y',strtotime($DOB)));
66// date signed
67imagettftext($jpg_image, 50, 0, 1900, 1200, $black, $font_path, date('m d Y',strtotime($SIGNED)));
68
69// Send Image to Browser
70imagejpeg($jpg_image);
71
72// Clear Memory
73imagedestroy($jpg_image);
74?>