View Single Post
Old 06-19-2002, 05:15 PM  
ServerGenius
Confirmed User
 
Join Date: Feb 2002
Location: Amsterdam
Posts: 9,377
Here ya go!

PHP Code:

<? 


$folder=opendir("."); 

while (
    $file = readdir($folder)
    ) 

$names[count($names)] = $file; 
closedir($folder);
sort($names);
$tempvar=0;

for ($i=0;$names[$i];$i++){
    $ext=strtolower(substr($names[$i],-4));
        if ($ext==".jpg"||$ext==".gif"||$ext=="jpeg"||$ext==".png"){
            $names1[$tempvar]=$names[$i];
            $tempvar++;
                }
        }

srand ((double) microtime() * 10000000);
$rand_keys = array_rand ($names1, 2);
$randpic=$names1[$rand_keys[0]]; 
$dimensions = GetImageSize($randpic); 

if (isset($pic)){

    header ("Location: $randpic");

    }else {

        echo "<img src=\"$randpic\" $dimensions[3]>";
    }
?>
DynaMite
__________________
| http://www.sinnerscash.com/ | ICQ: 370820 | Skype: SinnersCash | AdultWhosWho |
ServerGenius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote