Archive

Posts Tagged ‘php’

Randomly Redirect

April 14th, 2009 No comments

So, I recently had a need to randomly redirect a page on occasion…don’t ask.


< ?php
$case = mt_rand(1,100);
switch($case) {
    case 42:
        $url = "http://notalwaysright.com/?random";
        break;
    case 13:
        $url = "http://icanhascheezburger.com/?random";
        break;
    case 66:
        $url = "http://dynamic.xkcd.com/comic/random/";
        break;
    case 73:
        $url = "http://bash.org/?random";
        break;
    case 100:
        $url = "http://linux.die.net/man/4/random";
        break;
    default:
        $url = "http://www.google.com/";
}
header("Location: " . $url);
?>

Categories: Coding Tags: , ,

dork-e.com is Stephen Fry proof thanks to caching by WP Super Cache