Someone had requested a script that would redirect a list of ip’s to a random list of sites.

Here’s the snippet I came up with:

<?
// list of ip's you wish to redirect
$ips = array('127.0.0.1');
// Sites you wish to redirect to
$sites = array('http://yahoo.com/','http://www.aol.com');
 
foreach($ips as $ip) {
    if ($ip==GetHostByName($REMOTE_ADDR)) {
        header('Location: ' . $sites[rand(0,count($sites))]);
    }
}
?>
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • blogmarks
  • BlogMemes
  • Furl
  • NewsVine
  • Reddit
  • SphereIt
  • Spurl
  • StumbleUpon
  • Technorati
  • YahooMyWeb