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