survey_seahorse

Software Engineering Project - Fall 2018
Log | Files | Refs | README

reset-pass.php (600B)


      1 <?php
      2 if(isset($_POST['reset'])){
      3     include_once 'session.php';
      4     include '../config.php';
      5 
      6     $email = mysqli_real_escape_string($connect, $_POST['email']);
      7     $pass = mysqli_real_escape_string($connect, $_POST['newPass']);
      8     $confirmPass = mysqli_real_escape_string($connect, $_POST['confirmPass']);
      9 
     10     if($pass == $confirmPass){
     11         $hashPass = password_hash($pass, PASSWORD_DEFAULT);
     12         $sql = "UPDATE user SET password='$hashPass' WHERE email= '$email';";
     13         mysqli_query($connect, $sql) or die (mysqli_error($connect));
     14         header("Location: ../login.php");
     15     }
     16 }