diff options
| author | Michael Walker <mike@barrucadu.co.uk> | 2014-09-28 19:48:59 +0000 |
|---|---|---|
| committer | Michael Walker <mike@barrucadu.co.uk> | 2014-09-28 23:06:18 +0000 |
| commit | d14927b8d4404e0e34008291651fb977d930b7e7 (patch) | |
| tree | a6ad1d8a69da8fc5df2048f0c205a8bd17f2c7b1 /b.php | |
| parent | dedb017a395536ad15acf9634a6c6beb64de4c02 (diff) | |
Add random banner display
Diffstat (limited to 'b.php')
| -rwxr-xr-x | b.php | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,20 @@ +<?php +//renaming to b.php +$dir = "banners/"; +$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: no-cache, no-store, must-revalidate'); // HTTP 1.1 +header('Pragma: no-cache'); // HTTP 1.0 +header('Expires: 0'); // Proxies +header('Content-Type: ' . $fp['type']); +header('Content-Length: ' . $fp['bytes']); + +// dump the picture and stop the script +fpassthru($fp); +exit; +?> |
