SHARE
TWEET

Untitled

a guest Dec 13th, 2016 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///connect.php
  2. <?php
  3.  
  4.     $host = "localhost";
  5.     $db_user = "root";
  6.     $db_password = "";
  7.     $db_name = "moviedb"
  8.    
  9. ?>
  10.  
  11. require_once "connect.php";
  12.  
  13.     $polaczenie = @new mysqli($host, $db_user, $db_password, $db_name);
  14.    
  15.     if ($polaczenie->connect_errno!=0)
  16.     {
  17.         echo "Error: ".$polaczenie->connect_errno;
  18.     }
  19.     else
  20.     {
  21.         $login = $_POST['login'];
  22.         $haslo = $_POST['haslo'];
  23.        
  24.         $login = htmlentities($login, ENT_QUOTES, "UTF-8");
  25.    
  26.         if ($rezultat = @$polaczenie->query(
  27.         sprintf("SELECT * FROM uzytkownicy WHERE user='%s'",
  28.         mysqli_real_escape_string($polaczenie,$login))))
  29.         {
  30.             $ilu_userow = $rezultat->num_rows;
  31.             if($ilu_userow>0)
  32.             {
  33.                 $wiersz = $rezultat->fetch_assoc();
  34.                 if (password_verify($haslo, $wiersz['pass']))
  35.                 {
  36.                 $_SESSION['zalogowany'] = true;
  37.                 $_SESSION['id'] = $wiersz['id'];
  38.                 $_SESSION['user'] = $wiersz['user'];
  39.             }
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