daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function passwordEncryptor($password){
  3. $options = [
  4.         'cost' => 14,
  5.     ];
  6.     return password_hash($password, PASSWORD_BCRYPT, $options);
  7. }
  8.  
  9. ?>
  10.    
  11. <?php
  12.     $email = mysqli_real_escape_string($dbcon, $_POST['email']);
  13.     $password = passwordEncryptor($_POST['password']);
  14.  
  15.     $query = "SELECT * FROM pcd_users WHERE email='$email' AND password='$password'";
  16.     $do_query = @mysqli_query($dbcon, $query);
  17.     if($do_query){
  18.         if(mysqli_num_rows($do_query) != 1){
  19.             $errors[] = "E-mail ou Palavra-Passe incorretos." . $query;
  20.         }else{
  21.             while ($row = mysqli_fetch_array($do_query, MYSQLI_ASSOC)) {
  22.                 mysqli_free_result($do_query);
  23.                 session_start();
  24.                 $_SESSION['userNum'] = $row['num'];
  25.                 header("Location: ./page.php");
  26.                 exit();
  27.             }
  28.         }
  29.     }else{
  30.         $errors[] = "Erro: " . mysqli_error($do_query);
  31.     }
  32.     mysqli_free_result($do_query);
  33. ?>
  34.    
  35. SELECT * FROM pcd_users WHERE email='teste@teste.com' AND password='$2y$14$O6iOBsAyv0JqwGudQhKPB.f68nLthfoMlJUU8n8zRuXxFJubhe7CO'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top