Update eligible.php
[clinton/MarylandElectronicPetitionSignature.git] / eligible.php
CommitLineData
d484e8ee
PM
1<?PHP
2ob_start();
3include_once('header.php');
4$head = ob_get_clean();
d484e8ee
PM
5$web_first_name = $_COOKIE['web_first_name'];
6$web_last_name = $_COOKIE['web_last_name'];
7$web_house_number = $_COOKIE['web_house_number'];
8$web_zip_code = $_COOKIE['web_zip_code'];
9if ($web_first_name != '' && $web_last_name != '' && $web_house_number != '' && $web_zip_code != ''){
cd980bca
PM
10 include_once('header.php');
11 $web_first_name = $petition->real_escape_string($web_first_name);
12 $web_last_name = $petition->real_escape_string($web_last_name);
13 $web_house_number = $petition->real_escape_string($web_house_number);
14 $web_zip_code = $petition->real_escape_string($web_zip_code);
15 $DOB = $petition->real_escape_string($DOB);
16 $PHONE = $petition->real_escape_string($PHONE);
d484e8ee 17}else{
cd980bca 18 // we should NEVER hit this page anymore
d484e8ee
PM
19 header('Location: warning_incomplete.php');
20}
21$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'";
22$r = $petition->query($q);
23$d = mysqli_fetch_array($r);
24if ($d['VTRID'] != ''){
25 $VTRID = $d['VTRID'];
26 $FIRSTNAME = $d['FIRSTNAME'];
27 $MIDDLENAME = $d['MIDDLENAME'];
28 $LASTNAME = $d['LASTNAME'];
29 $ADDRESS = $d['ADDRESS'];
30 $RESIDENTIALCITY = $d['RESIDENTIALCITY'];
31 $COUNTY = $d['COUNTY'];
32 $RESIDENTIALZIP5 = $d['RESIDENTIALZIP5'];
cd980bca 33 slack_general('MATCH: eligible ('.$FIRSTNAME.' '.$LASTNAME.' '.$RESIDENTIALCITY.') ('.$_COOKIE['invite'].')','md-petition');
d484e8ee 34}else{
cd980bca
PM
35 slack_general('MISS: eligible ('.$web_first_name.' '.$web_last_name.' '.$PHONE.') ('.$_COOKIE['invite'].')','md-petition');
36 header('Location: warning_not_found.php');
d484e8ee 37}
1b4ae9ba
PM
38
39if (isset($_GET['remove'])){
40 $id = $_GET['remove'];
41 $q = "update signatures set signature_status = 'removed' where id = '$id'";
42 $petition->query($q);
cd980bca 43 slack_general('SQL: eligible ('.$q.') ('.$_COOKIE['invite'].')','md-petition');
1b4ae9ba
PM
44 header('Location: eligible.php');
45}
46
9855180c
PM
47echo $head;
48
a71cf996 49
32cc64e6 50$available='';
35eb0502 51$q2 = "SELECT * FROM petitions";
d484e8ee
PM
52$r2 = $petition->query($q2);
53while($d2 = mysqli_fetch_array($r2)){
da47274f 54 $checked = '';
d484e8ee
PM
55 $field = $d2['eligibleVoterListField'];
56 $pass = $d2['eligibleVoterListEquals'];
99009157 57
cd980bca 58 /*
97ae499d 59if ($d4['id'] > 0){
ed5123d6 60 $available .= "<div class='row' style='background-color:lightyellow;'>
148009e1 61 <div class='col-sm-3'>Already Signed, <a target='_Blank' href='soft_copy.php?id=$d4[id]'>View</a> or <a href='?remove=$d4[id]'>Remove</a></div>
bd380a87 62 <div class='col-sm-6'>$d2[petition_name]</div>
d9e19f51 63 <div class='col-sm-3'>$field == $pass</div>
a71cf996 64 </div>";
cd980bca
PM
65 }else */
66
67 if($d[$field] == $pass){
68 $checked = '';
69 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
d77d4772
PM
70 $checked = 'checked';
71 }else{
72 $checked = '';
b4a09a83 73 }
8e75e3e1 74 $available .= "<div class='row'>
d1ac864b 75 <div class='col-sm-3' style='background-color:$d2[web_color];'><input type='radio' id='petition' name='petition' value='$d2[petition_id]' $checked > </div>
8e75e3e1 76 <div class='col-sm-6' style='background-color:$d2[web_color];'><h2>$d2[petition_name] <br> $field == $pass</h2></div>
d1ac864b 77 <div class='col-sm-1' style='background-color:$d2[web_color];'><h2>$d2[eligibleVoterListEnforce]</h2></div>
32cc64e6 78 </div>";
4fec112a 79
6b9739e8
PM
80 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
81 $available .= '<script>document.getElementById("form").submit();</script>';
82 }
330a7a16
PM
83 }else{
84 $checked = '';
85 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
86 $checked = 'checked';
87 }else{
88 $checked = '';
89 }
8e75e3e1 90 $available .= "<div class='row'>
d1ac864b 91 <div class='col-sm-3' style='background-color:$d2[web_color];'>"; if ($d2['eligibleVoterListEnforce'] == 'NO'){ $available .="<input type='radio' id='petition' name='petition' value='$d2[petition_id]' $checked >"; }else{ $available .= "<h2>Constituents Only</h2>"; } $available .= "</div>
8e75e3e1 92 <div class='col-sm-6' style='background-color:$d2[web_color];'><h2>$d2[petition_name] <br> $field != $pass</h2></div>
d1ac864b 93 <div class='col-sm-1' style='background-color:$d2[web_color];'><h2>$d2[eligibleVoterListEnforce]</h2></div>
e2c1b70c 94 </div>";
5b555233
PM
95 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
96 $available .= '<script>document.getElementById("form").submit();</script>';
97 }
d484e8ee 98 }
d484e8ee 99}
e2bffda9 100?>
9fb7e174 101<script>document.title = "MEPS - Select Petition";</script>
b4a09a83 102<form method='POST' action='petition.php' id='form'>
462019be
PM
103 <?PHP
104 $q = "select * from website_text where id = '7'";
105 $r = $petition->query($q);
106 $d = mysqli_fetch_array($r);
107 ?>
cea0081f
PM
108 <style>
109 input[type=radio]{
110 transform:scale(2);
111 }
112 </style>
309a4e6f 113
e2c1b70c 114 <div class='row'>
309a4e6f 115 <div class='col-sm-10' style='height:100px; text-align:center;'><h1><?PHP echo $d['text_title'];?></h1><h2><?PHP echo $d['text_block'];?></h2></div>
e2c1b70c 116 </div>
32cc64e6 117
aacea61e 118 <div class='row'>
d1ac864b 119 <div class='col-sm-3'><h3>Pick One</h3></div>
cea0081f 120 <div class='col-sm-6'><h3>Petition Name <br> Eligible</h3></div>
d1ac864b 121 <div class='col-sm-1'><h3>Locked</h3></div>
aacea61e
PM
122 </div>
123
e2c1b70c 124 <?PHP echo $available;?>
32cc64e6 125
4b7a5d37 126 <div class='row'>
01f4ba3b 127 <div class='col-sm-5'><button type="submit" class="btn btn-success btn-lg btn-block">Next</button></div>
34b2a3c4 128 <div class='col-sm-5'><button type="button" class="btn btn-danger btn-lg btn-block" onclick="window.location.href='reset.php'">Reset / Restart</button></div>
1029664c 129 </div>
ed31e82f 130
97ae499d 131
2b1ae240 132</form>
91d0a62a
PM
133
134<?PHP include_once('footer.php');