Parse error: parse error, unexpected T_IF, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in [my url]/forum/extensions/WhosOnline.php on line 56
had to delete it and the entry in the appg/extensions.php file.
line 56:
if (in_array($Context->SelfUrl, array("account.php", "categories.php", "comments.php", "index.php", "post.php", "search.php", "settings.php"))
I was just thinking that before stuart, it's harder to track them properly though, because the Guests could be bots/crawlers and so on which won't reflect the true number. Also I assume they could only be tracked from the main index.php page as they're anonymous they won't be able to be tracked when visiting separate pages... i don't think?
I'd love to be able to track guests, but as everything stands, it would be very difficult.
The extension works by updating/querying the DateLastActive field in the LUM_User table. Without logging in, there's not really an easy way to track a person--guests don't (and can't) have an entry in LUM_User.
The most logical way to track a guest (that I can think of off the top of my head) would be to create a new table specifically for tracking guests, and that just seems silly to me.
But if anyone's got any other ideas or suggestions for tracking guests, I'd love to hear it. I'm not unwilling to try it.
<?php
$curl_handle = curl_init();
// Where should we get the data?
curl_setopt ($curl_handle, CURLOPT_URL, 'http://www.mysite.com/extern.php?action=online');
// This says not to dump it directly to the output stream, but instead
// have it return as a string.
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 2);
// the following is optional, but you should consider setting it
// anyway. It prevents your page from hanging if the remote site is
// down.
curl_setopt ($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
// Now, YOU make the call.
$buffer = curl_exec($curl_handle);
// And tell it to shut down (when your done. You can always make more
// calls if you want.)
curl_close($curl_handle);
// This is where i’d probably do some extra checks on what i just got.
// Paranoia pays dividends.
print $buffer;
?>
David, if I decide to "phantom" but still have the who's online list in display, am I supposed to still see my own name in addition to the "1 phantom user"? I love how there's a user option for this, great work so far. Also the version numbers are reading as 1.0.2 instead of 1.0.3...
lech: I have it set up so that if you're an admin ($Context->Session->User->AdminUsers i can't remember what that is, exactly) it will show all the phantom users. That's probably why you're showing up.
As for the version number, it looks like I forgot to change the version number in the file. Whoops.
I took an in-depth look at the CURL stuff last night. It looks like punbb uses a table specifically for the who's online list. It's hard to say, exactly, since I don't have a database schema and I only have a vague understanding on how how everything is called.
ahh, alright, that makes sense then, thanks for clearing it up David! I wasn't sure whether that was a bug or not.
As for the visitor count, I say leave it out. But if you really want you have two options: create a new table or utilize a flatfile to dynamically store a count based on different IP #'s hitting the board within N minutes/seconds. I guess that might be best left for something to gauge a total server load.
Yeah, at this point, I'd like to be able to have the number of guests, but there's really not an option that I like to do it. Personally, I can live without it.
ditto. I'm currently running a closed forum, so it's totally unecessary and even when I do plan on opening things up, I don't think I want non-members edging off that extra bit of processing that could be useful for something else.
/me goes back to pinching clock cycles
David, just found a little bug that I thought you might wish to be aware of. Well, not really so much a bug but rather an issue with how this extension displays online users. I noticed that the Who's Online extension doesn't automatically display a user as online until the phantom entry is created.
specificly s:7:"Phantom";i:0;
if that string isn't found in the users setting row, the extension doesn't act and simply hides the user entirely until they actually go into their prefs and toggle phantom on then off. Best work around for this is triggering the extension upon sign-in to look to see if the user has the entry, either set to on or off, and if it doesn't exist, create it for them.
otherwise, I went through the DB by hand and added this entry for all of my users :| only 20 of them, but still, worth it to see if they're online or not.
Comments
had to delete it and the entry in the appg/extensions.php file.
line 56:
if (in_array($Context->SelfUrl, array("account.php", "categories.php", "comments.php", "index.php", "post.php", "search.php", "settings.php"))
yup, the new version gave me the same error as lament.
The new version (1.0.2) is up. Same place, etc.
The extension works by updating/querying the DateLastActive field in the LUM_User table. Without logging in, there's not really an easy way to track a person--guests don't (and can't) have an entry in LUM_User.
The most logical way to track a guest (that I can think of off the top of my head) would be to create a new table specifically for tracking guests, and that just seems silly to me.
But if anyone's got any other ideas or suggestions for tracking guests, I'd love to hear it. I'm not unwilling to try it.
clicky (scroll down to Show Users Online)
then it's just handled with a CURL:
<?php $curl_handle = curl_init(); // Where should we get the data? curl_setopt ($curl_handle, CURLOPT_URL, 'http://www.mysite.com/extern.php?action=online'); // This says not to dump it directly to the output stream, but instead // have it return as a string. curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 2); // the following is optional, but you should consider setting it // anyway. It prevents your page from hanging if the remote site is // down. curl_setopt ($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); // Now, YOU make the call. $buffer = curl_exec($curl_handle); // And tell it to shut down (when your done. You can always make more // calls if you want.) curl_close($curl_handle); // This is where i’d probably do some extra checks on what i just got. // Paranoia pays dividends. print $buffer; ?>
see it in action here (bottom left)..
As for the version number, it looks like I forgot to change the version number in the file. Whoops.
I took an in-depth look at the CURL stuff last night. It looks like punbb uses a table specifically for the who's online list. It's hard to say, exactly, since I don't have a database schema and I only have a vague understanding on how how everything is called.
Back to the drawing board, I suppose.
specificly
s:7:"Phantom";i:0;
if that string isn't found in the users setting row, the extension doesn't act and simply hides the user entirely until they actually go into their prefs and toggle phantom on then off. Best work around for this is triggering the extension upon sign-in to look to see if the user has the entry, either set to on or off, and if it doesn't exist, create it for them.