Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start(); ?>
- <html>
- <head><title>Make a Request</title></head>
- <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
- <script type="text/javascript" src="js/srrs_script.js"></script>
- <!--Validate Form, make sure no empty Fields-->
- <script>
- function validateForm()
- {
- var x=document.forms["srrsForm"]["yourschool"].value;
- if (x==null || x=="")
- {
- alert("Your School must be filled out");
- return false;
- }
- var x=document.forms["srrsForm"]["mailingaddress"].value;
- if (x==null || x=="")
- {
- alert("Your Mailing Address must be filled out");
- return false;
- }
- var x=document.forms["srrsForm"]["city"].value;
- if (x==null || x=="")
- {
- alert("City must be filled out");
- return false;
- }
- var x=document.forms["srrsForm"]["province"].value;
- if (x==null || x=="")
- {
- alert("Province must be filled out");
- return false;
- }
- var x=document.forms["srrsForm"]["postcode"].value;
- if (x==null || x=="")
- {
- alert("Postal Code must be filled out");
- return false;
- }
- var x=document.forms["srrsForm"]["schoolphone"].value;
- if (x==null || x=="")
- {
- alert("School Phone Number must be filled out");
- return false;
- }
- var x=document.forms["srrsForm"]["cname"].value;
- if (x==null || x=="")
- {
- alert("Contact Name must be filled out");
- return false;
- }
- var x=document.forms["srrsForm"]["email"].value;
- if (x==null || x=="")
- {
- alert("A valid email must be entered");
- return false;
- }
- var x=document.forms["srrsForm"]["legname"].value;
- if (x==null || x=="")
- {
- alert("The Student's Legal Name Must be Entered, Please make sure the spelling is correct");
- return false;
- }
- var x=document.forms["srrsForm"]["givenname"].value;
- if (x==null || x=="")
- {
- alert("Please enter the students Given Name");
- return false;
- }
- //Envoke this setting again if Middle Name field becomes required
- //var x=document.forms["srrsForm"]["middlename"].value;
- //if (x==null || x=="")
- // {
- // alert("Please enter the students Middle Name");
- // return false;
- // }
- //Envoke this setting again if ASN becomes required
- //var x=document.forms["srrsForm"]["asn"].value;
- //if (x==null || x=="")
- // {
- // alert("Please enter a valid 9 digit ASN number, If out of provinve, just put any number IE: 456 or 789");
- // return false;
- // }
- var x=document.forms["srrsForm"]["dob"].value;
- if (x==null || x=="")
- {
- alert("Please enter a valid DOB, in thie format mm/dd/yyyy it cannot be left blank");
- return false;
- }
- var x=document.forms["srrsForm"]["username"].value;
- if (x==null || x=="")
- {
- alert("You must select a username");
- return false;
- }
- var x=document.forms["srrsForm"]["password"].value;
- if (x==null || x=="")
- {
- alert("You must select a password");
- return false;
- }
- }
- </script>
- <style TYPE="text/css">
- table {
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- border-radius: 10px;
- border: 1px solid;
- font-size: 77%;
- }
- td {
- -moz-border-radius: 10px;
- -webkit-border-radius: 10px;
- border-radius: 10px;
- border: 0px solid;
- font-size: 100%;
- }
- .white {
- background-color:#FFFFFF;
- }
- .blue {
- background-color:#0099FF;
- color: #FFFFFF;
- font-size: 160%
- }
- .green {
- background-color:#00CC00;
- color: #FFFFFF;
- font-size: 120%
- }
- .yellow {
- background-color:#FFCC00;
- color: #FFFFFF;
- font-size: 120%
- }
- .grey {
- background-color:#6B727E;
- }
- .blue2 {
- background-color:#0068C3;
- color: #FFFFFF;
- font-size: 160%
- </style>
- <body bgcolor="#0068C3">
- <form id="srrsForm" action="" method="POST" onsubmit="return validateForm()">
- <center><table bgcolor="white" cellpadding="3">
- <tr><td colspan="2" class="white"><center><img src="images/publicreqtop.png"></center></td></tr>
- <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>
- <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>
- <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="5"><center><b>Your School Information</b></center></font></td></tr>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <tr><td colspan="2" class="blue2"><font face="arial" color="white" size="5"><center><b>Requested Student Information</b></center></font></td></tr>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <tr><td colspan="2"><center><button id="submit">Request Information</center> </button></td></tr>
- <tr><td colspan="2" class="white"><center><img src="images/publicreqtop.png"></center></td></tr>
- </table></center>
- </form>
- <div id="srrs"></div>
- </body>
- </html>
- <?php
- include_once('db.php');
- $province = mysql_real_escape_string( $_POST['province'] );
- $city = mysql_real_escape_string( $_POST['city'] );
- $yourschool = mysql_real_escape_string( $_POST['yourschool'] );
- $mailingaddress = mysql_real_escape_string( $_POST['mailingaddress'] );
- $postcode = mysql_real_escape_string( $_POST['postcode'] );
- $schoolphone = mysql_real_escape_string( $_POST['schoolphone'] );
- $cname = mysql_real_escape_string( $_POST['cname'] );
- $email = mysql_real_escape_string( $_POST['email'] );
- $legname = mysql_real_escape_string( $_POST['legname'] );
- $givenname = mysql_real_escape_string( $_POST['givenname'] );
- $middlename = mysql_real_escape_string( $_POST['middlename'] );
- $asn = mysql_real_escape_string( $_POST['asn'] );
- $dob = mysql_real_escape_string( $_POST['dob'] );
- $username = mysql_real_escape_string( $_POST['username'] );
- $password = mysql_real_escape_string( $_POST['password'] );
- $sql = "INSERT INTO srrsrequest VALUES('',
- '$province',
- '$city',
- '$yourschool',
- '$mailingaddress',
- '$postcode',
- '$schoolphone',
- '$cname',
- '$email',
- '$legname',
- '$givenname',
- '$middlename',
- '$asn',
- '$dob',
- '$username',
- '$password',
- '')";
- // Your code here to handle a successful verification
- //*if captcha code is posted*//
- if(isset($_POST["captcha"])) {
- if($_SESSION["captcha"]==strtolower($_POST["captcha"])) {
- if(mysql_query($sql)) {
- //Envoke this setting for Javascript popup of success message, not currently needed because of forward.
- //echo "<script type='text/javascript'>alert('submitted successfully, The records manager will provide you with your record within 3 days!')</script>";
- //mail('somebody@me.com', 'SRRS - New Records Await Processing', 'SRRS - There are new records for processing in the System' );
- //$to = 'somebody@me.com' . ', ';
- //$to .= $email;
- $to = "somebody@me.com";
- $subject = "New Student Record Await Processing";
- $message = "New Student Record Requests have been submitted and Await Processing";
- $from = "noreplay.srrs@me.com";
- $headers = "From:" . $from;
- mail($to,$subject,$message,$headers);
- //Envoke this setting for successfull transmission of information, if needed in future, not needed because of printf redirect on successful submission.
- //echo "<script type='text/javascript'>alert('An Email Has to sent from the Records Management System to the Records Management Administrator for Processing.')</script>";
- //Mail the user
- $to = $email;
- $subject = " NOTIFICATION - Your new record request has been submitted.";
- $message = " - Your new record request for $givenname, $legname has been submitted, It will be procssed within 3 working days";
- $from = "noreplay.yes@me.com";
- $headers = "From:" . $from;
- mail($to,$subject,$message,$headers);
- printf("<script>location.href='confirmed.php'</script>");
- } else {
- // Echo problems with Sql
- }
- } else {
- echo "<script type='text/javascript'>alert('Human Verification not entered properly! Please try again!')</script>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement