Whos Online Script

What do you think of my new Who’s Online script?

Who’s Online PHP Script by Mike Challis

Version: 1.01 - 14-Dec-2008

  • I moved all the settings to a include-whos-online-settings.php to help make updates easier
  • fixed missing language setting TEXT_VISITORS_ONLINE_NOW
  • added more error traps, one to catch a missing spiders.txt
  • fixed extra on whos-online page messing up HTML validation.
  • added date and time format settings
    upgrading from version 1.00 requires reading the readme.txt again, the steps have changed
    database requires no changes.

Version: 1.02 14-Dec-2008

  • fix for Fatal error: Call to undefined function check_for_settings()
  • fix for empty records dates/times
    upgrading from version 1.01 requires replacing include-whos-online-page.php and include-whos-online-header.php

Version: 1.03 14-Dec-2008

  • added one more time format setting to include-whos-online-settings.php
    // time format displayed on ‘Entry’ and ‘Last Click’ time on the whos-online page
    // ‘h:i:s’ would be 02:25:25
    $C[‘time_format_hms’] = ‘h:i:s’;
    to upgrade from 1.02
    replace include-whos-online-page.php and add this setting to your include-whos-online-settings.php

Version: 1.04 14-Dec-2008

  • fix for show bots checkbox being ignored
    to upgrade from 1.03, replace include-whos-online-page.php

Version: 1.05 14-Dec-2008

  • fix time format issue with records for users who want to select 24 hour time display
    to upgrade from 1.04, replace include-whos-online-header.php

Version: 1.06 18-Dec-2008

  • added mysql link identifier to each mysql call (for better compatibility if you have another mysql app in your site template, ie: wordpress)
    to upgrade from 1.05, replace include-whos-online-header.php and include-whos-online-page.php

Version: 1.07 20-Dec-2008

  • added country flags addon feature, installing this addon will add Country Flags next to each IP address on your whos-online.php page
    see ‘country-addon’ folder readme.txt in the zip file for more info
    to upgrade from 1.06, replace include-whos-online-header.php and include-whos-online-page.php and add this setting to include-whos-online-settings.php
    // enable ip-to-country lookups
    // requires installing the country-addon plugin
    // enabling this will cause an error if you have not installed the plugin!
    $C[‘enable_country_lookup’] = 0; // 1 enables, 0 disables

Version: 1.08 21-Dec-2008

  • bug fix, 1.07 was broken, the country flags all showed “g”
    to upgrade from 1.07, replace include-whos-online-header.php

Version: 1.50 22-Dec-2008

  • lots of changes for the new password protect feature
  • changed default settings for refresh, profile_display, ip_display, last_url_display, referer_dispay to disabled for the most conservative privacy.
  • added password protection feature with several options, you can enable it in include-whos-online-settings.php be sure to change the default password!

to upgrade from 1.08, replace include-whos-online-settings.php (re-configure your settings), include-whos-online-page.php, whos-online.php
non-carterlake users will also need to revisit Step 3 and Step 6 of the “Installation (any other php template sites)” section in the readme.txt file

Version: 1.51 22-Dec-2008

  • fixed bug where IP addresses sometimes were not showing when logged in
    to upgrade from 1.50, replace include-whos-online-page.php

Version: 1.52 31-Dec-2008

  • fixed refresh not working when login enabled and logged in
  • added a new state-addon plugin to show “city, state” next to country flags, see ‘state-addon’ folder readme.txt
  • thanks to (Jim McMurry - jcweather.us) for the idea and some of the code.
    to upgrade from 1.51, replace whos-online.php, include-whos-online-page.php, and include-whos-online-header.php

I think I got all the bugs worked out, it should be stable now.

Download
http://www.642weather.com/weather/scripts/whos-online.zip

Live Demo

My whose-online page is password protected to protect my site visitors privacy
I include a screenshot of the whos online page in the zip file (with ip addresses blanked out)

Features:
Shows Search bots, Visitors, and You
admin only password protection option to protect your site visitors privacy
Time online
Entry Time
Last Click Time
IP Addresses
IP Lookups
Last URL Visited
Referrer URL
Visitor count
Language variables, easy to translate
Includes a carterlake php template page and it is style switcher compatible

Options: Show or hide Bots, Refresh rate, Profile display

It uses a MySQL database.
Visitors are considered inactive after 5 minutes. Removed after 15 minutes.

This is not a page hit counter or page view logger, you can use google analytics or webalizer for that.

Note: I force the style to wide on this page because it needs a wide table.

This script only supports PHP files in a template site at this time.
Later on I might add a feature to support html page activity by using a very small pixel image hit.

This is inspired by the osCommerce contribution “Who’s Online Enhancement”

This is new …
If you have any ideas for more features, let me know

If you try it please let me know, thanks

Now that’s something I’d like to use…

Stuart

What a great idea, would it be able to parse the info into a small box on the index page
with the details of whos online (or amounts) and then have a link to that page?

Very COOL!!

Hi Mike

WOW - thats looking great - I would certainly be interested to implement it to my site.

Best regards,

Henrik

Hi again

Just thought of a suggestion:

Would it be possible to show what contry (maybe presented by a flag?) the visitor comes from?

Best regards,

Henrik

I like it. :smiley:

I like it :wink:

Hi again

Another suggestion:

Would it be possible to manually input the owner of the IP adresses into the database? In that way the owner of the IP adress could be presented.

Ie. I know a lot of my users IP adresses - in that way it would be easy to see who is online by name.

Best regards,

Henrik

I’d love to have this but e-rice charges for an additional SQL database. :frowning:

Keep suggesting features
I might add more.

One feature I am going to add is an option to hide the IP addresses from the general public so they are visible to the admin only.

I think that’s a good idea. Some casual visitor might feel creeped out by it.

How about this much:
22 Visitor(s) online
18 Guests, 8 are active.
3 Bots
1 You

make the “Visitor(s) online” a clickable link

That sounds like a feature I probably would not add, but if I release the script, you can modify it anyway you like. :slight_smile:

This is a feature I will add in a future update.
It will be an option you can turn on or off.
Enabling it will require my ‘country to ip script’ also be installed.

Nice script Mike. Maybe some daily, monthly, yearly stats?

Hi Mike

Thats okay.

Great - I look forward to see the script.

Thank you very much for your work on this.

Best regards,

Henrik

Yes, just simple though, like “most users online today”, this month, this year, all time.
I am not going to permanently log all the pages visited because you can use google analytics for that, also my server has webalizer.

stats are now supported, look in my footer:

21 Visitors online
Max visitors today: 26 at 2008-12-12 18:01:17
This month: 26 at 2008-12-12 18:01:17
This year: 26 at 2008-12-12 18:01:17
All time: 26 at 2008-12-12 18:01:17

I am late to go to a birthday party, I will format the dates/times later.

I will be using this, also. Thanks again, mchallis, for the great work!