Users online

version 2.0.1



Live demo

See the footer of this page!





Installation

Required file edits

Open online.php
Make sure to read the comments


Variables that need be edited

db host
$db['h'] = 'localhost';

The hostname of your MySQL server, most likely localhost.



db user
$db['u'] = 'user';

Username of the user for your MySQL database



db pass
$db['p'] = 'pass';

Password of the user for your MySQL database



db name
$db['d'] = 'database';

Name of your MySQL database



timeout
define('UO_TIMEOUT', 300);

300 is the timeout, in seconds, of the script. Users who have been inactive for this amount of time will no longer be counted as online. Change the 300 to change the timeout. 300 seconds = 5 minutes



Uploads

Upload the whole users-online folder to the root of your website



Install

Point your browser to the install.php file on your website. This will most likly be: www.yourdomain.com/users-online/install.php

This will check your database settings in online.php and then attempt to create the required tables and insert some information

Once this process is complete, delete install.php from your server



Adding to your site

The script is now ready to go, it's just a matter of adding it to your current website.

Copy and paste the following code into your PHP pages:

<?php
include_once('users-online/online.php');
list($online, $record) = users_online();
?>
<p>There are currently <?=$online?> users online. The most ever online is <?=$record?></p>

You may have to change users-online/online.php to point to the correct location of online.php on your server, relative to the page you are putting the code into.

You can easily style and change the output, just use <?=$online?> and <?=$record?> to display the current online count and the record online count!

Help and support

You can get help, support for this script plus other web design and development tips from our webmaster forums: http://community.spyka.co.uk/forumdisplay.php?f=9


advertisement

Support

Need help, support or advice using or install our scripts? Take a look at our webmaster forums

Donate

Like our scripts? Consider a donation