heres a random image script that i cant get working but you may find useful:
save as sig1.php
Quote:
<?
preg_match("/^(http:\/\/)?([^\/]+)/i", "$HTTP_REFERER", $matches);
$host = $matches[2];
preg_match_all("/\.([^\.\/]+)/",$host,$matches);
$matches[0][0] = $matches[1][0];
$domain = implode('',$matches[0]);
function getRandomImage($dir,$type='random')
{
global $errors;
if (is_dir($dir)) {
$fd = opendir($dir);
$images = array();
while (($part = @readdir($fd)) == true) {
clearstatcache();
if ( eregi("(gif|jpg|png|jpeg)$",$part) ) {
$images[] = $part;
}
}
if ($type == 'all') { return $images; }
srand ((double) microtime() * 1000000);
$key = rand (0,sizeof($images)-1);
return "http://qmass.ausgamers.com/ausnetwork_sig/" . $dir . $images[$key];
} else {
$errors[] = $dir.' is not a directory';
return false;
}
}
/* GAME ARENA SIG */
if ($host=="games.telstra.com" || $host=="cogs.games.telstra.com"){
echo <<<END
document.write("<img src='
END;
echo getRandomImage('gamearena/');
echo <<<END
' width='545' height='85' border='0'></td>");
END;
exit;}
/* QGL */
else if ($host=="qgl.ausforums.com"){
echo <<<END
document.write("<img src='
END;
echo getRandomImage('qgl/');
echo <<<END
' width='450' height='47' border='0'></td>");
END;
exit;}
/* AUS NS SIG */
else if ($host=="ausns.ausforums.com"){
echo <<<END
document.write("<img src='
END;
echo getRandomImage('gamearena/');
echo <<<END
' width='545' height='85' border='0'></td>");
END;
exit;}
/* AusAnime */
else if ($host=="ausanime.ausforums.com"){
echo <<<END
document.write("<img src='
END;
echo getRandomImage('qgl/');
echo <<<END
' width='450' height='47' border='0'></td>");
END;
}
else {exit;}
|