You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
597 B
PHP
23 lines
597 B
PHP
<?php
|
|
if(!isset($root)){ // handling if you're looking at the literal bg.php page - it's not being loaded by another page
|
|
$root = "../";
|
|
}
|
|
|
|
$dir = $root."images/backgrounds/";
|
|
$files = scandir($dir);
|
|
$images = array_diff($files, array('.', '..'));
|
|
$name = $images[array_rand($images)];
|
|
// open the file in a binary mode
|
|
$fp = fopen($dir . $name, 'rb');
|
|
|
|
// send the right headers
|
|
header('Cache-Control: public'); // HTTP 1.1
|
|
header('Pragma: cache'); // HTTP 1.0
|
|
header('Expires: 0'); // Proxies
|
|
header('Content-Type: image/gif');
|
|
|
|
// dump the picture and stop the script
|
|
fpassthru($fp);
|
|
exit;
|
|
?>
|