Update petition.php
[clinton/MarylandElectronicPetitionSignature.git] / petition.php
CommitLineData
de92e95d
PM
1<?PHP
2include_once('header.php');
3if (isset($_POST['petition'])){
4 $id = $_POST['petition'];
70e2de61 5 setcookie("pID", $id);
de92e95d
PM
6 $q = "select * from petitions where petition_id = '$id'";
7 $r = $petition->query($q);
8 $d = mysqli_fetch_array($r);
4e6cf473 9 slack_general('OK POST: petition.php ('.$_COOKIE['invite'].')','md-petition');
beb29022
PM
10}elseif($_COOKIE['pID'] != ''){
11 $id = $_COOKIE['pID'];
12 $q = "select * from petitions where petition_id = '$id'";
13 $r = $petition->query($q);
14 $d = mysqli_fetch_array($r);
4e6cf473 15 slack_general('OK COOKIE: petition.php ('.$_COOKIE['invite'].')','md-petition');
beb29022 16}else{
63a18eab
PM
17 slack_general('MAJOR ERROR: petition.php ('.$_COOKIE['invite'].')','md-petition');
18 header('Location: reset.php');
19 die('Error #15');
de92e95d 20}
58e477ae 21setcookie("pJPG", $d['petition_jpg']);
de92e95d 22?>
98ce83b3
PM
23<script>
24 document.title = "MEPS - Sign <?PHP echo $d['petition_name'];?>";
25$('form input:not([type="submit"])').keydown(function(e) {
26 if (e.keyCode == 13) {
27 e.preventDefault();
28 return false;
29 }
30});
31
32
33
34</script>
9545d56d
PM
35<style>
36@font-face {
37 font-family: "myFirstFont";
32286a4c 38 src: url("files/Claston Script.ttf");
9545d56d
PM
39}
40.sig {
41 font-family: "myFirstFont";
e483b372 42 font-size: 60px;
9545d56d
PM
43}
44</style>
beb29022
PM
45<?PHP
46if (isset($_POST['signed_name_as'])){
47?>
48<script>
bff61df6 49 window.scrollTo(0,document.body.scrollHeight);
b3bdd4cc
PM
50 $(document).ready(function(){
51 window.scrollTo(0,document.body.scrollHeight);
52 $('#exampleModalLower').modal('show');
beb29022 53 });
532fd909 54 function addTextb()
beb29022 55 {
532fd909 56 document.getElementById('text2b').innerHTML = document.getElementById('myTextb').value;
a83d8a01 57 var string = document.getElementById('myTextb').value;
3c9412ec
PM
58 var res = string.toUpperCase();
59 var result = res.match(/<?PHP echo $_COOKIE['pNAME'];?>/i);
a83d8a01 60 if (result == "<?PHP echo $_COOKIE['pNAME'];?>"){
82d16fd5 61 document.getElementById("b2").style.display = "block";
1b3af1ab 62 document.getElementById("b2warn").style.display = "none";
82d16fd5 63 //alert("Confirmed : " + result);
35fe03d7
PM
64 }else{
65 document.getElementById("b2").style.display = "none";
42117833 66 document.getElementById("b2warn").style.display = "block";
a83d8a01 67 }
beb29022
PM
68 }
69</script>
70<?PHP
71}else{
72?>
56b829ee 73<script>
3ffbb5c9
PM
74 $(document).ready(function(){
75 $('#exampleModalCenter').modal('show');
76 });
398ca4df
PM
77 function addText()
78 {
79 document.getElementById('text2').innerHTML = document.getElementById('myText').value;
a83d8a01 80 var string = document.getElementById('myText').value;
3c9412ec
PM
81 var res = string.toUpperCase();
82 var result = res.match(/<?PHP echo $_COOKIE['pNAME'];?>/i);
a83d8a01 83 if (result == "<?PHP echo $_COOKIE['pNAME'];?>"){
82d16fd5 84 document.getElementById("b1").style.display = "block";
1b3af1ab 85 document.getElementById("b1warn").style.display = "none";
82d16fd5 86 //alert("Confirmed : " + result);
35fe03d7
PM
87 }else{
88 document.getElementById("b1").style.display = "none";
1b3af1ab 89 document.getElementById("b1warn").style.display = "block";
a83d8a01 90 }
398ca4df 91 }
56b829ee 92</script>
beb29022
PM
93<?PHP
94}
95?>
162b6ce2 96
beb29022 97<!-- TOP Modal -->
56b829ee 98<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
7f3ed8d1 99 <div class="modal-dialog" role="document">
56b829ee
PM
100 <div class="modal-content">
101 <div class="modal-header">
9632553d 102 <h1 class="modal-title" id="exampleModalLongTitle">Type Your Signature to Sign <?PHP echo $d['petition_name'];?></h1>
beb29022
PM
103 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
104 <span aria-hidden="true">&times;</span>
105 </button>
106 </div>
107 <form action='petition.php' method='POST'>
108 <div class="modal-body">
9632553d 109 <h2><?PHP echo $d['petition_sign_text_box'];?></h2>
a759c471 110 <h3><?PHP echo $_COOKIE['pNAME'];?>, Please Sign Here</h3>
e9c7f2f2 111
beb29022
PM
112 </div>
113 <div class="modal-footer">
e9c7f2f2 114 <h1 id="text2" class="sig"></h1>
c33cb72d 115 <button style='display:none;' id='b1' name='b1' type="submit" class="btn btn-primary btn-lg btn-block">Sign and Next</button>
6183a905 116 <button style='display:block;' id='b1warn' name='b1warn' class="btn btn-warning btn-lg btn-block disabled" onclick="alert('Please Type Your Name Exactly as Above');">Please Type Your Name Exactly as Above</button>
c33cb72d 117 <input class="form-control input-lg" name="signed_name_as" type="text" id="myText" onkeyup="addText()" required autofocus>
beb29022
PM
118 </div>
119 </form>
120 </div>
121 </div>
122</div>
123
f56ddbd7 124<!-- Lower Modal -->
beb29022 125<div class="modal fade" id="exampleModalLower" tabindex="-1" role="dialog" aria-labelledby="exampleModalLowerTitle" aria-hidden="true">
7f3ed8d1 126 <div class="modal-dialog modal-dialog-centered" role="document">
beb29022
PM
127 <div class="modal-content">
128 <div class="modal-header">
9632553d 129 <h1 class="modal-title" id="exampleModalLongTitleLower">Type Your Signature to Sign as Circulator</h1>
56b829ee
PM
130 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
131 <span aria-hidden="true">&times;</span>
132 </button>
133 </div>
602c0bb1 134 <form action='sign.php' method='POST'><input type='hidden' value='<?PHP echo $_POST['signed_name_as'];?>' name='signed_name_as'>
dab6c4a9 135 <div class="modal-body">
9632553d 136 <h2><?PHP echo $d['petition_circulator_text_box'];?></h2>
a759c471 137 <h3><?PHP echo $_COOKIE['pNAME'];?>, Please Sign Here</h3>
dab6c4a9
PM
138 </div>
139 <div class="modal-footer">
cbae90ff 140 <h1 id="text2b" class="sig"></h1>
c33cb72d 141 <button style='display:none;' id='b2' name='b2' type="submit" class="btn btn-primary btn-lg btn-block">Sign and Submit</button>
6183a905 142 <button style='display:block;' id='b2warn' name='b1warn' class="btn btn-warning btn-lg btn-block disabled" onclick="alert('Please Type Your Name Exactly as Above');">Please Type Your Name Exactly as Above</button>
c33cb72d 143 <input class="form-control input-lg" name="signed_name_as_circulator" type="text" id="myTextb" onkeyup="addTextb()" required autofocus>
dab6c4a9
PM
144 </div>
145 </form>
56b829ee
PM
146 </div>
147 </div>
148</div>
beb29022 149
5f7975e1 150<div class='col-sm-12'><img class="img-responsive" src='hard_copy.php'></div>
162b6ce2 151
162b6ce2 152
63a18eab
PM
153<?PHP
154if(isset($_POST['signed_name_as'])){
4140020b
PM
155 slack_general('petition.php ('.$d['petition_name'].') ('.$_POST['signed_name_as'].') ('.$_COOKIE['invite'].')','md-petition');
156}else{
157 slack_general('petition.php ('.$d['petition_name'].') ('.$_COOKIE['invite'].')','md-petition');
63a18eab
PM
158}
159include_once('footer.php');