SHARE
TWEET

LOGOWANIE - PANEL

a guest Mar 20th, 2016 164 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     session_start();
  3.    
  4.  
  5.     require_once "connect.php";
  6.    
  7.     $polaczenie = @new mysqli($host, $db_user, $db_password, $db_name);
  8.    
  9.     if($polaczenie->connect_errno!=0)
  10.     {
  11.       echo "Error:".$polaczenie->connect_errno;
  12.     }
  13.     else
  14.     {
  15.         $login = $_POST['login'];
  16.         $haslo = $_POST['haslo'];
  17.        
  18.         $sql= "SELECT * FROM authme WHERE username='$login' AND password='$haslo'";
  19.         if($rezultat = @$polaczenie->query($sql))
  20.    
  21.         {
  22.    
  23.             $ilu_userow = $rezultat->num_rows;
  24.             if($ilu_userow>0)
  25.             {
  26.                 $_SESSION['zalogowany'] = true;
  27.                
  28.                 $wiersz = $rezultat->fetch_assoc();
  29.                 $_SESSION['id'] = $wiersz['id'];
  30.                 $_SESSION['user'] = $wiersz['username'];
  31.                 $_SESSION['email'] = $wiersz['email'];
  32.                 $_SESSION['ip'] = $wiersz['ip'];
  33.                 $_SESSION['mapa'] = $wiersz['world'];
  34.                 $_SESSION['balance'] = $wiersz['balance'];
  35.                
  36.                 unset($_SESSION['blad']);
  37.                 $rezultat->free_result();  
  38.                 header('Location: panel.php');
  39.             }
  40.             else
  41.             {
  42.                
  43.                 $_SESSION['blad']='<span style="color:red">Nieprawidłowy login lub hasło!</span>';
  44.                 header('Location: logowanie.php');
  45.             }
  46.            
  47.         }
  48.        
  49.         $polaczenie->close();
  50.     }
  51. ?>
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