Advertisement
Guest User

Untitled

a guest
Sep 19th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.83 KB | None | 0 0
  1. <?php session_start(); ?>
  2. <html>
  3. <head><title>Make a Request</title></head>
  4. <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
  5. <script type="text/javascript" src="js/srrs_script.js"></script>
  6.  
  7. <!--Validate Form, make sure no empty Fields-->
  8. <script>
  9. function validateForm()
  10. {
  11.  
  12. var x=document.forms["srrsForm"]["yourschool"].value;
  13. if (x==null || x=="")
  14. {
  15. alert("Your School must be filled out");
  16. return false;
  17. }
  18.  
  19. var x=document.forms["srrsForm"]["mailingaddress"].value;
  20. if (x==null || x=="")
  21. {
  22. alert("Your Mailing Address must be filled out");
  23. return false;
  24. }
  25.  
  26. var x=document.forms["srrsForm"]["city"].value;
  27. if (x==null || x=="")
  28. {
  29. alert("City must be filled out");
  30. return false;
  31. }
  32.  
  33. var x=document.forms["srrsForm"]["province"].value;
  34. if (x==null || x=="")
  35. {
  36. alert("Province must be filled out");
  37. return false;
  38. }
  39.  
  40. var x=document.forms["srrsForm"]["postcode"].value;
  41. if (x==null || x=="")
  42. {
  43. alert("Postal Code must be filled out");
  44. return false;
  45. }
  46.  
  47. var x=document.forms["srrsForm"]["schoolphone"].value;
  48. if (x==null || x=="")
  49. {
  50. alert("School Phone Number must be filled out");
  51. return false;
  52. }
  53.  
  54. var x=document.forms["srrsForm"]["cname"].value;
  55. if (x==null || x=="")
  56. {
  57. alert("Contact Name must be filled out");
  58. return false;
  59. }
  60.  
  61. var x=document.forms["srrsForm"]["email"].value;
  62. if (x==null || x=="")
  63. {
  64. alert("A valid email must be entered");
  65. return false;
  66. }
  67.  
  68. var x=document.forms["srrsForm"]["legname"].value;
  69. if (x==null || x=="")
  70. {
  71. alert("The Student's Legal Name Must be Entered, Please make sure the spelling is correct");
  72. return false;
  73. }
  74.  
  75. var x=document.forms["srrsForm"]["givenname"].value;
  76. if (x==null || x=="")
  77. {
  78. alert("Please enter the students Given Name");
  79. return false;
  80. }
  81.  
  82. //Envoke this setting again if Middle Name field becomes required
  83. //var x=document.forms["srrsForm"]["middlename"].value;
  84. //if (x==null || x=="")
  85. // {
  86. // alert("Please enter the students Middle Name");
  87. // return false;
  88. // }
  89.  
  90. //Envoke this setting again if ASN becomes required
  91. //var x=document.forms["srrsForm"]["asn"].value;
  92. //if (x==null || x=="")
  93. // {
  94. // alert("Please enter a valid 9 digit ASN number, If out of provinve, just put any number IE: 456 or 789");
  95. // return false;
  96. // }
  97.  
  98. var x=document.forms["srrsForm"]["dob"].value;
  99. if (x==null || x=="")
  100. {
  101. alert("Please enter a valid DOB, in thie format mm/dd/yyyy it cannot be left blank");
  102. return false;
  103. }
  104.  
  105. var x=document.forms["srrsForm"]["username"].value;
  106. if (x==null || x=="")
  107. {
  108. alert("You must select a username");
  109. return false;
  110. }
  111.  
  112. var x=document.forms["srrsForm"]["password"].value;
  113. if (x==null || x=="")
  114. {
  115. alert("You must select a password");
  116. return false;
  117. }
  118.  
  119.  
  120.  
  121.  
  122. }
  123. </script>
  124.  
  125. <style TYPE="text/css">
  126. table {
  127. -moz-border-radius: 10px;
  128. -webkit-border-radius: 10px;
  129. border-radius: 10px;
  130. border: 1px solid;
  131. font-size: 77%;
  132. }
  133.  
  134. td {
  135. -moz-border-radius: 10px;
  136. -webkit-border-radius: 10px;
  137. border-radius: 10px;
  138. border: 0px solid;
  139. font-size: 100%;
  140. }
  141.  
  142. .white {
  143. background-color:#FFFFFF;
  144. }
  145.  
  146. .blue {
  147. background-color:#0099FF;
  148. color: #FFFFFF;
  149. font-size: 160%
  150.  
  151. }
  152.  
  153. .green {
  154. background-color:#00CC00;
  155. color: #FFFFFF;
  156. font-size: 120%
  157. }
  158.  
  159. .yellow {
  160. background-color:#FFCC00;
  161. color: #FFFFFF;
  162. font-size: 120%
  163. }
  164.  
  165. .grey {
  166. background-color:#6B727E;
  167. }
  168.  
  169. .blue2 {
  170. background-color:#0068C3;
  171. color: #FFFFFF;
  172. font-size: 160%
  173.  
  174.  
  175.  
  176. </style>
  177.  
  178.  
  179.  
  180. <body bgcolor="#0068C3">
  181. <form id="srrsForm" action="" method="POST" onsubmit="return validateForm()">
  182. <center><table bgcolor="white" cellpadding="3">
  183.  
  184. <tr><td colspan="2" class="white"><center><img src="images/publicreqtop.png"></center></td></tr>
  185. <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="4"><center><b>*YOU MUST USE* Firefox or Chrome to fill out this form</b></center></font></td></tr>
  186. <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="4"><center><b><a href="images/Ninite_Firefox_Installer.exe"><img src="images/firefox_download_badge.png"></a><a href="images/Ninite_Java_Installer.exe"><img src="images/Java_Self_Install.png"></b></center></font></td></tr>
  187. <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="5"><center><b>Your School Information</b></center></font></td></tr>
  188. <tr><td><font face="arial"><b>Your School:</b></font></td><td><input type="text" name="yourschool" value="<?php if (!empty($_POST['yourschool'])) { echo htmlentities($_POST['yourschool']); } ?>"/></tr></td>
  189. <tr><td><font face="arial"><b>Mailing Address:</b></font></td><td><input type="text" name="mailingaddress" value="<?php if (!empty($_POST['mailingaddress'])) { echo htmlentities($_POST['mailingaddress']); } ?>"/></tr></td>
  190. <tr><td><font face="arial"><b>City:</b> </font></td><td><input type="text" name="city" value="<?php if (!empty($_POST['city'])) { echo htmlentities($_POST['city']); } ?>"/></tr></td>
  191. <tr><td><font face="arial"><b>Enter Province (Requested Format: example AB)</b></font> </td><td><input type="text" name="province" maxlength="2" pattern="[A-Z]{2}" title="(Province: AB or BC etc.)" value="<?php if (!empty($_POST['province'])) { echo htmlentities($_POST['province']); } ?>"/></tr></td>
  192. <tr><td><font face="arial"><b>Postal Code:</b></font> </td><td><input type="text" name="postcode" value="<?php if (!empty($_POST['postcode'])) { echo htmlentities($_POST['postcode']); } ?>"/></tr></td>
  193. <tr><td><font face="arial"><b>School Phone Number:</b></font> </td><td><input type="tel" pattern="[\(]\d{3}[\)]\d{3}[\-]\d{4}" title="Phone Number (Format: (780)555-4444)" name="schoolphone" value="<?php if (!empty($_POST['schoolphone'])) { echo htmlentities($_POST['schoolphone']); } ?>"/></tr></td>
  194. <tr><td><font face="arial"><b>Contact Name:</b> </font></td><td><input type="text" name="cname" value="<?php if (!empty($_POST['cname'])) { echo htmlentities($_POST['cname']); } ?>"/></tr></td>
  195. <tr><td><font face="arial"><b>Email address:</b> </font></td><td><input type="email" name="email" value="<?php if (!empty($_POST['email'])) { echo htmlentities($_POST['email']); } ?>"/></tr></td>
  196. <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="5"><center><b>Requested Student Information</b></center></font></td></tr>
  197. <tr><td><font face="arial"><b>Last Name:</b> </font></td><td><input type="text" name="legname" value="<?php if (!empty($_POST['legname'])) { echo htmlentities($_POST['legname']); } ?>"/></tr></td>
  198. <tr><td><font face="arial"><b>Given Name:</b> </font></td><td><input type="text" name="givenname" value="<?php if (!empty($_POST['givenname'])) { echo htmlentities($_POST['givenname']); } ?>"/></tr></td>
  199. <tr><td><font face="arial"><b>Middle Name:</b> </font></td><td><input type="text" name="middlename" value="<?php if (!empty($_POST['middlename'])) { echo htmlentities($_POST['middlename']); } ?>"/></tr></td>
  200. <tr><td><font face="arial"><b>ASN</b> <font size="1"><b>(Enter ASN if known, otherwise leave blank):</b></font></b></font></td><td><input type="text" name="asn" value="<?php if (!empty($_POST['asn'])) { echo htmlentities($_POST['asn']); } ?>"/></tr></td>
  201. <tr><td><font face="arial"><b>DOB</b> <b><font size="1">(Please use Month, Day, Year IE: 09/20/1983 :</font></b></font></td><td><input type="text" name="dob" value="<?php if (!empty($_POST['dob'])) { echo htmlentities($_POST['dob']); } ?>"/></tr></td>
  202. <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="5"><center><b>Choose your Login Information (IE: Username and Password)</b></center></font></td></tr>
  203. <tr><td><font face="arial"><b>Enter the Username you want to use: [Minimum 6 characters-no caps or special characters]</b> </font></td><td><input type="text" name="username" pattern="[a-z0-9]{6,15}" title="Username (Format: Minimum 6 characters, Letters and Numbers, No Special Characters Allowed)" value="<?php if (!empty($_POST['username'])) { echo htmlentities($_POST['username']); } ?>"/></tr></td>
  204. <tr><td><font face="arial"><b>Enter the Password you want to use: [Minimum 6 characters-no caps or special characters]</b> </font></td><td><input type="text" pattern="[a-z0-9]{6,15}" name="password" title="Username (Format: Minimum 6 characters, Letters and Numbers, No Special Characters Allowed)" value="<?php if (!empty($_POST['password'])) { echo htmlentities($_POST['password']); } ?>"/></tr></td>
  205. <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="2"><center><b>Before Submitting the Request Form, please prove you are Human by typing the words below</b></center></font></td></tr>
  206. <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="2"><center><b>CAPTCHA check</b> (six letter code)</center></font></td></tr>
  207. <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="2"><center><img src="captcha.php" alt="captcha image"></center></font></td></tr>
  208. <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="2"><center><input type="text" name="captcha" size="20" maxlength="6"></center></font></td></tr>
  209.  
  210. <tr><td colspan="2"><center><button id="submit">Request Information</center> </button></td></tr>
  211. <tr><td colspan="2" class="white"><center><img src="images/publicreqtop.png"></center></td></tr>
  212. </table></center>
  213. </form>
  214.  
  215. <div id="srrs"></div>
  216.  
  217. </body>
  218. </html>
  219.  
  220. <?php
  221.  
  222.  
  223. include_once('db.php');
  224.  
  225. $province = mysql_real_escape_string( $_POST['province'] );
  226. $city = mysql_real_escape_string( $_POST['city'] );
  227. $yourschool = mysql_real_escape_string( $_POST['yourschool'] );
  228. $mailingaddress = mysql_real_escape_string( $_POST['mailingaddress'] );
  229. $postcode = mysql_real_escape_string( $_POST['postcode'] );
  230. $schoolphone = mysql_real_escape_string( $_POST['schoolphone'] );
  231. $cname = mysql_real_escape_string( $_POST['cname'] );
  232. $email = mysql_real_escape_string( $_POST['email'] );
  233. $legname = mysql_real_escape_string( $_POST['legname'] );
  234. $givenname = mysql_real_escape_string( $_POST['givenname'] );
  235. $middlename = mysql_real_escape_string( $_POST['middlename'] );
  236. $asn = mysql_real_escape_string( $_POST['asn'] );
  237. $dob = mysql_real_escape_string( $_POST['dob'] );
  238. $username = mysql_real_escape_string( $_POST['username'] );
  239. $password = mysql_real_escape_string( $_POST['password'] );
  240.  
  241. $sql = "INSERT INTO srrsrequest VALUES('',
  242. '$province',
  243. '$city',
  244. '$yourschool',
  245. '$mailingaddress',
  246. '$postcode',
  247. '$schoolphone',
  248. '$cname',
  249. '$email',
  250. '$legname',
  251. '$givenname',
  252. '$middlename',
  253. '$asn',
  254. '$dob',
  255. '$username',
  256. '$password',
  257. '')";
  258.  
  259.  
  260. // Your code here to handle a successful verification
  261. //*if captcha code is posted*//
  262.  
  263. if(isset($_POST["captcha"])) {
  264. if($_SESSION["captcha"]==strtolower($_POST["captcha"])) {
  265. if(mysql_query($sql)) {
  266. //Envoke this setting for Javascript popup of success message, not currently needed because of forward.
  267. //echo "<script type='text/javascript'>alert('submitted successfully, The records manager will provide you with your record within 3 days!')</script>";
  268. //mail('somebody@me.com', 'SRRS - New Records Await Processing', 'SRRS - There are new records for processing in the System' );
  269. //$to = 'somebody@me.com' . ', ';
  270. //$to .= $email;
  271. $to = "somebody@me.com";
  272. $subject = "New Student Record Await Processing";
  273. $message = "New Student Record Requests have been submitted and Await Processing";
  274. $from = "noreplay.srrs@me.com";
  275. $headers = "From:" . $from;
  276. mail($to,$subject,$message,$headers);
  277. //Envoke this setting for successfull transmission of information, if needed in future, not needed because of printf redirect on successful submission.
  278. //echo "<script type='text/javascript'>alert('An Email Has to sent from the Records Management System to the Records Management Administrator for Processing.')</script>";
  279. //Mail the user
  280. $to = $email;
  281. $subject = " NOTIFICATION - Your new record request has been submitted.";
  282. $message = " - Your new record request for $givenname, $legname has been submitted, It will be procssed within 3 working days";
  283. $from = "noreplay.yes@me.com";
  284. $headers = "From:" . $from;
  285. mail($to,$subject,$message,$headers);
  286. printf("<script>location.href='confirmed.php'</script>");
  287. } else {
  288. // Echo problems with Sql
  289. }
  290. } else {
  291. echo "<script type='text/javascript'>alert('Human Verification not entered properly! Please try again!')</script>";
  292. }
  293. }
  294. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement