Guest User

Untitled

a guest
Nov 24th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. <?php
  2.  
  3. require_once '../includes/header.php';
  4.  
  5. ?>
  6.  
  7. <div class="container-fluid">
  8. <div class="row">
  9.  
  10. <div class="cod-md-4 col-sm-4 col-xs-12">
  11. </div>
  12.  
  13. <div class="cod-md-4 col-sm-4 col-xs-12">
  14. <div id="container">
  15.  
  16. <form id="sdntRegForm" action="sdntRegisterBE.php" role="form" method="post">
  17. </form> <!-- Form -->
  18.  
  19. </div> <!-- Container -->
  20. </div>
  21.  
  22. <div class="cod-md-4 col-sm-4 col-xs-12">
  23. </div>
  24.  
  25. </div> <!-- Row -->
  26. </div> <!-- Container fluid -->
  27.  
  28.  
  29. </body>
  30. </html>
  31.  
  32. <?php
  33.  
  34. require_once '../includes/connect.php';
  35.  
  36. if (isset($error)) {
  37. echo ($error);
  38. }
  39.  
  40. if (!$error) {
  41.  
  42. $query = "
  43. SELECT Email FROM Student WHERE Email = :email
  44. ";
  45. $result = $DBH->prepare($query);
  46. $result->bindParam(':email', $_POST['email']);
  47. $result->execute();
  48. $checkemail = $result->fetchAll();
  49.  
  50. if ($checkemail == NULL) {
  51.  
  52. $encryptedPass = password_hash($_POST['password'], PASSWORD_DEFAULT); //Hash the password
  53.  
  54. //Insert into the database columns
  55. $query2 = "
  56. INSERT INTO Student(Forename, Surname, DOB, Gender, ContactNumber, HouseNumber, StreetName, City, County, Postcode, Country, Email, Pw)
  57. VALUES (:fname, :sname, :dob, :gender, :contactnumber, :housenumber, :streetname, :city, :county, :postcode, :country, :email, :password)
  58. ";
  59.  
  60. $result2 = $DBH->prepare($query2);
  61.  
  62. $result2->bindParam(':fname', $_POST['forename']);
  63. $result2->bindParam(':sname', $_POST['surname']);
  64. $result2->bindParam(':dob', $_POST['dob']);
  65. $result2->bindParam(':gender', $_POST['genderRadioBtn']);
  66. $result2->bindParam(':contactnumber', $_POST['contactNumber']);
  67. $result2->bindParam(':housenumber', $_POST['houseNumber']);
  68. $result2->bindParam(':streetname', $_POST['streetName']);
  69. $result2->bindParam(':city', $_POST['city']);
  70. $result2->bindParam(':county', $_POST['county']);
  71. $result2->bindParam(':postcode', $_POST['postcode']);
  72. $result2->bindParam(':country', $_POST['country']);
  73. $result2->bindParam(':email', $_POST['email']);
  74. $result2->bindParam(':password', $encryptedPass);
  75. $result->execute();
  76.  
  77. } else {
  78.  
  79. echo ("You have already registered");
  80.  
  81. }
  82.  
  83. }
  84.  
  85. ?>
Add Comment
Please, Sign In to add comment