Skip to content

Instantly share code, notes, and snippets.

@powdahound
Created March 28, 2012 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save powdahound/2223915 to your computer and use it in GitHub Desktop.
Save powdahound/2223915 to your computer and use it in GitHub Desktop.
Image randomizer
<?php
$image_urls = array(
'http://b.thumbs.redditmedia.com/crFh5ZpigMuuO68U.png',
'http://i.imgur.com/Boqat.png',
'http://i.imgur.com/gwfE3.png',
'http://i.imgur.com/WRBMg.png',
'http://i.imgur.com/C1fqv.png',
'http://i.imgur.com/Ycc5g.png',
'http://i.imgur.com/wsow1.png'
);
if (isset($_GET['random'])) {
// random each time
$index = array_rand($image_urls);
} else {
// changes each day
$index = date('j') % count($image_urls);
}
header('Location: '.$image_urls[$index]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment