artur99

Untitled

May 25th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.  
  3. if(!isset($_POST['go']) && !isset($_GET['go'])) die("ok");
  4.  
  5. $domain = "unknown.com";
  6.  
  7. if(isset($_POST['domain'])){
  8.     $domain = trim($_POST['domain']);
  9. }
  10. else if(isset($_GET['domain'])){
  11.     $domain = trim($_GET['domain']);
  12. }
  13.  
  14. $domain = substr($domain, -35);
  15.    
  16. if(!preg_match('/^[A-Za-z0-9.-_]$/' ,$domain)){
  17.     $domain = "base64:" . base64_encode($domain);
  18. }
  19.  
  20.  
  21. $ip = $_SERVER['REMOTE_ADDR'];
  22. $write_ip = true;
  23.  
  24. $handle = @fopen("clone_ips.txt", "r");
  25. if ($handle) {
  26.     while (($line = fgets($handle)) !== false) {
  27.         if(trim($line) == $ip){
  28.             $write_ip = false;
  29.             break;
  30.         }
  31.     }
  32.  
  33.     fclose($handle);
  34. } else {
  35.     $write_ip = true;
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42. if($write_ip) {
  43.     $fh = fopen("clone_list.txt", "a");
  44.     fwrite($fh, "$domain -> $ip\n");
  45.     fclose($fh);
  46.  
  47.     $fh = fopen("clone_ips.txt", "a");
  48.     fwrite($fh, "$ip\n");
  49.     fclose($fh);
  50.     echo "Ok";
  51. }
  52. else {
  53.     echo "Ok2";
  54. }
Add Comment
Please, Sign In to add comment