I store most of my img data in a db and then take it from there. For something like this, I would just hard code something like (just an example, with db object, untested):
function getRandAdvertIMG ($min, $max) {
$img_num = rand($min, $max);
$res = $db->doQuery("SELECT * FROM site_img_advert WHERE id = '".$rand_num."'");
while ($img = $db->doArray($res, 1)) {
echo "<img src=\"".$img['img_address']."\" alt=\"".$img['img_name']."\">";
}
}
This is just a throw together, but it's pretty straight forward. The '$min, $max' vars are needed for the number gen, then changes the query string. Results in the image being output to screen. Obviously this is a very basic example, with no logging, page clicks all that jazz, but you get the idea. Can be expanded on very easily. I find this easier, but that's just me.