All pastes #194333 Raw Edit

Aeon

public php v1 · immutable
·published 2006-10-07 20:21 UTC
rendered paste body
<?php// an array of available wallpapers // in your case, you fetch it from a directory listing; here I just define an array for simplicity$wallpapers = ('1.jpg','2.jpg','3.jpg');// check if a new wallpaper was requested, if it was, and it is a valid wallpaper, // set the $wallpaper variable to it, otherwise set the wallpaper to be the first// out of the $wallpapers array.$wallpaper = isset($_REQUEST['wallpaper']) && in_array($_REQUEST['wallpaper'], $wallpapers) ? $_REQUEST['wallpaper'] : $wallpapers[0];foreach($wallpapers as $image){    $wallpaper_links[] = '<a href="index.php?wallpaper='.$image.'"><img src="/wallpapers/'.$image.'"></a>';}?><html><body style="background-image: url(<?php echo $wallpaper?>);"><?php// loop through available wallpapers and show the link with an image file// in your example, you do this in an included file, and print out a table // here I print just a list for simplicityforeach($wallpaper_links as $link){    echo $link;}?></body></html>