Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start ();
- if (isset($_POST['LoginSubmit'])) {
- include 'db.php';
- $UserName = $_POST["UserName"];
- $RPass = $_POST["RPass"];
- //check if empty
- if (empty($UserName) || empty($RPass)) {
- header("Location: ../Website/Login.php?login=e");
- exit();
- } else {
- $sql = "SELECT * FROM Login WHERE Email = '$UserName' AND Password = '$RPass'";
- $result = mysqli_query($connection, $sql);
- $resultCheck = mysqli_num_rows($result);
- if($resultCheck < 1) {
- header("Location: ../Website/Login.php?login=em");
- exit();
- } else {
- if ($row = mysqli_fetch_assoc($result)){
- //de hashing
- // $hashedPwdCheck = password_verify($RPass, $row['Password']);
- if ($RPass == false) {
- header("Location: ../Website/Login.php?login=error");
- exit();
- } elseif ($RPass == true) {
- //logging the user in
- $_SESSION['u_id'] = $row ['User_id'];
- $_SESSION['u_first'] = $row ['FirstName'];
- $_SESSION['u_second'] = $row ['SecondName'];
- $_SESSION['u_email'] = $row ['Email'];
- $_SESSION['u_age'] = $row ['Age'];
- header("Location: ../Website/Login.php?login=sucess");
- exit();
- }
- }
- }
- }
- header("Location: ../Website/Login.php?login=emp");
- exit();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement