Advertisement
Guest User

Untitled

a guest
Aug 5th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.06 KB | None | 0 0
  1. <?php
  2. include "config.php";
  3. mysql_connect($location,$databaseuser,$databasepass);
  4. @mysql_select_db($database) or die( "Unable to select database"); //Connects to database
  5. $username = $_GET['username']; //gets username from url
  6. $password = $_GET['password']; //gets password from url
  7. $hwid = $_GET['hwid']; //gets HWID from url
  8. $time = $_GET['time']; //gets username from url
  9. $username = stripslashes($username); //MySQL Injection Protection
  10. $username = mysql_real_escape_string($username); //MySQL Injection Protection
  11. $password = stripslashes($password); //MySQL Injection Protection
  12. $password = mysql_real_escape_string($password); //MySQL Injection Protection
  13. $hwid = stripslashes($hwid); //MySQL Injection Protection
  14. $hwid = mysql_real_escape_string($hwid); //MySQL Injection Protection
  15. $time = stripslashes($time); //MySQL Injection Protection
  16. $time = mysql_real_escape_string($time); //MySQL Injection Protection
  17. $date = date('Y-m-d H:i:s', time());
  18. if($username==""){ //if username is blank, then show the blank username error
  19. echo $blankuser;
  20. }elseif($password=="D4-1D-8C-D9-8F-00-B2-04-E9-80-09-98-EC-F8-42-7E"){ //if password is blank, then show the blank password error
  21. echo $blankpass;
  22. }elseif($hwid==""){ //If the HWID is blank then show this error
  23. echo $blankhwid;
  24. }elseif($time==""){
  25. echo "This was not posted through the application.";
  26. }else{ //Goes here if every information required is filled with some info
  27. $sql="SELECT * FROM Users WHERE username='$username' and password='$password' and hwid='$hwid'"; //tries logging in
  28. $result=mysql_query($sql);
  29. $count=mysql_num_rows($result);
  30. if($count==1){ //goes here if logged in successfully
  31. $expires = mysql_query("SELECT Expires FROM Users WHERE username='$username' AND password='$password' AND hwid='$hwid'");
  32. while($expiresdata = mysql_fetch_assoc($expires)) { //gets data to see expiration date of user
  33. $dateexpired = $expiresdata["Expires"]; //gets the expired date
  34. }
  35.  
  36. $blacklistdata = mysql_query("SELECT Blacklisted FROM Users WHERE username='$username' AND password='$password' AND hwid='$hwid'");
  37. while($blacklist = mysql_fetch_assoc($blacklistdata)) { //gets data to see if user is blacklisted
  38. $blacklisted = $blacklist["Blacklisted"]; //gets the result
  39. }
  40.  
  41. $blacklisted = strtolower($blacklisted);
  42. $banreasondata = mysql_query("SELECT CustomReason FROM Users WHERE username='$username' AND password='$password' AND hwid='$hwid'");
  43. while($banreasoninfo = mysql_fetch_assoc($banreasondata)) { //gets the data of the custom ban message
  44. $banreason = $banreasoninfo["CustomReason"]; //gets the result
  45. }
  46.  
  47. $today = date("Y-d-m"); //gets today's date
  48. $today = strtotime($today); //changes it into time
  49. $expiration_date = strtotime($dateexpired); //changes the date of expiration into time
  50.  
  51. if($expiration_date > today){ //if your not expired then
  52. if($blacklisted=="yes"){ //if your blacklisted then
  53. echo $blacklistedmessage . $banreason; //showing blacklisted/banned message
  54. }else{ //if your not expired or blacklisted
  55. $date = date('Y-m-d H:i:s', time());
  56. $crypted = sha1($hwid . $time);
  57. mysql_query("UPDATE Users SET Signed_in = '$date'
  58. WHERE UserName = '$username' AND Password = '$password' AND HWID = '$hwid'");
  59. mysql_query("INSERT INTO Logged_in (username, hwid, logged_in, time)
  60. VALUES ('$username', '$hwid', 'Yes', '$date')");
  61. echo $crypted;  //your validated, everything is correct
  62. }
  63. }else{ //your expired
  64. if($blacklisted=="yes"){ //are you expired and black listed?
  65. mysql_query("INSERT INTO Logged_in (username, hwid, logged_in, time)
  66. VALUES ('$username', '$hwid', 'No - Showed expired + ban message', '$date')");
  67. echo $licenseexpired . "\n" . $blacklistedmessage . $banreason; //shows licensed expired and ban message
  68. }else{ //Your licensed expired, but your not banned
  69. mysql_query("INSERT INTO Logged_in (username, hwid, logged_in, time)
  70. VALUES ('$username', '$hwid', 'No - Showed expired message', '$date')");
  71. echo $licenseexpired;
  72. }
  73. }
  74. }else{
  75. mysql_query("INSERT INTO Logged_in (username, hwid, logged_in, time)
  76. VALUES ('$username', '$hwid', 'No - Error logging in', '$date')");
  77. echo $errorlogin;
  78. }
  79. }
  80. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement