allow links in slack
[clinton/MarylandElectronicPetitionSignature.git] / petition.php
1 <?PHP
2 include_once('header.php');
3 if (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 }
21 setcookie("pJPG", $d['petition_jpg']);
22 ?>
23 <script>
24 document.title = "MEPS - Sign <?PHP echo $d['petition_name'];?>";
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 });
34 });
35 </script>
36 <style>
37 @font-face {
38 font-family: "myFirstFont";
39 src: url("files/Claston Script.ttf");
40 }
41 .sig {
42 font-family: "myFirstFont";
43 font-size: 60px;
44 }
45 </style>
46 <?PHP
47 if (isset($_POST['signed_name_as'])){
48 ?>
49 <script>
50 window.scrollTo(0,document.body.scrollHeight);
51 $(document).ready(function(){
52 window.scrollTo(0,document.body.scrollHeight);
53 $('#exampleModalLower').modal('show');
54 });
55 function addTextb()
56 {
57 document.getElementById('text2b').innerHTML = document.getElementById('myTextb').value;
58 var string = document.getElementById('myTextb').value;
59 var res = string.toUpperCase();
60 var result = res.match(/<?PHP echo $_COOKIE['pNAME'];?>/i);
61 if (result == "<?PHP echo $_COOKIE['pNAME'];?>"){
62 document.getElementById("b2").style.display = "block";
63 document.getElementById("b2warn").style.display = "none";
64 document.getElementById("click_me2").style.display = "none";
65 document.getElementById("form2").submit();
66 //alert("Confirmed : " + result);
67 }else{
68 document.getElementById("b2").style.display = "none";
69 document.getElementById("b2warn").style.display = "block";
70 document.getElementById("click_me2").style.display = "block";
71 }
72 }
73 </script>
74 <?PHP
75 }else{
76 ?>
77 <script>
78 $(document).ready(function(){
79 $('#exampleModalCenter').modal('show');
80 });
81 function addText()
82 {
83 document.getElementById('text2').innerHTML = document.getElementById('myText').value;
84 var string = document.getElementById('myText').value;
85 var res = string.toUpperCase();
86 var result = res.match(/<?PHP echo $_COOKIE['pNAME'];?>/i);
87 if (result == "<?PHP echo $_COOKIE['pNAME'];?>"){
88 document.getElementById("b1").style.display = "block";
89 document.getElementById("b1warn").style.display = "none";
90 document.getElementById("click_me1").style.display = "none";
91 document.getElementById("form1").submit();
92 //alert("Confirmed : " + result);
93 }else{
94 document.getElementById("b1").style.display = "none";
95 document.getElementById("b1warn").style.display = "block";
96 document.getElementById("click_me1").style.display = "block";
97 }
98 }
99 </script>
100 <?PHP
101 }
102 ?>
103
104 <!-- TOP Modal -->
105 <div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
106 <div class="modal-dialog" role="document">
107 <div class="modal-content">
108 <div class="modal-header">
109 <h1 class="modal-title" id="exampleModalLongTitle">Type Your Signature to Sign <?PHP echo $d['petition_name'];?></h1>
110 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
111 <span aria-hidden="true">&times;</span>
112 </button>
113 </div>
114 <form action='petition.php' method='POST' name='form1' id='form1'>
115 <div class="modal-body">
116 <h2><?PHP echo $d['petition_sign_text_box'];?></h2>
117 <h3><?PHP echo $_COOKIE['pNAME'];?>, Please Sign Here</h3>
118
119 </div>
120 <div class="modal-footer">
121 <h1 id="text2" class="sig"></h1>
122 <button style='display:none;' id='b1' name='b1' type="submit" class="btn btn-primary btn-lg btn-block"><img class='click_me' src="files/click_here.gif">Sign and Next</button>
123 <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>
124 <table><tr><td><img id='click_me1' name='click_me1' class='click_me' src="files/click_here.gif"></td><td><input class="form-control input-lg" name="signed_name_as" type="text" id="myText" onkeyup="addText()" required autofocus></td></tr></table>
125 </div>
126 </form>
127 </div>
128 </div>
129 </div>
130
131 <!-- Lower Modal -->
132 <div class="modal fade" id="exampleModalLower" tabindex="-1" role="dialog" aria-labelledby="exampleModalLowerTitle" aria-hidden="true">
133 <div class="modal-dialog modal-dialog-centered" role="document">
134 <div class="modal-content">
135 <div class="modal-header">
136 <h1 class="modal-title" id="exampleModalLongTitleLower">Type Your Signature to Sign as Circulator</h1>
137 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
138 <span aria-hidden="true">&times;</span>
139 </button>
140 </div>
141 <form action='sign.php' method='POST' name='form2' id='form2'><input type='hidden' value='<?PHP echo $_POST['signed_name_as'];?>' name='signed_name_as'>
142 <div class="modal-body">
143 <h2><?PHP echo $d['petition_circulator_text_box'];?></h2>
144 <h3><?PHP echo $_COOKIE['pNAME'];?>, Please Sign Here</h3>
145 </div>
146 <div class="modal-footer">
147 <h1 id="text2b" class="sig"></h1>
148 <button style='display:none;' id='b2' name='b2' type="submit" class="btn btn-primary btn-lg btn-block"><img class='click_me' src="files/click_here.gif">Sign and Submit</button>
149 <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>
150 <table><tr><td><img id='click_me2' name='click_me2' class='click_me' src="files/click_here.gif"></td><td><input class="form-control input-lg" name="signed_name_as_circulator" type="text" id="myTextb" onkeyup="addTextb()" required autofocus></td></tr></table>
151 </div>
152 </form>
153 </div>
154 </div>
155 </div>
156
157 <div class='col-sm-12'><img class="img-responsive" src='hard_copy.php'></div>
158 <?PHP if ($d['petition_jpg_page2'] != ''){ ?>
159 <div class='col-sm-12'><img class="img-responsive" src='<?PHP echo $d['petition_jpg_page2'];?>'></div>
160 <?PHP } ?>
161 <?PHP
162 if(isset($_POST['signed_name_as'])){
163 slack_general('petition.php ('.$d['petition_name'].') ('.$_POST['signed_name_as'].') ('.$_COOKIE['invite'].')','md-petition');
164 }else{
165 slack_general('petition.php ('.$d['petition_name'].') ('.$_COOKIE['invite'].')','md-petition');
166 }
167 include_once('footer.php');