Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once '../includes/header.php';
- ?>
- <div class="container-fluid">
- <div class="row">
- <div class="cod-md-4 col-sm-4 col-xs-12">
- </div>
- <div class="cod-md-4 col-sm-4 col-xs-12">
- <div id="container">
- <form id="sdntRegForm" action="sdntRegisterBE.php" role="form" method="post">
- </form> <!-- Form -->
- </div> <!-- Container -->
- </div>
- <div class="cod-md-4 col-sm-4 col-xs-12">
- </div>
- </div> <!-- Row -->
- </div> <!-- Container fluid -->
- </body>
- </html>
- <?php
- require_once '../includes/connect.php';
- if (isset($error)) {
- echo ($error);
- }
- if (!$error) {
- $query = "
- SELECT Email FROM Student WHERE Email = :email
- ";
- $result = $DBH->prepare($query);
- $result->bindParam(':email', $_POST['email']);
- $result->execute();
- $checkemail = $result->fetchAll();
- if ($checkemail == NULL) {
- $encryptedPass = password_hash($_POST['password'], PASSWORD_DEFAULT); //Hash the password
- //Insert into the database columns
- $query2 = "
- INSERT INTO Student(Forename, Surname, DOB, Gender, ContactNumber, HouseNumber, StreetName, City, County, Postcode, Country, Email, Pw)
- VALUES (:fname, :sname, :dob, :gender, :contactnumber, :housenumber, :streetname, :city, :county, :postcode, :country, :email, :password)
- ";
- $result2 = $DBH->prepare($query2);
- $result2->bindParam(':fname', $_POST['forename']);
- $result2->bindParam(':sname', $_POST['surname']);
- $result2->bindParam(':dob', $_POST['dob']);
- $result2->bindParam(':gender', $_POST['genderRadioBtn']);
- $result2->bindParam(':contactnumber', $_POST['contactNumber']);
- $result2->bindParam(':housenumber', $_POST['houseNumber']);
- $result2->bindParam(':streetname', $_POST['streetName']);
- $result2->bindParam(':city', $_POST['city']);
- $result2->bindParam(':county', $_POST['county']);
- $result2->bindParam(':postcode', $_POST['postcode']);
- $result2->bindParam(':country', $_POST['country']);
- $result2->bindParam(':email', $_POST['email']);
- $result2->bindParam(':password', $encryptedPass);
- $result->execute();
- } else {
- echo ("You have already registered");
- }
- }
- ?>
Add Comment
Please, Sign In to add comment