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