Add files via upload
[clinton/MarylandElectronicPetitionSignature.git] / petition.php
index 2374fdb..657e97f 100644 (file)
@@ -6,21 +6,33 @@ if (isset($_POST['petition'])){
   $q = "select * from petitions where petition_id = '$id'";
   $r = $petition->query($q);
   $d = mysqli_fetch_array($r);
-  slack_general('OK POST: petition.php ('.$_COOKIE['invite'].')','md-petition');
+  //slack_general('OK POST (invite:'.$_COOKIE['invite'].')','md-petition');
 }elseif($_COOKIE['pID'] != ''){
   $id = $_COOKIE['pID'];
   $q = "select * from petitions where petition_id = '$id'";
   $r = $petition->query($q);
   $d = mysqli_fetch_array($r);
-  slack_general('OK COOKIE: petition.php ('.$_COOKIE['invite'].')','md-petition');
+  //slack_general('OK COOKIE (invite:'.$_COOKIE['invite'].')','md-petition');
 }else{
-  slack_general('MAJOR ERROR: petition.php ('.$_COOKIE['invite'].')','md-petition');
+  slack_general('MAJOR ERROR (invite:'.$_COOKIE['invite'].')','md-petition');
   header('Location: reset.php');
   die('Error #15'); 
 }
 setcookie("pJPG", $d['petition_jpg']);
 ?>
-<script>document.title = "MEPS - Sign <?PHP echo $d['petition_name'];?>";</script>
+<script>
+  document.title = "MEPS - Sign <?PHP echo $d['petition_name'];?>";
+$(document).ready(function() {
+  $('#myText').keypress(function(event){
+    if (event.keyCode == 10 || event.keyCode == 13) 
+        event.preventDefault();
+  });
+  $('#myTextb').keypress(function(event){
+    if (event.keyCode == 10 || event.keyCode == 13) 
+        event.preventDefault();
+  });
+});
+</script>
 <style>
 @font-face {
     font-family: "myFirstFont";
@@ -44,11 +56,20 @@ if (isset($_POST['signed_name_as'])){
   {
       document.getElementById('text2b').innerHTML = document.getElementById('myTextb').value;
       var string = document.getElementById('myTextb').value; 
+      var string = string.replace(/ +(?= )/g,'');
       var res = string.toUpperCase();
+      var res = res.replace(/ +(?= )/g,'');
       var result = res.match(/<?PHP echo $_COOKIE['pNAME'];?>/i); 
       if (result == "<?PHP echo $_COOKIE['pNAME'];?>"){
             document.getElementById("b2").style.display = "block";
+            document.getElementById("b2warn").style.display = "none";
+            document.getElementById("click_me2").style.display = "none";
+            document.getElementById("form2").submit();
             //alert("Confirmed : " + result); 
+      }else{
+            document.getElementById("b2").style.display = "none";
+            document.getElementById("b2warn").style.display = "block";
+            document.getElementById("click_me2").style.display = "block";
       }
   }
 </script>
@@ -63,11 +84,20 @@ if (isset($_POST['signed_name_as'])){
   {
       document.getElementById('text2').innerHTML = document.getElementById('myText').value;
       var string = document.getElementById('myText').value; 
+      var string = string.replace(/ +(?= )/g,'');
       var res = string.toUpperCase();
+      var res = res.replace(/ +(?= )/g,'');
       var result = res.match(/<?PHP echo $_COOKIE['pNAME'];?>/i);
       if (result == "<?PHP echo $_COOKIE['pNAME'];?>"){
             document.getElementById("b1").style.display = "block";
+            document.getElementById("b1warn").style.display = "none";
+            document.getElementById("click_me1").style.display = "none";
+            document.getElementById("form1").submit();
             //alert("Confirmed : " + result); 
+      }else{
+            document.getElementById("b1").style.display = "none";
+            document.getElementById("b1warn").style.display = "block";
+            document.getElementById("click_me1").style.display = "block";
       }
   }
 </script>
@@ -85,15 +115,17 @@ if (isset($_POST['signed_name_as'])){
           <span aria-hidden="true">&times;</span>
         </button>
       </div>
-      <form action='petition.php' method='POST'>
+      <form action='petition.php' method='POST' name='form1' id='form1'>
         <div class="modal-body">
           <h2><?PHP echo $d['petition_sign_text_box'];?></h2>
           <h3><?PHP echo $_COOKIE['pNAME'];?>, Please Sign Here</h3>
-          <input class="form-control input-lg" name="signed_name_as" type="text" id="myText" onkeyup="addText()" required>
-          <h1 id="text2" class="sig"></h1>
+          
         </div>
         <div class="modal-footer">
-          <button <?PHP if ($d['eligibleVoterSigMatch'] == 'YES' ){ echo "style='display:none;'"; } ?> id='b1' name='b1' type="submit" class="btn btn-primary btn-lg btn-block">Sign and Next</button>
+          <h1 id="text2" class="sig"></h1>
+          <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>
+          <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>
+          <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>
         </div>
       </form>
     </div>
@@ -110,15 +142,16 @@ if (isset($_POST['signed_name_as'])){
           <span aria-hidden="true">&times;</span>
         </button>
       </div>
-      <form action='sign.php' method='POST'><input type='hidden' value='<?PHP echo $_POST['signed_name_as'];?>' name='signed_name_as'>
+      <form action='presign.php' method='POST' name='form2' id='form2'><input type='hidden' value='<?PHP echo $_POST['signed_name_as'];?>' name='signed_name_as'>
         <div class="modal-body">
           <h2><?PHP echo $d['petition_circulator_text_box'];?></h2>
           <h3><?PHP echo $_COOKIE['pNAME'];?>, Please Sign Here</h3>
         </div>
         <div class="modal-footer">
           <h1 id="text2b" class="sig"></h1>
-          <button <?PHP if ($d['eligibleVoterSigMatch'] == 'YES' ){ echo "style='display:none;'"; } ?> id='b2' name='b2' type="submit" class="btn btn-primary btn-lg btn-block">Sign and Submit</button>
-          <input class="form-control input-lg" name="signed_name_as_circulator" type="text" id="myTextb" onkeyup="addTextb()" required>
+          <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>
+          <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>
+          <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>
         </div>
       </form>
     </div>
@@ -126,12 +159,13 @@ if (isset($_POST['signed_name_as'])){
 </div>
 
 <div class='col-sm-12'><img class="img-responsive" src='hard_copy.php'></div>
-
-
+<?PHP if ($d['petition_jpg_page2'] != ''){ ?>
+  <div class='col-sm-12'><img class="img-responsive" src='<?PHP echo $d['petition_jpg_page2'];?>'></div>
+<?PHP } ?>
 <?PHP 
 if(isset($_POST['signed_name_as'])){
- slack_general('petition.php ('.$d['petition_name'].') ('.$_POST['signed_name_as'].') ('.$_COOKIE['invite'].')','md-petition');
+ slack_general('*Step 2* ('.$d['petition_name'].') ('.$_POST['signed_name_as'].') ('.$_COOKIE['invite'].')','md-petition');
 }else{
- slack_general('petition.php ('.$d['petition_name'].') ('.$_COOKIE['invite'].')','md-petition'); 
+ slack_general('*Step 1* ('.$d['petition_name'].') ('.$_COOKIE['invite'].')','md-petition'); 
 }
 include_once('footer.php');