SHARE
TWEET

Untitled

a guest Jun 30th, 2018 29 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.     session_start();
  4.    
  5.     if ((!isset($_POST['login'])) || (!isset($_POST['haslo'])))
  6.     {
  7.         header('Location: index.php');
  8.         exit();
  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.         $haslo = htmlentities($haslo, ENT_QUOTES, "UTF-8");
  26.    
  27.         if ($rezultat = @$polaczenie->query(
  28.         sprintf("SELECT * FROM uzytkownicy WHERE user='%s' AND pass='%s'",
  29.         mysqli_real_escape_string($polaczenie,$login),
  30.         mysqli_real_escape_string($polaczenie,$haslo))))
  31.         {
  32.             $ilu_userow = $rezultat->num_rows;
  33.             if($ilu_userow>0)
  34.             {
  35.                 $_SESSION['zalogowany'] = true;
  36.                
  37.                 $wiersz = $rezultat->fetch_assoc();
  38.                 $_SESSION['id'] = $wiersz['id'];
  39.                 $_SESSION['user'] = $wiersz['user'];
  40.                 $_SESSION['drewno'] = $wiersz['drewno'];
  41.                 $_SESSION['kamien'] = $wiersz['kamien'];
  42.                 $_SESSION['zboze'] = $wiersz['zboze'];
  43.                 $_SESSION['email'] = $wiersz['email'];
  44.                 $_SESSION['dnipremium'] = $wiersz['dnipremium'];
  45.                
  46.                 unset($_SESSION['blad']);
  47.                 $rezultat->free_result();
  48.                 header('Location: gra.php');
  49.                
  50.             } else {
  51.                
  52.                 $_SESSION['blad'] = '<span style="color:red">Nieprawidłowy login lub hasło!</span>';
  53.                 header('Location: index.php');
  54.                
  55.             }
  56.            
  57.         }
  58.        
  59.         $polaczenie->close();
  60.     }
  61.    
  62. ?>
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