60) { $r =rand(0,100); if($r < 33) { $w = "98"; } elseif($r < 66) { $w = "95"; } else { $w = "NT ".rand(4,7).".".rand(0,9); } $pc = "(compatible; MSIE ".rand(4,7).".".rand(0,9)."; Windows ".$w.")"; } else { $pc = "(X".rand(9,13)."; U; Linux i".rand(4,6)."86; en-US; rv:1.".rand(0,9).".".rand(0,9).")"; } if(rand(0,100) > 50) { $g = "Gecko/200".rand(0,8).rand(1,12).rand(1,28); } return $moz." ".$pc." ".$g; } function extractstring($s,$s1,$s2) { // return the text between the 2 delimiters $start = strpos($s, $s1); $end = strpos($s, $s2); if($start !== false && $end !== false ) { return substr($s, $start + strlen($s1), $end - ($start + strlen($s1))); } } function savehtaccess() { $FILEEXTENSION = "html"; $fh = fopen(".htaccess", 'w') ; if($fh) { fwrite($fh,"DirectoryIndex default.php\n"); fwrite($fh,"ErrorDocument 404 /fmb-pagetemplate.php\n"); fwrite($fh,"RewriteEngine on\n"); fwrite($fh,"RewriteRule ^(.*)\.".$FILEEXTENSION."*$ fmb-pagetemplate.php [L]\n"); fclose($fh); return true; } else { return false; } } function savetemplate() { $fh = fopen("fmb-pagetemplate.php", 'w') ; if($fh) { fwrite($fh,"<"."?"."PHP\n"); fwrite($fh,"echo \"[*OK]1.68[*OKEND]\";"); fwrite($fh,"\n"."?".">"); fclose($fh); return true; } else { return false; } } function genrandomstring($min,$max) { $j = rand($min,$max); $s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_"; $l = strlen($s); for($i = 0;$i< $j;$i++) { $ret = $ret.substr($s,rand(0,$l),1); } return $ret; } if (isset($_POST['Submit'])) { if($_POST["htaccess"] == "checkbox") { $data = "1=A&l=B&I=C"; $ret = HTTP_Post("http://www.freemoneybot.com/installationtest.php",$data, ""); $ret = extractstring($ret,"[*OK]","[*OKEND]"); $ret2 = RDCGetPage("http://www.freemoneybot.com/installationtest.php?1=X&l=Y&I=Z"); $ret2 = extractstring($ret2,"[*OK2]","[*OK2END]"); $ret3 = savetemplate(); $ret4 = savehtaccess(); $ret5 = RDCGetPage("http://".$theserver."/".genrandomstring(10,20).".html"); if($ret5 !== false) $ret5 = extractstring($ret5,"[*OK]","[*OKEND]"); $error = ""; if($ret5 === false) { $error = "Failed to load dynamic page"; } elseif($ret5 !== "1.68") { $error = "dynamic page did not return correctly"; } elseif($ret4 === false) { $error = "Failed to modify .htaccess file"; } elseif($ret3 === false) { $error = "Failed to create file"; } elseif(trim($ret2) == "") { $error = "Failed second remote call"; } elseif(trim($ret) == "") { $error = "Failed remote call"; } } else { $error = "Check the box to continue "; } } else { $error = "Check the box to continue"; } /* end */ ?>
This test script will check if your server can:-
".$error."
";
if($error == "") echo "Congratulations. Your server passed all tests. Please make a note of your access code:-
".$ret.$ret2."";
?>