Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {echo("MSIE\n");}
- elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== FALSE){echo("Trident\n");}
- elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== FALSE){echo("Firefox\n");}
- elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== FALSE){echo("Chrome\n");}
- elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== FALSE){echo("Opera Mini\n");}
- elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== FALSE){echo("Opera\n");}
- elseif(strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== FALSE){echo("Safari\n");}
- 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
- // Stuff lol
- $protocol = $_SERVER['SERVER_PROTOCOL'];
- $ip = $_SERVER['REMOTE_ADDR'];
- $port = $_SERVER['REMOTE_PORT'];
- $agent = $_SERVER['HTTP_USER_AGENT'];
- $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
- $plrIp = $_GET["Ip"];
- $key = $_GET["key"];
- $userId = $_GET["UserId"];
- $userName = $_GET["UserName"];
- // File Positions
- $Keys = 'KeysAndIps/Important/ActualKeys.txt';
- $Logger = 'KeysAndIps/Important/AllLogs.txt';
- $UsedKeys = 'KeysAndIps/UsedKeys.txt';
- $WhitelistedIps = 'KeysAndIps/WhitelistedIps.txt';
- // Contents
- $Cont1 = file_get_contents($Keys);
- $Cont2 = file_get_contents($Logger);
- $Cont3 = file_get_contents($UsedKeys);
- $Cont4 = file_get_contents($WhitelistedIps);
- // IN THE EVENT OF SOMEONE CRACKING YOUR SCRIPT, SET THIS TO TRUE
- $lol_nah = false;
- // 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.
- if ($lol_nah === true) {
- echo "lol nah";
- 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);
- exit();
- }
- if (strpos($Cont1, $key) !== false) { // Checks if the key is a valid key
- if (strpos($Cont3, $key) === false) { // Checks if the key hasn't already been used
- file_put_contents($WhitelistedIps, "$plrIp\n", FILE_APPEND | LOCK_EX); // Whitelists the ip
- 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
- 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);
- echo "Whitelisted";
- exit();
- } else { // The key has already been used
- 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);
- echo "Not Whitelisted";
- exit();
- }
- } else { // The key is incorrect
- 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);
- echo "Not WHitelisted";
- exit();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement