randimage.php
<?php
/*
+---------------------------------------------------------+
| by Bleakwind http://www.weaverdream.com
+---------------------------------------------------------+
*/
$dir = "images/";//Picture catalog, notice is sorted by name ...
$imgwidth = 0;//Picture width, 0 is the original size
$iforder = 1;//or random display, 1 for sequential display, 0 for random display
$ifcircle = 0;//in sequential display, 1 for loop playback, 0 for not cycle
Session_Start ();
if ($imgwidth ==0) {$imgwidth = = "";} else{$imgwidth = = "Width= '". $imgwidth. "'";}
$handle =opendir ($dir);
while ($file _name=readdir ($handle)) {
if ($file _name!== ".") && ($file _name!== "...")) {$file _list[]= $file _name;}
}
Closedir ($handle);
if ($iforder ==1) {
if (Isset ($_session[' Sess_order ')) {
if ($_session[' Sess_order ']<count ($file _list)-1) {
$_session[' Sess_order ']++;
}else{
if ($ifcircle = = 1) {
$_session[' Sess_order ']=0;
}
}
}else{
$_session[' Sess_order ']=0;
}
$i =$_session[' Sess_order '];
}else{
$num =count ($file _list)-1;
$i =rand (0, $num);
}
ReadFile ($dir. $file _list[$i]);
?>
Call