Posted: Mon Jul 08, 2002 8:31 pm
i had wondered how you guys were having random avatars. so i wrote my own code and then found this topic so i figured i'd post my code here too....
Code: Select all
<?
if($dir = opendir('avatar'))
{
while (false !== ($file = readdir($dir)))
{
if ($file != "." && $file != ".." && $file != "main.php")
{
$picturesї] = $file;
}
}
}
closedir($dir);
$rand_avatar = array_rand($pictures);
$avatar_dir = "./avatar/";
include($avatar_dir.$picturesї$rand_avatar]);
?>