Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.54 KB | None | 0 0
  1. <?php
  2.     if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {echo("MSIE\n");}
  3.  elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== FALSE){echo("Trident\n");}
  4.  elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== FALSE){echo("Firefox\n");}
  5.  elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== FALSE){echo("Chrome\n");}
  6.  elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== FALSE){echo("Opera Mini\n");}
  7.  elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== FALSE){echo("Opera\n");}
  8.  elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== FALSE){echo("Safari\n");}
  9.  elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla') !== FALSE){echo("Mozilla\n");} // so our script or anything isn't viewable by google and all these browsers
  10. // Stuff lol
  11. $protocol = $_SERVER['SERVER_PROTOCOL'];
  12. $ip = $_SERVER['REMOTE_ADDR'];
  13. $port = $_SERVER['REMOTE_PORT'];
  14. $agent = $_SERVER['HTTP_USER_AGENT'];
  15. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  16. $plrIp = $_GET["Ip"];
  17. $key = $_GET["key"];
  18. $userId = $_GET["UserId"];
  19. $userName = $_GET["UserName"];
  20. // File Positions
  21. $Keys = 'KeysAndIps/Important/ActualKeys.txt';
  22. $Logger = 'KeysAndIps/Important/AllLogs.txt';
  23. $UsedKeys = 'KeysAndIps/UsedKeys.txt';
  24. $WhitelistedIps = 'KeysAndIps/WhitelistedIps.txt';
  25.    
  26.  // Contents
  27. $Cont1 = file_get_contents($Keys);
  28. $Cont2 = file_get_contents($Logger);
  29. $Cont3 = file_get_contents($UsedKeys);
  30. $Cont4 = file_get_contents($WhitelistedIps);
  31.  
  32. // IN THE EVENT OF SOMEONE CRACKING YOUR SCRIPT, SET THIS TO TRUE
  33. $lol_nah = false;
  34.  
  35. // You can remove the lines with file_put_contents but I would keep them because they log everything. They are important to keep track of what's happening and for security.
  36. if ($lol_nah === true) {
  37.     echo "lol nah";
  38.     file_put_contents($Logger, "\n".date('h:i:s A, m/d/y')." \nUser tried to login but whitelist disabled. He/She used the following: \nKey: ".$key." \nIp: ".$plrIp." \nUsername: ".$userName." \nUserid: ".$userId." \n---------------------------------------------", FILE_APPEND | LOCK_EX);
  39.     exit();
  40. }
  41.  
  42. if (strpos($Cont1, $key) !== false) { // Checks if the key is a valid key
  43.     if (strpos($Cont3, $key) === false) { // Checks if the key hasn't already been used
  44.         file_put_contents($WhitelistedIps, "$plrIp\n", FILE_APPEND | LOCK_EX); // Whitelists the ip
  45.         file_put_contents($UsedKeys, "$key\n", FILE_APPEND | LOCK_EX); // Puts the key in the file of all the used keys meaning it cant be used on a different ip again
  46.         file_put_contents($Logger, "\n".date('h:i:s A, m/d/y')." \nUser logged in succesfully with the following: \nKey: ".$key." \nIp: ".$plrIp." \nUsername: ".$userName." \nUserid: ".$userId." \n---------------------------------------------", FILE_APPEND | LOCK_EX);
  47.         echo "Whitelisted";
  48.         exit();
  49.     } else { // The key has already been used
  50.         file_put_contents($Logger, "\n".date('h:i:s A, m/d/y')." \nUser failed to login. Reason: Key already used. He/She used the following: \nKey: ".$key." \nIp: ".$plrIp." \nUsername: ".$userName." \nUserid: ".$userId." \n---------------------------------------------", FILE_APPEND | LOCK_EX);
  51.         echo "Not Whitelisted";
  52.         exit();
  53.     }
  54. } else { // The key is incorrect
  55.     file_put_contents($Logger, "\n".date('h:i:s A, m/d/y')." \nUser failed to login. Reason: Incorrect key used. He/She used the following: \nKey: ".$key." \nIp: ".$plrIp." \nUsername: ".$userName." \nUserid: ".$userId." \n---------------------------------------------", FILE_APPEND | LOCK_EX);
  56.     echo "Not WHitelisted";
  57.     exit();
  58. }
  59. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement