lainchan/b.php

22 lines
610 B
PHP
Raw Normal View History

2014-09-28 15:48:59 -04:00
<?php
//renaming to b.php
$dir = "banners/";
$files = scandir($dir);
$images = array_diff($files, array('.', '..'));
$name = $images[array_rand($images)];
// snags the extension
$img_extension = pathinfo($name, PATHINFO_EXTENSION);
2014-09-28 15:48:59 -04:00
// send the right headers
header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1
header('Pragma: no-cache'); // HTTP 1.0
header('Expires: 0'); // Proxies
header("Content-type: image/" . $img_extension);
header("Content-Disposition: inline; filename=" . $name);
2014-09-28 15:48:59 -04:00
// readfile displays the image, passthru seems to spits stream.
readfile($dir.$name);
2014-09-28 15:48:59 -04:00
exit;
?>