I'm rather new to php.. I'm trying to write a script which will count the number of files with the extension .who in a certain directory. Here is what I've got so far..
$chat_room_dir = '/usr/home/web/users/a0013745/html/RodSerling/Chat/poets';
$chat_dir = dir($chat_room_dir);
$files = array();
while ($entry = $chat_dir->read())
{
if (substr($entry, 0, 3) == 'who')
$files[] = $entry;
}
$usercount = count($files);
echo 'Users currently in chat: ';
echo $usercount;
The problem is, it returns a 0 no matter what. The absolute path is correct. What am I doing wrong? I can't see it..
Further, I was trying to write something to get the info from the .who files.. Inside the file, the first line looks like this
nickname|IP address|<img> and the second line just has the nickname
I had a working perl script which would display the name and the img.. but I need it in php now and can't seem to get the dang thing to work. Anyone willing to give me a nudge in the right direction on this one?