User listing..
| From: | Daniel Lundberg | Date: | Thu, 20 Jul 2000 14:00:04 +0000 |
| Subject: | User listing.. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7402@lists.php.net to get a copy of this message | ||
Hey there.
I have a small problem here, wonder if someone have a simple solution for
it. I've made a function that does a 'exec("users", $array);' to display
the users that are logged in, on a site. So the array can contain none,
one or up to 5-6 objects.
I then want to look in the array and see what's in there, echo it to the
page and make a link to each users homepage when they are logged in.
What I've accomplished so far:
<?
function dispUsr() {
exec("users", $usr);
if (in_array("ben", $usr)) {
echo "<a href='http://www.somesite.org'>Ben</a>";
} elseif (in_array("dover", $usr)) {
echo "<a href='http://www.blah.net'>Dover</a>";
}
.....
} else {
echo "none";
}
}
?>
And further down, a 'User(s) logged in: <? dispUsr(); ?>' tag.
This works fine, as long as more than one is not logged in. Then it fails.
I haven't found any example on how this could be made, but maybe with
some help by array_slice/sizeof?
_____________________________________________
Daniel Lundberg http://www.display-umea.se
lilo@hostname.nu http://devnull.hostname.nu