SHARE
TWEET

Untitled

a guest Jun 15th, 2017 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $host="localhost"; // Host name
  3. $username="test"; // Mysql username
  4. $password="pocakaj"; // Mysql password
  5. $db_name="game"; // Database name
  6. $tbl_name="game"; // Table name
  7.  
  8. // Connect to server and select databse.
  9. $connection = new mysqli($host, $username, $password, $db_name);
  10.  
  11. $myusername=$_POST['myusername'];
  12. $mypassword=$_POST['mypassword'];
  13.  
  14. //Should really just turn off magic quotes
  15. $myusername = stripslashes($myusername);
  16. $mypassword = stripslashes($mypassword);
  17.  
  18.  
  19. $query = "SELECT * FROM $tbl_name WHERE username=? and password=?";
  20. $stmt = $connection->prepare($query);
  21. $stmt->bind_param('ss', $myusername, $mypassword);
  22. $stmt->execute();
  23. if($stmt->num_rows > 0){
  24.  
  25. session_register("myusername");
  26. session_register("mypassword");
  27. echo "Login Accepted";
  28. }
  29. else {
  30. echo "Wrong Username or Password";
  31. }
  32. ?>
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top