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