Author Topic: Whos Online PHP Script for your template site  (Read 33839 times)

0 Members and 1 Guest are viewing this topic.

Offline mchallis

  • Member
  • *
  • Posts: 45
    • Long Beach, WA Weather
Whos Online PHP Script for your template site
« on: January 04, 2009, 12:37:09 AM »
Whos Online Script

This advanced PHP script is designed to be a webmaster tool for your PHP template web site.
Includes a carterlake php template page and includes instructions for other template sites.

It uses a MySQL database to track web site visitors online from the last 15 minutes.
You can see what pages they click on.
Visitors are considered inactive after 5 minutes. Removed after 15 minutes.
Nothing is permanently logged except for a few records.

It has a readme.txt file with step by step instructions, but if you are a beginner at PHP it might not be easy.

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

Live Example:   
http://www.642weather.com/weather/whos-online.php
My page is password protected, but there is a screenshot.jpg included in the download.

-----------------------------------------
Features
-----------------------------------------
Shows Search bots, Visitors, and You
Time online
Entry Time
Last Click Time
IP Addresses
IP Lookups
Last URL Visited
Referrer URL
Visitor count
Language variables, easy to translate

Options:
* password protect for admin only usage (protects your visitor's privacy)
* Show or hide Bots, Refresh rate, Profile display
* timezone configurable
* hide ip addresses if you want
* "location plugin" included: adds country, city, state, latitude & longitude, and a worldmap image of online visitors.
* many of the features can be turned on or off in include-whos-online-settings.php

Inspired by the osCommerce contribution "Who's Online Enhancement"
http://addons.oscommerce.com/info/824

"location plugin" Uses GeoLite data created by MaxMind, available from http://www.maxmind.com/

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
Re: Whos Online PHP Script for your template site
« Reply #1 on: January 04, 2009, 01:35:20 AM »
You know what Mike. No matter how I download that file it still show's the whos-online.php dated 12/31. Is there a way to send the files I need to update to the 2.0 version. What I will do is I will download the file and and screenshots to show you the dates of the files. Let me know what you think.

Chuck

Offline pinto

  • Member
  • *
  • Posts: 7
Re: Whos Online PHP Script for your template site
« Reply #2 on: January 04, 2009, 08:45:21 AM »
Hi Mike,

running fine here, no upgrading issues  :-D
Jozef

Offline jwwd

  • Senior Member
  • **
  • Posts: 59
    • Weather at Silkeborg, Denmark
Re: Whos Online PHP Script for your template site
« Reply #3 on: January 04, 2009, 09:18:36 AM »
Hi Mike

I have version 2.01 up and running - its working fint - and the pins seems to be placed in the right place.

Thank you very much for all your hard work on this great script.

Best regards,

Henrik

Davis Vantage Pro2 w/FARS & solarsensor. Boltek LD-250 Lightningdetector

Offline BfdWx

  • WxElement panel
  • Senior Contributor
  • *****
  • Posts: 255
    • Branford Weather
Re: Whos Online PHP Script for your template site
« Reply #4 on: January 04, 2009, 09:42:37 AM »
Quote
and the pins seems to be placed in the right place.

It seems some are and some are not. Mine for instance shows me out in the middle of the Atlantic both on your site and mine and I can't swim for that long!! It is a great script though and after a lot of trouble getting the Geocity.dat file loaded it works nicely. Many thanks to "mth" of http://www.relayweather.com for his kind assistance.

Regards,

Jack

Offline mchallis

  • Member
  • *
  • Posts: 45
    • Long Beach, WA Weather
Re: Whos Online PHP Script for your template site
« Reply #5 on: January 04, 2009, 11:17:33 AM »
Problem:
Sometimes location pins are not in their proper locations or even in the ocean.

Here is an explanation that might make sense for the geolocation inaccuracy issue:
Sometimes geolocation is close to perfect, sometimes not. Usually only about 85% accuracy.
The lat & lon, city, state parameters the database produces is for the location the ISP has reported for your current IP address.
Many ISPs share one block, or several blocks, of IP addresses with all their users.
Each time you connect you may get a different IP address assignment with different location details.
So the accuracy can even vary according to your current IP assignment.
This can cause the reported city, state, lat & lon from the IP to vary from your actual location.

To check the database itself, compare with this online demo.
http://www.maxmind.com/app/locate_ip
« Last Edit: January 04, 2009, 05:49:56 PM by mchallis »

Offline Arthurhh

  • Senior Contributor
  • ****
  • Posts: 266
  • IT Fixer
    • Tokoroa Weather Live
Re: Whos Online PHP Script for your template site
« Reply #6 on: October 11, 2009, 09:37:27 PM »
I have this (latest version from 642) and when i enable it it induces the following error in my Ajax dashboard (V2 Alternative one)
High: 8.9 @  Deprecated: Function split() is deprecated in C:\wamp\www\tok\ajax-dashboard.php on line 1742 13:38

I get no errors and see no oddities with the dates and times unless I enable the who's Online by adding the required code after Time Zone and before theme switcher in serttings.php.

Any suggestions ?

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Whos Online PHP Script for your template site
« Reply #7 on: June 14, 2013, 12:00:58 PM »
Later versions of PHP sometimes have Strict: messages set in the error_reporting so Mike's whos-online script for include-whos-online-header.php Version: 2.25 - 01-Sep-2009 may have a message like
Quote
Strict Standards: Only variables should be passed by reference in /home/yoursite/public_html/include-whos-online-header.php on line 1061
appear, followed by a bunch of Warning: messages about Headers already emitted.

You can fix this by changing include-online-header.php with the following changes:

Change:
Code: [Select]
            if ($C['enable_host_lookups'] && $stored_user['hostlookup'] == '') {

To:
Code: [Select]
            if ($C['enable_host_lookups'] && isset($stored_user['hostlookup']) and  $stored_user['hostlookup'] == '') {

Change:
Code: [Select]
function get_http_user_agent() {
   // determine the visitors user agent (browser)
   if (getenv('HTTP_USER_AGENT')) {
        $agent = getenv('HTTP_USER_AGENT');
   } else if ($_SERVER['HTTP_USER_AGENT']) {
        $agent = $_SERVER['HTTP_USER_AGENT'];
   } else {
        $agent = 'unknown';
   }
   return $agent;
}

function get_http_referer() {
   // determine the visitors http referer (url they clicked on to get to your site)
   if (getenv('HTTP_REFERER')) {
        $referer = getenv('HTTP_REFERER');
   } else if ($_SERVER['HTTP_REFERER']) {
        $referer = $_SERVER['HTTP_REFERER'];
   } else {
        // sometimes it is just empty
        $referer = '';
   }
   return $referer;
}

To:
Code: [Select]
function get_http_user_agent() {
   // determine the visitors user agent (browser)
   if (getenv('HTTP_USER_AGENT')) {
        $agent = getenv('HTTP_USER_AGENT');
   } else if (isset($_SERVER['HTTP_USER_AGENT'])) {
        $agent = $_SERVER['HTTP_USER_AGENT'];
   } else {
        $agent = 'unknown';
   }
   return $agent;
}

function get_http_referer() {
   // determine the visitors http referer (url they clicked on to get to your site)
   if (getenv('HTTP_REFERER')) {
        $referer = getenv('HTTP_REFERER');
   } else if (isset($_SERVER['HTTP_REFERER'])) {
        $referer = $_SERVER['HTTP_REFERER'];
   } else {
        // sometimes it is just empty
        $referer = '';
   }
   return $referer;
}

Change:
Code: [Select]
$host = (($output[0] ? end ( explode (' ', $output[0])) : $ip)); // plan a continues

To:
Code: [Select]
$host = isset($output[0]) ? end ( explode (' ', $output[0])) : $ip; // plan a continues

and that should solve the Strict: and Warning: message issues.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
Re: Whos Online PHP Script for your template site
« Reply #8 on: June 15, 2013, 11:07:24 AM »
Having issues with my whos-online page. Here is a link to my site.

http://www.chucksweather.com/

Chuck
« Last Edit: June 15, 2013, 12:31:43 PM by saratogaWX »

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Whos Online PHP Script for your template site
« Reply #9 on: June 15, 2013, 12:31:09 PM »
Hi Chuck,

I ran the wo-update.php utility to download a fresh copy of the GeoMind database and the page seems to work now.

Best regards,
Ken

BTW.. edited your post above to remove the link (so you won't be visited by annoying spiders on your whos-online.php page)
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
Re: Whos Online PHP Script for your template site
« Reply #10 on: June 15, 2013, 12:47:14 PM »
Thanks Ken for the quick response.

Chuck

Isn't there supposed to be a map on this page Ken?

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Whos Online PHP Script for your template site
« Reply #11 on: June 15, 2013, 12:53:04 PM »
Not on the whos-online.php page itself.  There's a separate page with the map AFAIK.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline stuart82

  • Member
  • *
  • Posts: 10
    • weather
Re: Whos Online PHP Script for your template site
« Reply #12 on: July 01, 2013, 02:24:45 PM »
I have just upload the who on line list to my server and seem to getting


Fatal error: Call to undefined function check_for_settings() in /home/arderswz/public_html/whos-online.php on line 48

Offline txweather.org

  • Forecaster
  • *****
  • Posts: 1597
    • Texas Weather
Re: Whos Online PHP Script for your template site
« Reply #13 on: July 01, 2013, 08:18:10 PM »
I have just upload the who on line list to my server and seem to getting


Fatal error: Call to undefined function check_for_settings() in /home/arderswz/public_html/whos-online.php on line 48


Read here: http://www.wxforum.net/index.php?topic=19430.0

----
Davis Vantage Pro2 Plus +FARS|Meteobridge Nano SD|Meteohub|Meteobridge MR-3020|WU KTXSPRIN75/PWS JRARGWX75/CWOP EW2972/WBB TXWDVUE75/Blitzortung ID: 1142|AWEKAS: 12095
Donations are welcome: https://paypal.me/ffuentesb

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
Re: Whos Online PHP Script for your template site
« Reply #14 on: July 01, 2013, 09:53:48 PM »
Have a new error on my page.

http://www.chucksweather.com/whos-online.php

Chuck

Offline AWL

  • Forecaster
  • *****
  • Posts: 727
    • Ardmore Weather Live

Offline gluepack

  • Contributor
  • ***
  • Posts: 101
    • Jerbils' Weather Site
Re: Whos Online PHP Script for your template site
« Reply #16 on: July 02, 2013, 06:48:35 AM »
ooi, I saw reference to a future 3.0 on another site after I had installed 2.25. It was posted over 3 years ago. However, I can't find one on search, did it ever materialize?

Anyway, that was a nice easy install. Just have to figure out where I am going to put it on my site now.

ohoh, spoke too soon. The first part was ok but in attempting to run wo-update I get...

Warning: fopen() [function.fopen]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in ....wo-update.php on line 390

Warning: fopen(http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz) [function.fopen]: failed to open stream: no suitable wrapper could be found in ....wo-update.php on line 390

download_file error: reading or opening file

oh... I googled it, I have to turn something on in my php.ini (lol, wherever that is)

oh...what the hell, I'll do it manually
« Last Edit: July 02, 2013, 07:29:59 AM by gluepack »

Offline gluepack

  • Contributor
  • ***
  • Posts: 101
    • Jerbils' Weather Site
Re: Whos Online PHP Script for your template site
« Reply #17 on: July 02, 2013, 01:25:41 PM »
OK, that's another great script added. I like it when I don't have to do a lot of work.

The only problem that I have now is why, when logged in, the table of who is online refuses to acknowledge the extent of the width of my page. Although everything is based on percentages (I'm trying now with fixed values, to no avail) it just will not fit within my page. I saw a reference to border-collapse:collapse being a problem, in that respect, but this is styled as border-collapse:separate.

Updated--
It is the Last URL cell that causes the problem. I have tried table-layout: fixed; on the table and word-wrap:break-word; on the cell but it (appears that it) will only break after a ? (oh, and possibly hyphens) so long urls cause a problem.
(I am trying with Chrome btw)
« Last Edit: July 02, 2013, 01:50:20 PM by gluepack »

Offline AWL

  • Forecaster
  • *****
  • Posts: 727
    • Ardmore Weather Live
Re: Whos Online PHP Script for your template site
« Reply #18 on: July 02, 2013, 01:49:17 PM »
The only problem that I have now is why, when logged in, the table of who is online refuses to acknowledge the extent of the width of my page. Although everything is based on percentages (I'm trying now with fixed values, to no avail) it just will not fit within my page. I saw a reference to border-collapse:collapse being a problem, in that respect, but this is styled as border-collapse:separate.

Maybe in 'include-whos-online-page.php' somewhere around line 183? ...table border...width="99%" . May not be what your looking for but I thought I would give it a shot.

Doug

*Disregard the above post....I'm sure you already tried that.
« Last Edit: July 02, 2013, 01:55:30 PM by DougW »

Offline gluepack

  • Contributor
  • ***
  • Posts: 101
    • Jerbils' Weather Site
Re: Whos Online PHP Script for your template site
« Reply #19 on: July 02, 2013, 02:00:07 PM »
Thanks

I have updated the post since you read it perhaps.

I am using the tools in Chrome to modify the content dynamically and know where it should be modified but not what is required. I will try another browser to see if the word-wrap works but, at the moment, that is the only thing that I can think of that will resolve the problem and Chrome is refusing to break up the url other than at a - or a ?

It is interesting because the url is linkable and, if I wanted to know the full url, I could just hover and effectively there could be anything put in the cell so, perhaps I will look at it from that point of view and modify the source to put something that will break or that is just shorter anyway.

Yeah, that is what I will do. I can't say "typically" because I have little data to work on, lol, but typically what is causing the problem is that bots, for example are looking at my WU data which has a long parameter string so I think that I will look at curtailing the displayed info. immediately prior to the ?

DUH!! I should have looked at the settings, there is a  $C['lasturl_wordwrap_chars']   = 175; that could be changed, I guess.
Hahahahah, that worked, changing it to 50 :)

Now, I'm not too sure whether I want to see who is looking at my site and what they are looking at. About the first "person", as opposed to bot, from Houston, Texas, shows as having the "Last URL" as /index.php which doesn't exist on my website. Now does that mean they tried to access that file for some reason (perhaps assuming that it did exist) accidentally or were they up to no good?
« Last Edit: July 02, 2013, 02:50:18 PM by gluepack »

Offline gluepack

  • Contributor
  • ***
  • Posts: 101
    • Jerbils' Weather Site
Re: Whos Online PHP Script for your template site
« Reply #20 on: July 03, 2013, 10:05:16 AM »
OK, it's working fine but I would like some defaults established, especially when logging on

e.g. Refresh Rate: 0:30, Profile Display: All, Show Bots: checked

The problem, as I see it, is that the code is written to display the/a default and collect the response in one statement/parameter
so I can't, for example, replace the $_GET['refresh'] in the call to draw_pull_down_menu with a default value (despite that being the parameter position for "default") because then the variable never actually gets set to that and, also, it can't be changed. The same, basically, if I add "checked" to the Bots checkbox parameters.

Or, am I missing something and is it a simple thing to do?

Offline txweather.org

  • Forecaster
  • *****
  • Posts: 1597
    • Texas Weather
Re: Whos Online PHP Script for your template site
« Reply #21 on: July 03, 2013, 10:11:31 AM »
The stupid "Strict Standards: Only variables should be passed by reference in /home/yoursite/public_html/include-whos-online-header.php on line 1061" came back on my site. No clue why...

----
Davis Vantage Pro2 Plus +FARS|Meteobridge Nano SD|Meteohub|Meteobridge MR-3020|WU KTXSPRIN75/PWS JRARGWX75/CWOP EW2972/WBB TXWDVUE75/Blitzortung ID: 1142|AWEKAS: 12095
Donations are welcome: https://paypal.me/ffuentesb

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Whos Online PHP Script for your template site
« Reply #22 on: July 03, 2013, 10:26:04 PM »
You do need to update your include-whos-online-header.php to solve the Strict Standards: issue(s)
PHP 5+ seems to default to having E_STRICT enabled for error_reporting, and that is why you get the message(s) which screw up the page formatting.

Save the attached .txt file as include-whos-online-header.php and upload to your site .. it has the errors causing the Strict messages fixed.

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline txweather.org

  • Forecaster
  • *****
  • Posts: 1597
    • Texas Weather
Re: Whos Online PHP Script for your template site
« Reply #23 on: July 03, 2013, 10:54:58 PM »
You do need to update your include-whos-online-header.php to solve the Strict Standards: issue(s)
PHP 5+ seems to default to having E_STRICT enabled for error_reporting, and that is why you get the message(s) which screw up the page formatting.

Save the attached .txt file as include-whos-online-header.php and upload to your site .. it has the errors causing the Strict messages fixed.

Best regards,
Ken


Ken,

Thanks for your help. But your file is broken and the code is not complete. I am sure is a small mistake :)

----
Davis Vantage Pro2 Plus +FARS|Meteobridge Nano SD|Meteohub|Meteobridge MR-3020|WU KTXSPRIN75/PWS JRARGWX75/CWOP EW2972/WBB TXWDVUE75/Blitzortung ID: 1142|AWEKAS: 12095
Donations are welcome: https://paypal.me/ffuentesb

Online saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Whos Online PHP Script for your template site
« Reply #24 on: July 03, 2013, 11:07:06 PM »
Very strange, I just compared the .php with the .php.txt version I'd uploaded and they were identical, and the .php version is the one currently running on my site.

What were the error messages when you tried?

Best regards,
Ken
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP