daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Apr 27th, 2018 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  // Dobiti variable sifre iz forme u login.php fajlu
  3.  $user = $_POST['username'];
  4.  $pass = $_POST['password'];
  5.  
  6.  // Mysql inject (ZA USER I PASS)
  7.  $username = stripcslashes(mysql_real_escape_string($user));
  8.  $password = stripcslashes(mysql_real_escape_string($pass));
  9.  
  10.  // povezati sa data bazom
  11.  mysqli_connect("localhost", "root", "");
  12.  mysqli_connect_db("login");
  13.  
  14.  // Query data baze sa username
  15.  $result = mysqli_query("select * from users where username = '$username' and password = '$password'")       or die("Failed to query database " .mysql_error());    
  16.  $row = mysqli_fetch_array($result);
  17.  if ($row['username'] == $username && $row['password'] == $password ){
  18.     echo "Uspesan login! Dobrodosao" .$row['username'];
  19.  } else {
  20.     echo "Login nije uspesan :(";
  21.  }
  22.  
  23. ?>
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