tag or * an @import directive in your CSS. * 3. change the CSS reference at the end of this file to the correct * id or class to apply the image to. */ $str_imagepath = "/images/headers/"; // include leading and trailing slash! header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0",false); header("Pragma: no-cache"); header("Content-Type: text/css"); header("X-ArrestedDevelopment: Gob Bluth- I'm a failure. I can't even fake the death of a stripper."); if(isset($_COOKIE['header_image'])){ $cookie_str_image = $_COOKIE['header_image']; }else{ $cookie_str_image = false; } if($cookie_str_image){ $str_headerimg = $str_imagepath.$cookie_str_image; }else{ $int_headercount = 0; $arr_headers = array(); if($handle=opendir($_SERVER['DOCUMENT_ROOT'].$str_imagepath)){ while(false!==($file=readdir($handle))){ if(stristr($file,'.png') || stristr($file,'.jpg') || stristr($file,'.gif')){ $arr_headers[$int_headercount]=$file; $int_headercount++; } } closedir($handle); } srand(); $int_rand = rand(0,count($arr_headers)-1); $str_image = $arr_headers[$int_rand]; setcookie('header_image',trim($str_image)); $str_headerimg = $str_imagepath.$str_image; } ?> /* adjust this to be the CSS class or id or whatever you need. */ div#header { background-image : url(); }