Update eligible.php
[clinton/MarylandElectronicPetitionSignature.git] / eligible.php
1 <?PHP
2 ob_start();
3 include_once('header.php');
4 $head = ob_get_clean();
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'];
9 if ($web_first_name != '' && $web_last_name != '' && $web_house_number != '' && $web_zip_code != ''){
10 // ok to check for records
11 }else{
12 header('Location: warning_incomplete.php');
13 }
14 $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'";
15 $r = $petition->query($q);
16 $d = mysqli_fetch_array($r);
17 if ($d['VTRID'] != ''){
18 $VTRID = $d['VTRID'];
19 $FIRSTNAME = $d['FIRSTNAME'];
20 $MIDDLENAME = $d['MIDDLENAME'];
21 $LASTNAME = $d['LASTNAME'];
22 $ADDRESS = $d['ADDRESS'];
23 $RESIDENTIALCITY = $d['RESIDENTIALCITY'];
24 $COUNTY = $d['COUNTY'];
25 $RESIDENTIALZIP5 = $d['RESIDENTIALZIP5'];
26 }else{
27 header('Location: warning_not_found.php');
28 }
29
30 if (isset($_GET['remove'])){
31 $id = $_GET['remove'];
32 $q = "update signatures set signature_status = 'removed' where id = '$id'";
33 $petition->query($q);
34 header('Location: eligible.php');
35 }
36
37 echo $head;
38
39
40 $available='';
41 $q2 = "SELECT * FROM petitions";
42 $r2 = $petition->query($q2);
43 while($d2 = mysqli_fetch_array($r2)){
44 $checked = '';
45 $field = $d2['eligibleVoterListField'];
46 $pass = $d2['eligibleVoterListEquals'];
47 $q4 = "select * from signatures where VTRID = '$VTRID' and petition_id = '$d2[petition_id]' and signature_status <> 'removed' ";
48 $r4 = $petition->query($q4);
49 $d4 = mysqli_fetch_array($r4);
50 if ($d4['id'] > 0){
51 $available .= "<div class='row' style='background-color:lightyellow;'>
52 <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>
53 <div class='col-sm-6'>$d2[petition_name]</div>
54 <div class='col-sm-3'>$field == $pass</div>
55 </div>";
56 }elseif($d[$field] == $pass){
57 $checked = '';
58 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
59 $checked = 'checked';
60 }else{
61 $checked = '';
62 }
63 $available .= "<div class='row' style='background-color:lightgreen;'>
64 <div class='col-sm-3'><input type='radio' id='petition' name='petition' value='$d2[petition_id]' $checked > </div>
65 <div class='col-sm-6'>$d2[petition_name]</div>
66 <div class='col-sm-3'>$field == $pass</div>
67 </div>";
68
69 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
70 $available .= '<script>document.getElementById("form").submit();</script>';
71 }
72 }else{
73 $checked = '';
74 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
75 $checked = 'checked';
76 }else{
77 $checked = '';
78 }
79 $available .= "<div class='row' style='background-color:#ffcccb;'>
80 <div class='col-sm-3'><?PHP if ($d2['eligibleVoterListEnforce'] == 'NO'){ ?><input type='radio' id='petition' name='petition' value='$d2[petition_id]' $checked > <?PHP } ?></div>
81 <div class='col-sm-6'>$d2[petition_name]</div>
82 <div class='col-sm-3'>$field != $pass</div>
83 </div>";
84 if($_COOKIE['invite'] != '' && strtoupper($_COOKIE['invite']) == strtoupper($d2['web_short_name'])){
85 $available .= '<script>document.getElementById("form").submit();</script>';
86 }
87 }
88 }
89 ?>
90 <script>document.title = "MEPS - Select Petition";</script>
91 <form method='POST' action='petition.php' id='form'>
92
93 <div class='row'>
94 <div class='col-sm-12' style='height:100px; text-align:center;'><h2>Active Petitions and Eligiblity Requirements to Sign.</h2></div>
95 </div>
96
97 <div class='row'>
98 <div class='col-sm-2'><h3>Pick One</h3></div>
99 <div class='col-sm-6'><h3>Petition Name</h3></div>
100 <div class='col-sm-4'><h3>Requirements</h3></div>
101 </div>
102
103 <?PHP echo $available;?>
104
105 <div class='row'>
106 <div class='col-sm-12' style='height:100px; text-align:center;'><button type="submit" class="btn btn-success">Next</button><div>
107 </div>
108
109
110 <?PHP /* if ($VTRID != ''){ ?>
111 <div class='row'>
112 <div class='col-sm-12' style='height:100px; text-align:center;'><h2>Petition History</h2></div>
113 </div>
114
115
116 <div class='row'>
117 <div class='col-sm-2'><h3>Date</h3></div>
118 <div class='col-sm-6'><h3>Petition Name</h3></div>
119 <div class='col-sm-4'><h3>Status</h3></div>
120 </div>
121
122 <?PHP
123 $q4 = "select * from signatures where VTRID = '$VTRID' and signature_status <> 'removed'";
124 $r4 = $petition->query($q4);
125 while($d4 = mysqli_fetch_array($r4)){
126 ?>
127 <div class='row'>
128 <div class='col-sm-2'><?PHP echo $d4['date_time_signed'];?></div>
129 <div class='col-sm-6'><a target='_Blank' href='soft_copy.php?id=<?PHP echo $d4['id'];?>'>Signed - View</a> or <a href='?remove=<?PHP echo $d4['id'];?>'>Remove</a> <?PHP echo $d4['petition_id'];?></div>
130 <div class='col-sm-4'><?PHP echo $d4['signature_status'];?></div>
131 </div>
132 <?PHP } ?>
133
134 <?PHP } */
135 ?>
136
137 </form>
138
139 <?PHP include_once('footer.php');