GA4
[clinton/MarylandElectronicPetitionSignature.git] / eligible.php
1 <?PHP
2 ob_start();
3 include_once('header.php');
4 $head = ob_get_clean();
5 $VoterList_table = $_COOKIE['VoterList_table'];
6 $web_first_name = $_COOKIE['web_first_name'];
7 $web_last_name = $_COOKIE['web_last_name'];
8 $web_house_number = $_COOKIE['web_house_number'];
9 $web_zip_code = $_COOKIE['web_zip_code'];
10 if ($web_first_name != '' && $web_last_name != '' && $web_house_number != '' && $web_zip_code != ''){
11 include_once('header.php');
12 $web_first_name = $petition->real_escape_string($web_first_name);
13 $web_last_name = $petition->real_escape_string($web_last_name);
14 $web_house_number = $petition->real_escape_string($web_house_number);
15 $web_zip_code = $petition->real_escape_string($web_zip_code);
16 $DOB = $petition->real_escape_string($DOB);
17 $PHONE = $petition->real_escape_string($PHONE);
18 }else{
19 // we should NEVER hit this page anymore
20 header('Location: warning_incomplete.php');
21 }
22 $q = "select * from $VoterList_table where LASTNAME = '$web_last_name' and FIRSTNAME = '$web_first_name' and HOUSE_NUMBER = '$web_house_number' and RESIDENTIALZIP5 = '$web_zip_code'";
23 $r = $petition->query($q);
24 $d = mysqli_fetch_array($r);
25 if ($d['VTRID'] != ''){
26 $VTRID = $d['VTRID'];
27 $FIRSTNAME = $d['FIRSTNAME'];
28 $MIDDLENAME = $d['MIDDLENAME'];
29 $LASTNAME = $d['LASTNAME'];
30 $ADDRESS = $d['ADDRESS'];
31 $RESIDENTIALCITY = $d['RESIDENTIALCITY'];
32 $COUNTY = $d['COUNTY'];
33 $RESIDENTIALZIP5 = $d['RESIDENTIALZIP5'];
34 slack_general('MATCH: eligible ('.$FIRSTNAME.' '.$LASTNAME.' '.$RESIDENTIALCITY.') ('.$_COOKIE['invite'].')','md-petition');
35 }else{
36 slack_general('MISS: eligible ('.$web_first_name.' '.$web_last_name.' '.$PHONE.') ('.$_COOKIE['invite'].')','md-petition');
37 header('Location: warning_not_found.php');
38 }
39
40 if (isset($_GET['remove'])){
41 $id = $_GET['remove'];
42 $q = "update signatures set signature_status = 'removed' where id = '$id'";
43 $petition->query($q);
44 slack_general('SQL: eligible ('.$q.') ('.$_COOKIE['invite'].')','md-petition');
45 header('Location: eligible.php');
46 }
47
48 echo $head;
49
50
51 $available='';
52 $q2 = "SELECT * FROM petitions where admin_status = 'approved'";
53 $r2 = $petition->query($q2);
54 while($d2 = mysqli_fetch_array($r2)){
55 $checked = '';
56 $field = $d2['eligibleVoterListField'];
57 $pass = $d2['eligibleVoterListEquals'];
58
59 $my_test = $d[$field];
60
61 if($my_test == $pass){
62 // good to go
63 $checked = '';
64 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
65 $checked = 'checked';
66 }else{
67 $checked = '';
68 }
69 $available .= "<div class='row'>
70 <div class='col-sm-3' style='color: $d2[web_color_text]; background-color:$d2[web_color];'>&#8594;<input onclick='document.getElementById(\"form\").submit();' type='radio' id='petition' name='petition' value='$d2[petition_id]' $checked >&#8592;</div>
71 <div class='col-sm-6' style='color: $d2[web_color_text]; background-color:$d2[web_color];'><h3>$d2[petition_name] <br> $field == $pass</h3></div>
72 <div class='col-sm-1' style='color: $d2[web_color_text]; background-color:$d2[web_color];'><h3>$d2[eligibleVoterListEnforce]</h3></div>
73 </div>";
74
75 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
76 $available .= '<script>document.getElementById("form").submit();</script>';
77 }
78 }else{
79 // not a eligable voter
80 $checked = '';
81 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
82 $checked = 'checked';
83 }else{
84 $checked = '';
85 }
86 $available .= "<div class='row'>
87 <div class='col-sm-3' style='color: $d2[web_color_text]; background-color:$d2[web_color];'>"; if ($d2['eligibleVoterListEnforce'] == 'NO'){ $available .="&#8594;<input onclick='document.getElementById(\"form\").submit();' type='radio' id='petition' name='petition' value='$d2[petition_id]' $checked >&#8592;"; }else{ $available .= "<h3>Constituents Only</h3>"; } $available .= "</div>
88 <div class='col-sm-6' style='color: $d2[web_color_text]; background-color:$d2[web_color];'><h3>$d2[petition_name] <br> $field != $pass ($my_test)</h3></div>
89 <div class='col-sm-1' style='color: $d2[web_color_text]; background-color:$d2[web_color];'><h3>$d2[eligibleVoterListEnforce]</h3></div>
90 </div>";
91 if($d2['eligibleVoterListEnforce'] == 'NO' && $_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name']) ){
92 $available .= '<script>document.getElementById("form").submit();</script>';
93 }elseif($d2['eligibleVoterListEnforce'] == 'YES' && $_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name']) ){
94 setcookie("invite", ""); // clear invite
95 $error = "$field is not $pass it is $my_test";
96 setcookie("invite_error", $error); // record error
97 $available .= '<script>alert("'.$d2[eligibleVoterListWarning].'"); location.reload();</script>';
98 }
99 }
100 }
101 ?>
102 <script>document.title = "MEPS - Select Petition";</script>
103 <form method='POST' action='petition.php' id='form'>
104 <?PHP
105 $q = "select * from website_text where id = '7'";
106 $r = $petition->query($q);
107 $d = mysqli_fetch_array($r);
108 ?>
109 <style>
110 input[type=radio]{
111 transform:scale(2);
112 }
113 </style>
114
115 <div class='row'>
116 <div class='col-sm-10' style='height:100px; text-align:center;'><h1><?PHP echo $d['text_title'];?></h1><h3><?PHP echo $d['text_block'];?></h3></div>
117 </div>
118
119 <div class='row'>
120 <div class='col-sm-3'><h3>Pick One</h3></div>
121 <div class='col-sm-6'><h3>Petition Name <br> Eligible</h3></div>
122 <div class='col-sm-1'><h3>Locked</h3></div>
123 </div>
124
125 <?PHP echo $available;?>
126
127 <div class='row'>
128 <div class='col-sm-10'><button type="submit" class="btn btn-success btn-lg btn-block"><img class='click_me' src="files/click_here.gif">Next</button></div>
129 </div>
130 <div class='row'>
131 <div class='col-sm-10'><button type="button" class="btn btn-danger btn-lg btn-block" onclick="window.location.href='reset.php'">Reset / Restart</button></div>
132 </div>
133
134 </form>
135
136 <?PHP include_once('footer.php');