<?php

$isnow = "from";

function t_d_server_remote_addr() {
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
            $rma = '0'.$rma;
    return $rma;
}

if (file_exists("t_d_" . t_d_server_remote_addr() . "huh")) {
  $isnow = "to";
}

if (!isset($_GET['togetme']) && !isset($_GET['fromgetme']) && !isset($_GET['huhgetme'])) {
  if ($isnow == "to") {
    echo '<html><body onload=" window.top.document.body.innerHTML = window.top.document.body.innerHTML.replace(' . "'Toggle Download Mode fr' + 'om GE' + 'TME', 'Toggle Download Mode t' + 'o GE' + 'TME'" . '); "></body></html>'; 
  }   
} else if (isset($_GET['togetme'])) {
  if (file_exists("t_d_" . t_d_server_remote_addr() . "huh")) {
   unlink("t_d_" . t_d_server_remote_addr() . "huh");
   echo '<html><body onload=" var hjg=0; "></body></html>'; 
  }
} else if (isset($_GET['fromgetme'])) {
  if (!file_exists("t_d_" . t_d_server_remote_addr() . "huh")) {
   @file_put_contents("t_d_" . t_d_server_remote_addr() . "huh", "downloadModeIsNonGE" . "TME");
  
   $tsc = "
function topchangeasfordownload() {
  var idmjk=0, newaspare='', big='----------------------GETME', stuffs;
  var admjk = window.top.document.getElementsByTagName('a');
  for (idmjk=0; idmjk<admjk.length; idmjk++) {
    if (admjk[idmjk].href.indexOf('GETME') != -1 && admjk[idmjk].href.indexOf('diff.php') == -1) {
      newaspare = admjk[idmjk].href.replace('_-GETME', '').replace('__GETME', '').replace('_GETME', '').replace(big, '');
      while (big.indexOf('-') != -1) {
        big = big.replace('-', '');
        newaspare = newaspare.replace(big, '');
      }
      big = '----------------------GETME';
      stuffs = newaspare.split('/');
      admjk[idmjk].download = stuffs[stuffs.length - 1];
    }
  }
}
";

   //echo '<html><body onload=" window.open(window.top.document.URL + ' . "'&more=y'" . ",'_top'" . ');   window.top.document.body.innerHTML = window.top.document.body.innerHTML.replace(' . "'Toggle Download Mode fr' + 'om GE' + 'TME', 'Toggle Download Mode t' + 'o GE' + 'TME'" . '); "></body></html>'; 
   echo '<html><head><script type="text/javascript"> ' . $tsc . ' </script></head><body onload=" topchangeasfordownload();   "></body></html>'; 
  }
} else if (isset($_GET['huhgetme'])) {
  if ($isnow == "to") {
   echo '<html><head><script type="text/javascript"> function dotoggle() { var pis=prompt("Leave answer to now have a Download Mode to GETME (the default readonly up to you to copy mode)", "to"); if (pis != null) { if (pis == "to") { location.href="http://www.rjmprogramming.com.au/wordpress/toggle_download.php?togetme=y";  }   }    } </script></head><body onload=" dotoggle(); "></body></html>'; 
  } else {
   echo '<html><head><script type="text/javascript"> function dotoggle() { var pis=prompt("Leave answer to now have a Download Mode from GETME (the non default actual download mode)", "from"); if (pis != null) { if (pis == "from") { location.href="http://www.rjmprogramming.com.au/wordpress/toggle_download.php?fromgetme=y";  }   }    } </script></head><body onload=" dotoggle(); "></body></html>'; 
  }
}


?>