skip to main content

Visitors 1.3 for phpWebSite
updated by rck, 2006-04-09

Visitors is basically a remix of "Who's online", "Statistics" and an automated spider detection. Right now, it's only a "Who's online light". There are no duplicate entries. Instead, there is an automated dns-lookup and a display of user agent for deities.

1.3 improves compatibility with newer MySQL releases. It also includes additional analysis for Contact and Announcement URLs.

1 | 2

What's different to Who's online?

Visitors Icon

Visitors does not throw away it's knowledge but collects it for statistics. They will get a front end in a later version but can be done already via MySQL-Queries. Differences at a glance:

no flags!
no notes-link!
(will include that later)
no duplicate ips!
I don't filter them but honor the session_id instead
showing first part of user agent
for "manual" bot detection. Shows you msnbot/0.3, psbot/0.1, etc.


got any questions about this or suggestions for future versions? please contact the author via his forum. Please don't use mails or notes if not absolutely necessary. Stick to the forum, so others can benefit about your post and discuss it as well.

Got any problems or questions about phpWebSite in general? Please contact the phpws support forums. The author of this program (rck) can be found there as well.


Download visitors_1.3.0.tar.gz(6068), untar it in your mod-directory and boost it like usual. If your site locks up, please rename the directory „visitors“ to something else, say "visitors~".

Please share your experiences in my forum!

1 | 2
What's different to Who's online?

RSSComments - Make a comment
The comments are owned by the poster. We are not responsible for its content.
  • Site speed

    Posted on 2005-01-15 04:49:41 By Anonymous

    The one major, major, major problem with whosonline scripts is that they do masses of INSERTs into the database. One for everytime a user does something.

    If there's one thing to change, it's to NOT use the database for transient information about what a user is doing during their session. If you really must know that, then use the php shared memory calls and stick it directly into ram instead of inflicting it on a database.

    Sort that out before getting fancy.


    [Reply ]

    • Transient Information

      Posted on 2005-01-15 07:13:27 By rck[110]

      changed On 2005-01-15 07:17:53 Edited By rck (reason: bad grammar)

      Thanks for your comment!

      Well, one of the main differences between "Who's online" and "Visitors" is, that the later one stores the User-Tracking stuff persistently -- not transient. A bit like the statistics module of Yves, if you want.

      I don't only want to know, who's online right now. But when, for example user Hugo was online the last time. Or to what percentage users use the article or chat module. Right now and two months ago.

      I could do some optimizing, if it's really to slow. Of course database-access is slower than memory access. Then again, it shouldn't be too much slower than a text-file write. Still it gives me so much more power.

      Having said that: How exactly would I do that shared memory stuff? Sounds interesting...

      [Reply ]

      • Re: Transient Information

        Posted on 2005-01-18 11:48:25 By Anonymous

        The old who's online module I used to run in the 0.8x days used to INSERT every time a user loaded a page. When you've got 2-300 users online you can imagine how nasty that is on database access even if you're using delayed writes. It's also the surest way of heading towards database melt down and taking down the site. Every couple of weeks the who's online table would get corrupted and either show garbage or you'd get an error when visiting the site.

        The idea was to use php unix shared memory calls. See

        Stick all the data about which user is doing what in memory so it doesn't touch the database and it's fast too.

        phpWebSite needs as much speed as possible and adding extra INSERTs on every page view isn't going to help it.


        [Reply ]

        • Re: Transient Information

          Posted on 2005-01-18 12:04:49 By rck[110]

          Ok, got it. Well, I guess we are talking about two different pairs of shoes here. My visitors module does basically, what apache logfile analysis does as well. The part where the active visitors are shown is sort of a "added bonus".

          It's not the other way round. My focus is on having a lot of data to analyze. Data from the present, data from the past. When using shared memory, I'd have two options.

          Not having past data at all. This is not acceptible, I want to replace my site statistics by this module. Writing the data all the time myself. That's more overhead than now, as I have to write it to the database as well as to memory.

          A third approach would be to write just the cummulative data to the database. This on the other hand would result in dataloss. The thing I do agains slowness is having a index. Simple but very effective. Also, I do most of the "calculation" part right with mysql. Like string-preparing, etc.. That should give additional speed

          Visitors is not meant to be a light-weight community tool. It's a statistics tool, based on loads of data. Right now, my server can handle all of that with ease. As soon as it doesn't, I'll think about a different solution.

          I'd say, the shared memory idea is a whole different philosophy that would suit a new module or could be ported to Who's online. Visitors is not about improving site speed. Its about gaining insights -- I already have a basic clickstream analysis, but it's not quite there yet.

          [Reply ]

      • Re: Transient Information

        Posted on 2005-05-01 02:01:32 By Anonymous

        I personally would like to know how to access the database stuff when they aren't online. smile

        [Reply ]

        • Re: Transient Information

          Posted on 2005-05-03 09:22:00 By rck[110]

          Easy! Go into Control Panel, Select the Administration tab and click the Visitors icon.

          [Reply ]

  • Visitors module

    Posted on 2005-01-20 22:11:43 By Anonymous

    Great stuff, keep it up.

    When you get round to the Control Panel page(s), a profile per user_name showing count of visits per day would be good. And ditto per page.

    We could use options to keep the current visitors block out of sight on a per group and per user basis. And the visitors pages added to the stats module's countable pages so the dba can quickly check how it's growing !

    [Reply ]

    • Re: Visitors module

      Posted on 2005-01-20 22:16:26 By rck[110]

      Thanks for the good ideas! I hope to have some time to improve Visitors in February.

      [Reply ]

  • Language file?

    Posted on 2005-01-25 17:08:08 By Anonymous

    I could not find a language file to do some translations. Did I miss it or don't you use any language file?


    [Reply ]

    • Re: Language file?

      Posted on 2005-01-25 17:45:17 By rck[110]

      No, you didn't miss it. I don't have any of those. Yves Kündig already mentioned that, too. Maybe I'll do a language file in February? Would you want to do translation? Which language?

      Help / Support / Contribution always appreciated.

      [Reply ]

      • Re: Language file?

        Posted on 2005-01-27 15:04:06 By Anonymous

        Yeah, I could translate en->de or vice versa :-)
        You can contact me at or


        [Reply ]

  • stats

    Posted on 2005-01-26 07:59:12 By Sharondippity[12]

    Are the totals life to date? Can they be totalled by month?

    Also, it would be nice to have an option to hide the visitors block from non deities.

    [Reply ]

    • Re: stats

      Posted on 2005-01-26 09:39:29 By rck[110]

      Are the totals life to date?

      yes, they are calculated in realtime.

      Can they be totalled by month?

      Not as of now. I'll rework the statistics of the current developement version, though.

      Also, it would be nice to have an option to hide the visitors block from non deities.

      I agree. What I want to find out first, is a “standarized” way to put configuration information in the database.

      [Reply ]

    • Re: stats

      Posted on 2005-03-03 03:55:42 By youcantryreachingme[7]

      changed On 2005-03-03 03:59:36 Edited By youcantryreachingme (reason: )

      I managed to hide the block from non-deities using the following:

      Add the following line:

      if(!$_SESSION["OBJ_user"]->isDeity()) return "";

      to be the first line in the functions "renderGuestBox" and "renderUserBox" in the file "visitors.php".

      I agree - being able to at least set this in the config file would be more useful. An admin screen would be a bonus.

      Another thing I'd like to see is the use of templates for the box so you can customise it's appearance.

      Great work though - I'm not sure the DB size thing will be an issue here on a controlled intranet with (currently) 300 users. Even if it is, it's no trouble to clear the tables - after all - I've locked down this module's use to be for the Deity only.

      [Reply ]

  • PHP 5 compliance "issue"

    Posted on 2005-03-03 03:49:29 By youcantryreachingme[7]

    changed On 2005-03-03 03:51:01 Edited By youcantryreachingme (reason: )

    I installed Visitors v1.0 against a core of 0.10.0 using PHP 5.0.3 and experience several PHP Undefined variable and Undefined index notices (see the end of this comment).

    I found on (under the manual for the function "error_reporting" - see the 18-Nov-2002 08:16 post by sreid) effectively tells you there's not much you can do - at least for the index notices. On my site I now suppress Notices - and the posting I just mentioned suggests a custom error handler, which has it's own limitations.

    Note that one of the indices is the username ("admin").


    Notice: Undefined index: view in blah\mod\visitors\index.php on line 26

    Notice: Undefined index: user_id in blah\mod\visitors\index.php on line 35

    Notice: Undefined index: day in blah\mod\visitors\index.php on line 37

    Notice: Undefined index: month in blah\mod\visitors\index.php on line 38

    Notice: Undefined index: year in blah\mod\visitors\index.php on line 39

    Notice: Undefined variable: day in blahmod\visitors\index.php on line 67

    Notice: Undefined variable: day in blahmod\visitors\index.php on line 68

    Notice: Undefined variable: content in blah\mod\visitors\index.php on line 101

    Notice: Undefined index: admin in blah\mod\visitors\class\visitors.php on line 436

    [Reply ]

    • Re: PHP 5 compliance "issue"

      Posted on 2005-04-06 13:54:38 By rck[110]

      php/5 isn't phpWebSite compilant. It seems, that the PEAR libraries, which are a fundamental set of libraries for phpWebSite, aren't there yet.

      I won't test visitors with php/5 until phpWebSite works with php/5. Everything else wouldn't make sense to me...

      [Reply ]

    • Re: PHP 5 compliance "issue"

      Posted on 2005-05-10 04:11:30 By youcantryreachingme[7]

      There is now a follow up posting on the phpWebSite project page (bug 1154806) at sourceforge which is designed to fix the php Notices issue being caused in Error.php - although the bug has not been officially closed, and I too have not checked if the posted fix works.

      [Reply ]

      • Re: PHP 5 compliance "issue"

        Posted on 2005-05-21 01:21:11 By rck[110]

        Thank you. I'm still waiting with updating my site (running 0.9.3-4). At least until a couple of database-patches I've submitted are included. Hacking the same things over and over again isn't exactly my idea of having a good time.

        As soon as phpWebSite has that stuff included and is php/5 compilant, I will try to develope a migration path from php/4 to php/5, you might see php/5 compilant version of my modules afterwards.

        [Reply ]

  • Missing nl file

    Posted on 2005-04-04 13:02:54 By tonynl[8]

    I think the dutch language file is missing.

    [Reply ]

    • Re: Missing nl file

      Posted on 2005-04-04 14:11:54 By rck[110]

      oops. I'll fix that.

      [Reply ]

  • Foreach error

    Posted on 2005-04-05 20:13:14 By tonynl[8]

    changed On 2005-04-05 23:03:27 Edited By tonynl (reason: )

    When viewing deity details I get this error:
    Warning: Invalid argument supplied for foreach() in /var/www/o/ on line 22
    I think it's a typo (actually two, one of them is a few lines further) where you wrote 'foward' instead of 'forward'. But even after correction this error message stays.

    [Reply ]

    • Re: Foreach error

      Posted on 2005-04-06 13:53:07 By rck[110]

      It's definately about time I release a bugfixed version. I'm very busy right now, but I will do it as soon as I find the time.

      Thanks for the report!

      [Reply ]

    • Re: Foreach error

      Posted on 2005-04-25 11:25:54 By Anonymous

      aside from doing that, you should also change this line
      from: $forwarded=explode(",", $forwarded_for);
      to: $forwarded_for=explode(",", $forwarded_for);

      however, now i'm getting this error:
      Warning: gethostbyaddr(): Address is not a valid IPv4 or IPv6 address in /home/makoolet/public_html/mod/visitors/class/deity_details.php on line 26

      [Reply ]

      • Re: Foreach error

        Posted on 2005-04-26 15:37:16 By Anonymous

        ^^^nevermind, i found the fix. ;D thanks!

        [Reply ]

        • Re: Foreach error

          Posted on 2005-05-21 01:22:09 By rck[110]

          would you mind sharing it?

          [Reply ]

          • Re: Foreach error

            Posted on 2005-07-01 17:08:11 By Anonymous

            oops. sorry, my response is so late. i haven't visited this site since my last post.

            line 26 should be like this:


            [Reply ]

  • Purge old data

    Posted on 2005-04-06 08:20:42 By youcantryreachingme[7]

    No idea what the current status on this discussion is, but here's one way you can cull your Visitors data.

    *** WARNING *** - you will lose all data that you specify - so back up your database first.

    First, add the following to the config file:

    // Remove all records which are older than $purgeInterval (minutes)
    // WARNING!! You cannot recover this data if you set this variable
    // greater than zero ( >0 ) - and the purge will happen with the
    // next click on the website.
    // Default = 0. 1 day = 1440.
    $purgeInterval = 0;

    Note - you need to specify a time > 0 to purge the old data. Read the warning!

    Second, and lastly, add the following lines to the start of the function storeData in Visitors.php

    if ($purgeInterval > 0) {
    $sql = "DELETE FROM `mod_visitors_hit` WHERE timestampquery($sql,TRUE);

    Now - every time Visitors stores click information, it will also purge the info which is older than whatever you specified.


    [Reply ]

    • Re: Purge old data

      Posted on 2005-04-06 13:52:21 By rck[110]

      Well, I didn't include that feature on purpose. Because I don't want to mess with user data -- to me, it's one of the most important assets there is.

      If you can post a nice frontend to that with a big "on / off" switch, we can put that in the code, if you want.

      Also, as far as I can recall, there was no discussion about purging?

      [Reply ]

      • Re: Purge old data

        Posted on 2005-05-31 02:25:53 By youcantryreachingme[7]

        changed On 2005-07-23 23:36:57 Edited By rck (reason: wrapped the php statement)

        Well, no discussion on purging, per se, but the first comment (by Shaun) talks about copious data accumulating.

        Also, just re-reading my posting, the code doesn't quite look right. It seems that in saving the data, the "greater than" and "less than" symbols confused things.
        I'll try again:

        		if ($purgeInterval > 0) {
        			$sql = "DELETE FROM `mod_visitors_hit` ".
        			  "WHERE timestamp<date_sub(now(), interval " .
        			  $purgeInterval . " minute) ";
        			$result = $GLOBALS["core"]->query($sql,TRUE);

        Also, I've only just come back to the page to find your "big on/off switch" comment... I'll see what I can do, but currently my version of Visitors is so far removed from the original I'll have to start with a fresh install. As you know, though, it's all about finding time!

        (The other thing that might be useful is to make the "purge" functionality actually transfer the data to a separate *database* and build a frontend that can query it...)

        [Reply ]

        • Re: Purge old data

          Posted on 2005-06-03 14:55:24 By rck[110]

          changed On 2005-06-03 14:56:14 Edited By rck (reason: the switch)

          Well, I'd be opting for the separate database. You know, business intelligence and stuff :-) If you can build it on top of Visitors 1.1 and I can understand your code, I'll give you credit and distribute it.

          Yeah, it's that time thing. A thousand ideas, too little time to make them real.

          Btw. Visitors 1.1 HAS that big on/off switch :-) It's a flag within conf/config.php. You should be able to find it.

          [Reply ]

  • bug?

    Posted on 2005-05-03 00:03:28 By DnOlvrB[2]

    In the version I downloaded (latest=1.1?) I see a couple of possible typos in class/deity_details.php at line 22 and a few after that. Should "foward" be "forward"?

    [Reply ]

    • Re: bug?

      Posted on 2005-05-21 01:18:05 By rck[110]

      Very likely. Thanks for pointing that out!

      [Reply ]

  • Visitors

    Posted on 2005-06-01 22:34:25 By Anonymous

    Where may I download the latest Visitors?

    [Reply ]

    • Re: Visitors

      Posted on 2005-06-03 08:25:19 By rck[110]

      Right here! See the "Install" section? Click on "visitors_1.1.tar.gz" and it should download automatically.

      [Reply ]

      • Members List

        Posted on 2005-06-10 08:20:07 By Anonymous

        Is there a MOD that will display the members list of the website?

        Sorted in alphabetically? Or with link from A-Z ?

        [Reply ]

  • Visitor Details Problem

    Posted on 2005-07-05 18:57:51 By Hoike[1]

    changed On 2005-07-05 18:59:12 Edited By Hoike (reason: )

    I have installed 1.1, which I like very much, thank you. I have also corrected the typos mentioned in the forum here.

    But when I click on the (details) link all that happens is that I get a blank page loaded into the center section of my site. If I get the properties on that blank page, it is the correct page called by the (details) link, but it is blank.

    Everything else in the module is working except no countries are ever resolved, which I don't know is correct or not.

    Any suggestions that you can give me on troubleshooting this would be greatly appreciated. BTW: I'm running 0.10.1 version of phpWebsite and I also had the problem in 0.10.0

    Thank you,

    [Reply ]

    • Re: Visitor Details Problem

      Posted on 2005-07-05 23:17:16 By rck[110]

      Yes, there's no country-resolving as of yet. I don't have a schedule for it yet but I'm planning to include some form of caching mechanismus which will include a dns cache.

      The next release of visitors (1.2) is already in the quality assurance pipeline. Expect it in a week or two...

      If it still has the same errors you've experienced please document the exact steps to reproduce them.

      [Reply ]

      • Re: Visitor Details Problem

        Posted on 2005-07-06 21:51:03 By Anonymous

        Ok, I understand about the countries, but am I to understand that when I click on the (details) link in the Visitors area that I should be getting a blank page returned? I don't get any errors, just the blank page.

        I'll be looking for the update. Thanks for a great mod.


        [Reply ]

  • Hiding certain info

    Posted on 2005-07-20 22:08:33 By Anonymous

    This is a thought. Is there a way to hide the hits that I have created. Like somehow mark when ever my login shows that all the info for that day from my ip address gets hidden. This way since I check my site regularly, I will have a more accurate idea of how many other people have visited.

    Its just an idea that came to me one day when I was doing a lot of changes to the site.

    [Reply ]

    • Re: Hiding certain info

      Posted on 2005-07-21 07:22:10 By rck[110]

      Not as of yet. But I like the suggestion and probably will implement it at some point.

      [Reply ]

  • error

    Posted on 2005-08-05 19:12:18 By Anonymous

    changed On 2005-08-06 12:23:21 Edited By rck (reason: )


    I have just installed this very useful script. It is showing the stats (Live!) ..

    however, when I go to control panel, and click on Visitors,
    ( )
    I get this error:

    Fatal error: Call to undefined function: rendermenu() in /home/shillong/public_html/mod/visitors/index.php on line 471

    wht is that?? any solution, pls.


    [Reply ]

    • Re: error

      Posted on 2005-08-06 12:23:40 By rck[110]

      Hi Babul! Thanks for using Visitors.

      About your error... Are you using php 5 or php 4? Which version? Can you post the php code you have around line 471 of your mod/visitors/index.php?

      rendermenu() is working for me, so I'm a bit puzzled. But we'll find a solution...

      [Reply ]

  • No Subject

    Posted on 2005-08-13 19:50:24 By Anonymous

    I am using 1.2, but it doesnt hide googlebot it seems. So whenever they come around, I get like 15 guests = =

    [Reply ]

    • Re:

      Posted on 2005-08-13 22:14:13 By rck[110]

      That's true. I haven't made the current user view too intelligent yet, probably should do that. Thanks for the reminder!

      [Reply ]

  • Fatal Error

    Posted on 2005-08-29 15:36:13 By Anonymous

    changed On 2005-08-30 16:01:43 Edited By rck (reason: )

    On phpws 9.3-1 i get this error message after the installation, when i click the visitors ling in administration menu:

    Fatal error: Call to a member function on a non-object in /home/******/public_html/v2/core/Text.php on line 479

    [Reply ]

    • Re: Fatal Error

      Posted on 2005-08-30 16:01:57 By rck[110]

      Can you post line 479 +/- 5 lines of your /home/******/public_html/v2/core/Text.php?

      [Reply ]

  • Trouble.

    Posted on 2005-09-07 18:46:48 By Anonymous

    For some reason there is no data for the month of September - so visitors will not record any info. I have installed visitors on two sites, both have the same problem. Other than that Visitors is an excellent module.

    If anyone has any suggestions, I would love to hear them.

    [Reply ]

    • Re: Trouble.

      Posted on 2005-09-09 00:47:13 By rck[110]

      I've been just looking at my September statistics for, they work like a charm. Could it be we are looking at a local problem?

      My usual recommendation is an installation of Health. It often gives ideas about the source of various problems. Also, can you tell me more about your environment?

      Self-hosted? Are you site admin? Are you on a shared server? Do you have any database-restrictions (amount of connections, reads, writes, DB-sizes, etc.)? Can you insert a row to mod_visitors_hit by yourself?

      [Reply ]

      • Re: Trouble.

        Posted on 2005-09-10 04:38:25 By Anonymous

        Both of these sites are on shared servers, I am a site admin. I don't know of any restrictions, however they may exist. I probably could insert a row into a database, but I'm not very mysql literate.

        Visitors did work fine last month, there doesn't seem to be a reason for it to just stop working...

        [Reply ]

  • Visitors by IP

    Posted on 2005-10-01 20:27:28 By Anonymous

    changed On 2005-10-06 12:36:43 Edited By rck (reason: )

    Is there a way to see a list of IP's a particular user has logged in as?

    spam11 at tybox dot net

    [Reply ]

    • Visitors kills other modules

      Posted on 2005-10-06 12:37:29 By rck[110]

      Hi, visitors is a great module, but on my setup it "killed" photo album and faq... Those two modules gave a blank screen.

      - Stone

      [Reply ]

RSSAll Articles
2008, 2007, 2006, 2005, 2004

What's Related

Article Manager


Latest Updates

updated by freddiemac1993, 2013-06-14

Re: adventures
created by brittdavis10, 2012-02-23 (1 rply, 3 views)

Re: how to run phpwebsite...
created by alexander, 2011-08-25 (2 rpls, 3607 views)

Re: Forum tags
created by HaroldFaragher, 2011-08-22 (3 rpls, 8488 views)

Zu den KO2100 Foren