WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • New Snippet: Users Online
  • Print
Pages: [1] 2   Go Down

Author Topic: New Snippet: Users Online  (Read 35257 times)

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
New Snippet: Users Online
« on: August 22, 2008, 04:30:19 PM »
In the series fun snippets, here is the Users Online snippet.

It displays a simple line that says "Currently: 21 users online".
Hovering over the line a tooltip popup will display a timestamp and the page that is being viewed.
When called with your "admin" IP address it will also display the IP address of the visitors and if it is called by a searchbot. (experimental bot detection).

See the snippet in action on http://www.wbhulp.nl (Dutch website) in the right top of the page.

Installation:

Install the zipfile as a normal module through the WB backend.
Add the php code to your template index.php.


Using the snippet:
Code: [Select]
<?php UsersOnline(); ?>    

Optional parameters: <?php UsersOnline( $use_tooltip, $prefix , $suffix , $single , $admin_ip ) ?>

  $use_tooltip = Adds a small javascript to display a hovering tooltip with details of the current connections. (default := 1, 0 no tooltip)
  $prefix = The text in front of the user counter. ( default := "Currently: " )
  $suffix = The text after the user counter when there is more than one user online. (default = " users online")
  $single = The text after the user counter when there is just one user online. (default = " user online")
  $admin_ip = The IP address that will see more details. Details are IP address and browser name (if detected) (default := "127.0.0.1")

Customised Example: <?php UsersOnline(1 , "Online: " , " users" , " user", "192.168.0.1" ) ; ?>

Have fun with it.

Ruud

[gelöscht durch Administrator]
« Last Edit: January 07, 2011, 11:27:51 PM by Ruud »
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

erpe0812

  • Guest
Re: New Snippet: Users Online
« Reply #1 on: August 22, 2008, 05:11:21 PM »
Hi Ruud,

want to invite you to work with us on this project:

http://www.websitebakers.com

We are just a half step behind (or in front of) the start line....

rgds

erpe
« Last Edit: November 12, 2008, 03:16:51 PM by erpe »
Logged

aldus

  • Guest
Re: New Snippet: Users Online
« Reply #2 on: August 23, 2008, 06:06:52 PM »
Hello Ruud

A nice one, and on a first look, clean as fresh fallen snow ;-)

But there are some unnessesary spaces instead of tabs,
seen in the attachment ... hard work for the preprocessor

Regards
Aldus

[gelöscht durch Administrator]
Logged

pfreud01

  • Guest
Re: New Snippet: Users Online
« Reply #3 on: September 09, 2008, 04:09:36 PM »
is it possible to display the name of registered users online in this snippet? i don´t know to manage it.

best regards, pfreud01
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Snippet: Users Online
« Reply #4 on: September 09, 2008, 04:17:45 PM »
No,

The data recorded by the snippet does not include that.
So it is not possible to display.

Maybe in a future version.

Ruud
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline bupaje

  • Posts: 592
Re: New Snippet: Users Online
« Reply #5 on: September 18, 2008, 04:20:15 AM »
Dumb question but is this registered users only, or total online users? Also if total users can it can be modified to show an image for every x amount of users with the numbers?

I was thinking it might be cool to create something like little characters, possibly with simple gif animations, hanging out in the stat box as a visual representation of how many users are online.
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Snippet: Users Online
« Reply #6 on: September 18, 2008, 09:28:02 AM »
Quote from: bupaje on September 18, 2008, 04:20:15 AM
Dumb question but is this registered users only, or total online users?

It's total users. (and bots)

Quote from: bupaje on September 18, 2008, 04:20:15 AM
Also if total users can it can be modified to show an image for every x amount of users with the numbers?

I was thinking it might be cool to create something like little characters, possibly with simple gif animations, hanging out in the stat box as a visual representation of how many users are online.

It's open source. Be my guest. 8-)

Ruud
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline bupaje

  • Posts: 592
Re: New Snippet: Users Online
« Reply #7 on: September 18, 2008, 04:01:14 PM »
Thanks Ruud. :)
Logged

Offline bupaje

  • Posts: 592
Re: New Snippet: Users Online
« Reply #8 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

Code: [Select]
<?php UsersOnline(1 , "Currently: " , " visitors viewing this page" , " visitor viewing this page") ; ?>
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Snippet: Users Online
« Reply #9 on: November 14, 2008, 11:04:27 PM »
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

Code: [Select]
<?php UsersOnline(1 , "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
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline bupaje

  • Posts: 592
Re: New Snippet: Users Online
« Reply #10 on: November 14, 2008, 11:33:22 PM »
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



Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Snippet: Users Online
« Reply #11 on: November 14, 2008, 11:59:16 PM »
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
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline bupaje

  • Posts: 592
Re: New Snippet: Users Online
« Reply #12 on: November 15, 2008, 12:08:28 AM »
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.
Logged

vyni

  • Guest
Re: New Snippet: Users Online
« Reply #13 on: November 15, 2008, 02:23:20 PM »
Hi,

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



[gelöscht durch Administrator]
Logged

Offline bupaje

  • Posts: 592
Re: New Snippet: Users Online
« Reply #14 on: November 15, 2008, 04:39:11 PM »
That is a different script now - not very accurate either it seems. :)
Logged

mracon

  • Guest
Re: New Snippet: Users Online
« Reply #15 on: August 22, 2009, 12:18:58 PM »
Where can I download the zip file, the download link takes me here.
Logged

erpe0812

  • Guest
Re: New Snippet: Users Online
« Reply #16 on: August 22, 2009, 12:28:04 PM »
Users Online


rgds

erpe
Logged

StudioVerlag

  • Guest
Re: New Snippet: Users Online
« Reply #17 on: September 14, 2009, 08:53:53 PM »
Hi
Get an error when setting  E_Strict
Code: [Select]
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
« Last Edit: September 14, 2009, 09:03:15 PM by Hans>NULL »
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: New Snippet: Users Online
« Reply #18 on: September 14, 2009, 10:12:48 PM »
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
Logged
Web developer

StudioVerlag

  • Guest
Re: New Snippet: Users Online
« Reply #19 on: September 14, 2009, 11:27:13 PM »
Ok, then a another message  :evil:
xhtml-Error:
Code: [Select]
   <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
« Last Edit: September 15, 2009, 02:43:24 PM by Hans>NULL »
Logged

Offline Vasiliy

  • Posts: 35
  • Gender: Male
Re: New Snippet: Users Online
« Reply #20 on: December 03, 2009, 10:39:15 PM »
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:

Quote
   if ($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:

Quote
   if ($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>";    
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: New Snippet: Users Online
« Reply #21 on: December 07, 2009, 06:32:53 PM »
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

Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Snippet: Users Online
« Reply #22 on: December 07, 2009, 10:40:51 PM »
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
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: New Snippet: Users Online
« Reply #23 on: December 08, 2009, 01:02:33 AM »
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

Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

WDStudio

  • Guest
Re: New Snippet: Users Online
« Reply #24 on: March 02, 2010, 09:15:51 PM »
How can I set timezone (GMT +1) for this module?
Logged

  • Print
Pages: [1] 2   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • New Snippet: Users Online
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2