CurrentVisitors

Summary: Display the number of current visitors
Version: 1.23
Prerequisites: PmWiki version: 2.0.; last tested on PmWiki version: 2.1.26.
Status:
Maintainer:
Categories: Layout

Questions answered by this recipe

How can I know how many visitors are currently surfing on my site?

Description

Copy CurrentVisitors.phpΔ to the cookbook directory and add include_once("cookbook/CurrentVisitors.php"); to config.php.

Notes

In your wiki pages, add the markup (:CurrentVisitors:) to display the number of visitors (strictly speaking "different IP addresses") that came to your site during the last MaximumNumberOfSecondsToConsiderAVisitorAsCurrent.

The counter will update only when action=browse.

Release Notes

Version 1.23
Sep 26th 2007 edited by Angelo Beck
Minor Bugfix.

Version 1.22
June 10th 2007 edited by Angelo Beck
Stores the maximum count of visitors in a file.

Added the following variables:

(:MaxCurrentVisitors:) displays the maximum number of visitors online at the same time.
(:MaxCurrentVisitorsTime:) displays the time when the maximum of visitors was reached.

Older Versions

Original Script by Christophe David Attach:CurrentVisitors_V1.11.phpΔ

See Also

Contributors

Christophe David original script
Angelo Beck version 1.2

Comments

See discussion at CurrentVisitors-Talk

User notes +3: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_COOKIE] => imstime=1777545306; PHPSESSID=s0dijj19frda8b05cb25ddpka5
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=Cookbook%2fCurrentVisitors
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=Cookbook%2fCurrentVisitors
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/CurrentVisitors
            [REDIRECT_SCRIPT_URL] => /wiki/Cookbook/CurrentVisitors
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afMwXoTyfxsmXmDQokJaxgAAABA
            [REDIRECT_URL] => /wiki/Cookbook/CurrentVisitors
            [REMOTE_ADDR] => 216.73.216.25
            [REMOTE_PORT] => 54857
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/Cookbook/CurrentVisitors
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/Cookbook/CurrentVisitors
            [SCRIPT_URL] => /wiki/Cookbook/CurrentVisitors
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afMwXoTyfxsmXmDQokJaxgAAABA
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777545311.1032
            [REQUEST_TIME] => 1777545311
            [argv] => Array
                (
                    [0] => n=Cookbook%2fCurrentVisitors
                )

            [argc] => 1
        )

)