SHARE
TWEET

Untitled

a guest Jun 15th, 2017 50 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")or die("cannot connect");
  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. $result=mysql_query($sql);
  24.  
  25.  
  26. $count=mysql_num_rows($result);
  27.  
  28.  
  29. if($count==1){
  30.  
  31. session_register("myusername");
  32. session_register("mypassword");
  33. echo "Login Accepted";
  34. }
  35. else {
  36. echo "Wrong Username or Password";
  37. }
  38. ?>
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