<?php
/*
 ########################################################################
#                                                                        #
#           Version 4       /                        /   /               #
#          -----------__---/__---__------__----__---/---/-               #
#           | /| /  /___) /   ) (_ `   /   ) /___) /   /                 #
#          _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___               #
#                       Free Content / Management System                 #
#                                   /                                    #
#                                                                        #
#                                                                        #
#   Copyright 2005-2006 by webspell.org                                  #
#                                                                        #
#   visit webSPELL.org, webspell.info to get webSPELL for free           #
#   - Script runs under the GNU GENERAL PUBLIC LICENSE                   #
#   - It's NOT allowed to remove this copyright-tag                      #
#   -- http://www.fsf.org/licensing/licenses/gpl.html                    #
#                                                                        #
#   Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at),   #
#   Far Development by Development Team - webspell.org                   #
#                                                                        #
#   visit webspell.org                                                   #
#                                                                        #
 ########################################################################
*/

//get files
$pic_array = Array();
$picpath = './images/userpics/';
$picdir = opendir($picpath);
while (false !== ($file = readdir($picdir))) {
   if ($file != "." && $file != ".." && $file != "nouserpic.gif" && is_file($picpath.$file)) {
   $pic_array[] = $file;
   }
}
closedir($picdir);

//sort array
natcasesort ($pic_array);
reset ($pic_array);

//get randompic
$anz = count($pic_array);
if($anz) {
 $the_pic = $pic_array[rand(0,($anz-1))];
 $picID = str_replace(strrchr($the_pic,'.'),'',$the_pic);
 echo '<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
  <td width="70" height="90"><a href="index.php?site=profile&id='.$picID.'"><img src="'.$picpath.$the_pic.'" border="0" width="60" heigth="80"></a></td>
  <td valign="top"><b>Nickname:</b><br>'.getnickname($picID).'<br><br>
  <b>registered since:</b><br>'.getregistered($picID).'<br><br>
  [ <a href="index.php?site=profile&id='.$picID.'">visit profile</a> ]</td>
 </tr>
</table>';
} else echo 'No user available.';

?>