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