SHARE
TWEET

Untitled

a guest Jun 15th, 2017 84 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. mysql_connect("$host", "$username", "$password");
  10. mysql_select_db("$db_name")or die("cannot select DB");
  11.  
  12.  
  13. $myusername=$_POST['myusername'];
  14. $mypassword=$_POST['mypassword'];
  15.  
  16.  
  17. $myusername = stripslashes($myusername);
  18. $mypassword = stripslashes($mypassword);
  19. $myusername = mysql_real_escape_string($myusername);
  20. $mypassword = mysql_real_escape_string($mypassword);
  21.  
  22. $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
  23.  
  24. $result=mysql_query($sql);
  25.  
  26.  
  27. $count=mysql_num_rows($result);
  28.  
  29.  
  30. if($count > 0){
  31.  
  32. session_register("myusername");
  33. session_register("mypassword");
  34. echo "Login Accepted";
  35. }
  36. else {
  37. echo "Wrong Username or Password";
  38. }
  39. ?>
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