<?php include_once 'DBconnection.php'; include_once 'Instructor.php'; include_once 'instructorClass.php'; $myDBconnection = new DBconnection(); $myDBconnection->ConnectToDB(); $fname = $_POST['FirstName']; $lname = $_POST['LastName']; $email = $_POST['Email']; $myInstructor = new Instructor($fname, $lname, sha1($_POST['Password']), $_POST['Email']); $checkInstructor = $myInstructor->Selection($myDBconnection->db); session_start(); // echo $checkInstructor->rowCount(); if ($checkInstructor->rowCount() == 0) { if (!isset($_SESSION)) { session_destroy(); } $response = $myInstructor->Insertion($myDBconnection->db); if ($response == 0) { echo "Query Failed"; $_SESSION['errorMessage'] = "There was an error inserting into the database. Please try again."; header('Location: ../registrationPage.php'); } else { echo "query Successful"; $_SESSION['Email'] = $email; $_SESSION['name'] = $fname . " " . $lname; $_SESSION['validCredentials'] = true; $myDBconnection->closeConnection(); header('Location: ../LoginPage.php'); }
<?php include_once 'DBconnection.php'; include_once 'Instructor.php'; if (!isset($_SESSION)) { session_start(); $myDBconnection = new DBconnection(); $myDBconnection->ConnectToDB(); if (empty($_POST) === false) { $Email = $_POST['Email']; // $Password = sha1($_POST['Password']); // echo $Email; // echo $Password; $myInstructor = new Instructor("", "", $Password, $Email); $myTracketInst = $myInstructor->Selection($myDBconnection->db); $i = 0; foreach ($myTracketInst as $row) { if ($Email == $row['EMAIL'] and $Password == $row['PSWRD']) { if (!isset($_SESSION['count'])) { $_SESSION['count'] = 1; } else { $_SESSION['count']++; } $_SESSION['name'] = $row['FNAME'] . " " . $row['LNAME']; $_SESSION['Email'] = $Email; $_SESSION['validCredentials'] = true; header('Location: ../ManageClass.php'); } else { $_SESSION['errorMessage'] = "The Username Password Combination was not found in the database"; header('Location: ../LoginPage.php');