New Snippet: Users Online

Schwarzlicht

hello, I would like each group to display the user behind the name. How can I do that?

Argos

Thanks for your answer Ruud. Personally I think just the other way round: this is typically a function for single use on a site, and I suggested a droplet because it's more easy for both me and clients :-) 
But adding a droplet based on first installing a snippet sounds a bit like double work... It's not that important (for me) anyway.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Ruud

since this is typically a function to be used on all pages in your website, I do not see the big difference in adding
<?php UsersOnline(); ?> 
instead of
[[UsersOnline]]

On the other hand, you can always create a droplet that captures the output of the snippet..
Code (Droplet:UsersOnline (remember to install the snippet first) ) Select
<?php
ob_start
();
UsersOnline();
$users ob_get_contents();
ob_end_clean();
return 
$users;
?>

Note: the dropletcode above is not tested!

[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

Argos

Would be nice if this could be a user friendly droplet [[UsersOnline]]  :-D
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Bramus

Hmm looks like a usefull script for only the home page as that is what we want to count. I'm gonna look into it and see if we can use it for a new website!

Thanks :)
BRAMUS Internet Services

Ruud

Isn't that the same a the simple pagecounter?
In that script the counter per page is updated once per session.
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

Bramus

Is it possible to modify the counter so it can also show the total visitors?

Like adding a field that contains the total visitors and each time a new visitor is on the website (home page) it does +1 ?
BRAMUS Internet Services

WDStudio


Ruud

The snippet uses the php->date() function to display the timestamp.
The timezone used is whatever is setup in the php configuration, or the webserver itself.

A function like this could be added to the snippet to change the output to a different timezone.
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

WDStudio

How can I set timezone (GMT +1) for this module?

Stefek

Hello Ruud,
thanks for your hints, and yes, reading your explanations I agree with ...

Quote from: Ruud on December 07, 2009, 10:40:51 PM
I think this is not te best project to start learning PHP coding.

And if you find some time it would be a very nice extension for this snippet.

Kind regards,
Stefek

[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Ruud

To do that it will need an extra field in the counter table.
A simple check on the session variable could be done to see if the current user is logged in.
A bit more logic will be needed to query the table to produce the correct counters.
Some extra parameters will be needed to be accepted to display more text fragments.

If I find some time the next few days, I will have a look to see if I can add this feature.
I think this is not te best project to start learning PHP coding.

R
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

Stefek

Hello Ruud,

I am going to use this nice snippet on a project.

It's very nice but I would like to show something like:
currently 35 users online | 15 logged in and 20 visitors.

Could this be implemented somehow?

Maybe you can give me some hints, so I can learn and do the rest myself (with some help).

Kind regards,
Stefek

[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Vasiliy

Good evening!
I put this module on my website.
http://validator.w3.org/check found a lot of mistakes.
I have corrected all the errors.
You should find the file include.php and replace this code:

Quoteif ($use_tooltip != 0) {
       while($res = $counter_res->fetchRow()) {
           if ($admin_ip == $ipaddress)
               $userlist .= date("H:i:s",$res['timestamp'])." [".$res['ip']."] ".$res['page']." (".$res['page_title'].") ".bot($res['user_agent'])."<br/>";
           else
               $userlist .= date("H:i:s",$res['timestamp'])." - ".$res['page']." (".$res['page_title'].")<br/>";
       }
       echo '<SCRIPT language="JavaScript1.2" src="'.WB_URL.'/modules/usersonline/overlib_mini.js" type="text/javascript"></SCRIPT>';
       echo "<span href=\"javascript:void(0);\" onmouseover=\"return overlib('$userlist',HAUTO,VAUTO,WIDTH,600,BGCOLOR,'#FFFFFF',FGCOLOR,'#FFFFFF',BORDER,5,WRAP);\" onmouseout=\"return nd();\">";
   }
   if($user == 1) {
       echo $prefix.$user.$single;
   } else {
       echo $prefix.$user.$suffix;
   }
   if ($use_tooltip != 0)
       echo "</span>";
and put the following code:

Quoteif ($use_tooltip != 0) {
       while($res = $counter_res->fetchRow()) {
           if ($admin_ip == $ipaddress)
               $userlist .= date("H:i:s",$res['timestamp'])." [".$res['ip']."] ".$res['page']." (".$res['page_title'].") ".bot($res['user_agent'])."&lt;br />";
           else
               $userlist .= date("H:i:s",$res['timestamp'])." - ".$res['page']." (".$res['page_title'].") &lt;br />";
       }
       echo '<script language="JavaScript1.2" src="'.WB_URL.'/modules/usersonline/overlib_mini.js" type="text/javascript"></script>';
       echo "<a href=\"javascript:void(0);\" onmouseover=\"return overlib('$userlist',HAUTO,VAUTO,WIDTH,600,BGCOLOR,'#FFFFFF',FGCOLOR,'#FFFFFF',BORDER,5,WRAP);\" onmouseout=\"return nd();\">";
   }
   if($user == 1) {
       echo $prefix.$user.$single;
   } else {
       echo $prefix.$user.$suffix;
   }
   if ($use_tooltip != 0)
       echo "</a>";    

Hans>NULL

#20
Ok, then a another message  :evil:
xhtml-Error:
   <p id="usersonline"><script language="JavaScript1.2" src="http://127.0.0.1:4001/wb28/modules/usersonline/overlib_mini.js" type="text/javascript"></script><span href="javascript:void(0);" onmouseover="return overlib('23:13:06 [127.0.0.1] /wb28/ (Home)  - Firefox<br/>',HAUTO,VAUTO,WIDTH,600,BGCOLOR,'#FFFFFF',FGCOLOR,'#FFFFFF',BORDER,5,WRAP);" onmouseout="return nd();">1 Besucher Online: </span> </p>

The "href" attribute is not valid for the "span" element.

Regards, Hans>NUL

Edit: Currently I am testing a few Snippets & Modules
/dev/null Ort ohne Wiederkehr

crnogorac081

I got the same notification in PM module i built. I think it is just a note, not an error..

For example, If my hosting server is in US and I am in europe, I will set timezone to my local timezone in europe.. :) So its stupit to use same timezone from US , right ? I belive this is it...

If I am wrong someone please tell us what to do :))

cheers
Web developer

Hans>NULL

#18
Hi
Get an error when setting  E_Strict
Strict Standards: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /www/modules/usersonline/include.php on line 38

Regards, Hans>NUL
/dev/null Ort ohne Wiederkehr


mracon

Where can I download the zip file, the download link takes me here.

bupaje

That is a different script now - not very accurate either it seems. :)

vyni

Hi,

right now I had a look, and everything looks good to me.



[gelöscht durch Administrator]

bupaje

No, they didn't say which ones. everything else seems normal. Very starnge.

I was able to implement this script found online

http://ronsguide.com/php/online/2/

and it outputs normally on my test page. It writes to a flatfile database if that sheds any light.

Ruud

Yes, there is a grey block at the bottom of the page.

The more info just compares ip addresses as strings. That cannot be an issue.
The other script is totally different, not using IP adresses, not using database. It's very strange both of the scripts don't work.

Database communication still works (you would not have pages if it didn't)
Can you still create or update normal pages?

Did Yahoo tell what features were disabled?

Ruud
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

bupaje

Must be something Yahoo webhosting changed. I got a message today that they disabled some features because I got a new credit card number and forgot to tell them, so they couldn't charge me. Maybe that did it though everything else seems to work.

I tried to run it out of WB in a php page no luck. I also tried another script I found online that counts sessions as an alternative

http://www.devarticles.com/c/a/PHP/The-Quickest-Way-To-Count-Users-Online-With-PHP/1/

and no luck.

Hmm... just curious I use opendns.org - is it possible that somehow blocks access to my 'more info' ip that your snippet is looking for. In other words maybe only I cannot see it? I just added the code back, can you see the little gray box with user info at the bottom?

http://www.stormvisions.com/pages/home.php




Ruud

Quote from: bupaje on November 14, 2008, 07:40:15 PM
Has anyone had any problems with this? It has been working fine when suddenly today the page stops loading at this call

<?php UsersOnline("Currently: " " visitors viewing this page" " visitor viewing this page") ; ?>

Is it still displaying anything?
Did you try to set the error reporting (advanced admin settings) to display all errors to see if it tells something?

I have it running on my site since day one without problems.

Ruud
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]