PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
kaizix
Forum Commoner
Posts: 50 Joined: Tue Jun 18, 2002 9:16 pm
Location: california
Contact:
Post
by kaizix » 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]);
?>
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Fri Apr 25, 2003 8:35 pm
i got one now too~