Advertisement
Guest User

Untitled

a guest
Mar 31st, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. <?php
  2.    
  3.     require_once 'conn.php';
  4.    
  5.     $con = @new mysqli($host,$db_login,$db_pass,$db_name);
  6.    
  7.     if($con->connect_errno!=0)
  8.     {
  9.         echo "Can't connect to database: ".$con->connect_errno." Desc: ".$con->connect_error;
  10.     }
  11.     else
  12.     {
  13.         $username = htmlentities($_POST['login']);
  14.         $password = htmlentities($_POST['password']);
  15.        
  16.         $res = mysqli_query($con,"SELECT * FROM users WHERE '$username'=login AND '$password'=pass");
  17.         if(mysqli_num_rows($res)==0)
  18.         {
  19.             header('Location: index.php');
  20.         }
  21.         else
  22.         {
  23.             echo Zalogowano!
  24.         }
  25.        
  26.     }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement