Update enter_information.php
[clinton/MarylandElectronicPetitionSignature.git] / is_the_information_correct.php
1 <?PHP
2 $web_first_name = $_COOKIE['web_first_name'];
3 $web_last_name = $_COOKIE['web_last_name'];
4 $web_house_number = $_COOKIE['web_house_number'];
5 $web_zip_code = $_COOKIE['web_zip_code'];
6 $DOB = $_COOKIE['pDOB'];
7 $PHONE = $_COOKIE['pPHONE'];
8 if ($web_first_name != '' && $web_last_name != '' && $web_house_number != '' && $web_zip_code != ''){
9 include_once('header.php');
10 $web_first_name = $petition->real_escape_string($web_first_name);
11 $web_last_name = $petition->real_escape_string($web_last_name);
12 $web_house_number = $petition->real_escape_string($web_house_number);
13 $web_zip_code = $petition->real_escape_string($web_zip_code);
14 $DOB = $petition->real_escape_string($DOB);
15 $PHONE = $petition->real_escape_string($PHONE);
16 }else{
17 header('Location: warning_incomplete.php');
18 }
19
20 // V2 API - Remote
21 include_once('api/maryland_voter.php');
22 $month = $_COOKIE['web_dob_month'];
23 $day = $_COOKIE['web_dob_year'];
24 $year = $_COOKIE['web_dob_day'];
25 $error = 'Based on what you entered, we were unable to find any information.';
26 $sbe_response = md_voter_lookup($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code,'','');
27 $pos = strpos($sbe_response, $error);
28 if ($pos !== false) {
29 slack_general_admin("Voter API v2 Fail: ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) $error",'md-petition-api');
30 //meps_mail('mdpetition@gmail.com',$sbe_response,'Voter API v2 Fail: '.$error);
31 }
32 $error2 = 'MISSING NAME';
33 $pos = strpos($sbe_response, $error2);
34 if ($pos !== false) {
35 slack_general_admin("Voter API v2 Fail: ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) $error2",'md-petition-api');
36 // meps_mail('mdpetition@gmail.com',$sbe_response,'Voter API v2 Fail: '.$error2);
37 }
38 $error3 = 'My Voter Registration Record';
39 $pos = strpos($sbe_response, $error3);
40 if ($pos !== false) {
41 slack_general_admin("Voter API v2 Success: ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) $error3",'md-petition-api');
42 // meps_mail('mdpetition@gmail.com',$sbe_response,'Voter API v2 Success: '.$error3);
43 }
44
45 // V1 API - Local
46 $q = "select * from VoterList where LASTNAME = '$web_last_name' and FIRSTNAME = '$web_first_name' and HOUSE_NUMBER = '$web_house_number' and RESIDENTIALZIP5 = '$web_zip_code'";
47 $r = $petition->query($q);
48 $d = mysqli_fetch_array($r);
49 if ($d['VTRID'] != ''){
50 $VTRID = $d['VTRID'];
51 $FIRSTNAME = $d['FIRSTNAME'];
52 $MIDDLENAME = $d['MIDDLENAME'];
53 if ($MIDDLENAME == ''){
54 slack_general_admin("WARN: Blank Middle Name Detected",'md-petition-signed');
55 }
56 $LASTNAME = $d['LASTNAME'];
57 $pos = strpos($LASTNAME, '-');
58 if ($pos !== false) {
59 slack_general_admin("WARN: Hyphen in Last Name Detected",'md-petition-signed');
60 }
61 $ADDRESS = $d['ADDRESS'];
62 $RESIDENTIALCITY = $d['RESIDENTIALCITY'];
63 $COUNTY = $d['COUNTY'];
64 $RESIDENTIALZIP5 = $d['RESIDENTIALZIP5'];
65 // set cookies for hard_copy.php
66 setcookie("pCOUNTY", $COUNTY);
67 if ($MIDDLENAME == ''){
68 setcookie("pNAME", "$FIRSTNAME $LASTNAME");
69 }else{
70 setcookie("pNAME", "$FIRSTNAME $MIDDLENAME $LASTNAME");
71 }
72 setcookie("pADDRESS", "$ADDRESS $RESIDENTIALCITY $RESIDENTIALZIP5");
73 setcookie("pADDRESS1", "$ADDRESS");
74 setcookie("pADDRESS2", "$RESIDENTIALCITY MD $RESIDENTIALZIP5");
75 setcookie("pVTRID", $VTRID);
76 setcookie("signature_status", 'verified');
77 slack_general("API v1: SUCCESS ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) ($_COOKIE['invite'])",'md-petition-api');
78 }else{
79 slack_general("API v1: FAIL ($web_first_name,$web_last_name,$month,$day,$year,$web_zip_code) ($_COOKIE['invite'])",'md-petition-api');
80 setcookie("signature_status", 'notfound');
81 header('Location: warning_not_found.php');
82 }
83 $qX = "select * from website_text where id = '6'";
84 $rX = $petition->query($qX);
85 $dX = mysqli_fetch_array($rX);
86 ?>
87 <script>document.title = "MEPS - Confirm information";</script>
88 <div class='row'>
89 <div class='col-sm-10' style='text-align:center;'><h1><?PHP echo $dX['text_title'];?></h1><h2><?PHP echo $dX['text_block'];?></h2></div>
90 </div>
91 <div class='row'>
92 <div class='col-sm-10'><button type="button" class="btn btn-success btn-lg btn-block" onclick="window.location.href='eligible.php'"><img alt='Click Here to Continue' class='click_me' src="files/click_here.gif">YES</button></div>
93 </div>
94 <div class='row'>
95 <div class='col-sm-5' style='text-align:right;'><h2>First Name</h2></div>
96 <div class='col-sm-5' style='text-align:left;'><h2><?PHP echo $FIRSTNAME;?></h2></div>
97 </div>
98 <div class='row'>
99 <div class='col-sm-5' style='text-align:right;'><h2>Middle Name</h2></div>
100 <div class='col-sm-5' style='text-align:left;'><h2><?PHP echo $MIDDLENAME;?><h2></div>
101 </div>
102 <div class='row'>
103 <div class='col-sm-5' style='text-align:right;'><h2>Last Name</h2></div>
104 <div class='col-sm-5' style='text-align:left;'><h2><?PHP echo $LASTNAME;?></h2></div>
105 </div>
106 <div class='row'>
107 <div class='col-sm-5' style='text-align:right;'><h2>Date of Birth</h2></div>
108 <div class='col-sm-5' style='text-align:left;'><h2><?PHP echo $DOB;?></h2></div>
109 </div>
110 <div class='row'>
111 <div class='col-sm-5' style='text-align:right;'><h2>Full Addresss</h2></div>
112 <div class='col-sm-5' style='text-align:left;'><h2><?PHP echo $ADDRESS;?></h2></div>
113 </div>
114 <div class='row'>
115 <div class='col-sm-5' style='text-align:right;'><h2>Phone</h2></div>
116 <div class='col-sm-5' style='text-align:left;'><h2><?PHP echo $PHONE;?></h2></div>
117 </div>
118 <div class='row'>
119 <div class='col-sm-5' style='text-align:right;'><h2>City</h2></div>
120 <div class='col-sm-5' style='text-align:left;'><h2><?PHP echo $RESIDENTIALCITY;?></h2></div>
121 </div>
122 <div class='row'>
123 <div class='col-sm-5' style='text-align:right;'><h2>County</h2></div>
124 <div class='col-sm-5' style='text-align:left;'><h2><?PHP echo $COUNTY;?></h2></div>
125 </div>
126 <div class='row'>
127 <div class='col-sm-5' style='text-align:right;'><h2>Zip</h2></div>
128 <div class='col-sm-5' style='text-align:left;'><h2><?PHP echo $RESIDENTIALZIP5;?></h2></div>
129 </div>
130 <div class='row'>
131 <div class='col-sm-10'><button type="button" class="btn btn-success btn-lg btn-block" onclick="window.location.href='eligible.php'"><img alt='Click Here to Continue' class='click_me' src="files/click_here.gif">YES</button></div>
132 </div>
133 <div class='row'>
134 <div class='col-sm-10'><button type="button" class="btn btn-danger btn-lg btn-block not_me" onclick="window.location.href='reset.php'">NO</button></div>
135 </div>
136
137 <?PHP include_once('footer.php');