Who's Uploading Now - RoboRumble@Home\r\n";
$socket = fsockopen("rumble.fervir.com", 80);
echo "
Uploaders for the last $CONTENTS_SIZE bytes:
";
if (!$socket){
echo "
Opening of socket failed.";
exit();
}
$file = "http://".$server."/rumble/rankings/battles_".$robotGame.".txt";
$filesize = remote_filesize($file);
if ($filesize == "unknown") echo "Error during transmission. Please check to see whether the game name is valid or the RR@H server is down.
";
echo "Reading Range: " . ($filesize-$CONTENTS_SIZE) . " to " . $filesize . "
";
echo "RoboRumble
";
echo "MeleeRumble
";
echo "TeamRumble
";
echo "All other Rumbles
";
$msg = "GET /rumble/rankings/battles_".$robotGame.".txt HTTP/1.1" . "\r\n" . "Host: " . $server . "\r\n" . "Range: bytes=" . ($filesize-$CONTENTS_SIZE) . "-" . "\r\n" . "User-Agent: WhoseUploadingPHPversion/1.1" . "\r\n" . "Accept: */*" . "\r\n" . "Referer: http://" . $server . "/rumble/rankings/battles_".$robotGame.".txt" . "\r\n" . "Accept-Encoding: " . "\r\n" . "" . "\r\n";
fwrite($socket, $msg);
$contents = "";
while (strlen($contents)<($CONTENTS_SIZE+150)) {
$curr = fgets($socket, 2500);
$contents = $contents . $curr;
}
fclose($socket);
$contents = str_replace('\r', '\n', $contents);
$contents = str_replace('\n\n', '\n', $contents);
$contents = substr($contents, strpos($contents, 'Content-Length: ')+16+strlen($CONTENTS_SIZE));
$param = explode('35,', $contents);
$param = '35,'.substr($param[1], 0, 5);
echo $param."
";
$arrayDat = explode($param, $contents);
$names = "";
$countEr1234 = 0;
foreach($arrayDat as $value) {
if ($countEr1234 == 0) $countEr1234 = 1;
else {
$value2 = explode(',', $value);
$names = $names . $value2[1] . "|";
}
}
$nameArray = explode("|", $names);
$nameArray = array_unique($nameArray);
implode("", $nameArray);
#var_dump($nameArray);
echo "";
foreach($nameArray as $value){
echo "- " . $value . "
";
}
echo "
";
echo "End Of Output
";
exit();
function remote_filesize($url, $user = "", $pw = "") {
ob_start();
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
if(!empty($user) && !empty($pw)) {
$headers = array('Authorization: Basic ' . base64_encode("$user:$pw"));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}
$ok = curl_exec($ch);
curl_close($ch);
$head = ob_get_contents();
ob_end_clean();
$regex = '/Content-Length:\s([0-9].+?)\s/';
$count = preg_match($regex, $head, $matches);
return isset($matches[1]) ? $matches[1] : "unknown";
}