SHARE
TWEET

Untitled

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