SHARE
TWEET

Untitled

a guest Apr 27th, 2018 86 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.  $username = addslashes($_POST['username']);
  4.  $password = addslashes($_POST['password']);
  5.  
  6.  // Mysql inject (ZA USER I PASS)
  7.  
  8.  // povezati sa data bazom
  9. $dbhost = 'localhost';  // Mysqli HOST
  10. $dbuser = 'root';  // Mysqli nick
  11. $dbpass = "";  // mysqli Lozinka
  12. $dbname = 'login'; // Ime Databaze
  13.  
  14. $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  15.  
  16.  // Query data baze sa username
  17.  $result = mysql_query($conn, "select * from users where username = '$username' and password = '$password'")       or die("Failed to query database " .mysql_error());    
  18.  $row = mysql_fetch_array($result);
  19.  if ($row['username'] == $username && $row['password'] == $password ){
  20.     echo "Uspesan login! Dobrodosao" .$row['username'];
  21.  } else {
  22.     echo "Login nije uspesan :(";
  23.  }
  24.  
  25. ?>
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