|
|
|
This class return online users in a website that using sessions. To give more acceptable information, sessions have been counted in an interval of 1 hour.
online class : Class that return users online optimised for an interval of one (1) hour.
@package
@author Ben Yacoub Hatem <hatem@php.net>
@copyright Copyright (c) 2004
@version $Id$ - 25/05/2004 14:04:22 - sessions.class.php
@access public
|
<?php
class online{
/**
* Constructor
* @access protected
*/
function online(){
}
/**
*
* @access public
* @return void
**/
function who(){
$path = session_save_path();
if (trim($path)=="") {
return FALSE;
}
$d = dir( $path); $i = 0;
while (false !== ($entry = $d->read())) {
if ($entry!="." and $entry!="..") {
$SESS[] = $entry;
if (filemtime($path."/$entry") < strtotime('-0 days 1 hours')) {
$content[] = implode('',file($path."/$entry"));
$i++;
}
}
}
$d->close();
$result = "<span class=tab-s>$i Online users</span><br>\n";
return $result;
}
}
$o = new online;
echo $o->who();
?> | | |
|
| Encrypted Sessions Categories : PHP, PHP Classes, Sessions | | | A beginner's session handling class Categories : PHP, PHP Classes, Sessions, Beginner Guides | | | base64 with encryption - encode and decode sessions Categories : PHP, PHP Classes, Encryption, Sessions | | | SPL and ITERATOR : examples Categories : PHP, Object Oriented, PHP Classes, Sessions | | | Session Validation Methods (Security Checks) Categories : PHP, Sessions, Security | | | Filter - A simple class that lets you use multiple functions to create custom filters. Categories : PHP, PHP Classes, Strings | | | PHP5 SQLite Abstraction class Categories : PHP, PHP Classes, SQLite, Databases | | | DbObject - A PHP wrapper for working with various databases Categories : Databases, PHP, PHP Classes | | | The Ajax Tree view class fetches data from a db for the requested parent category id. The data is then stored in an array and converted into JSON (Javascript Object Notation) format. This format is then used by JavaScript for populating tree view. Categories : PHP, PHP Classes, Java Script, AJAX, Databases | | | Securing Web Forms with Simple PHP-CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart)
Categories : PHP, Security, GD image library, Sessions | | | Simple class that uses GD to draw pie charts. After the class definition there's some sample code to demonstrate how you use the class.
Categories : Graphics, PHP, PHP Classes, GD image library, Charts and Graphs | | | Browser Detecor Class Categories : PHP Classes, PHP, HTML | | | Bs_IniHandler is a class that can read and write ini-style files (and strings) Categories : PHP, Filesystem, PHP Classes | | | PostGreSQL and MySQL 2 in 1 db Manager Categories : PHP, PHP Classes, Databases, PostgreSQL, MySQL | | | [PHP5] aDB PDO LIKE Database Abstraction. Switch easily from one db server to another, strong errors management, manage transactions, queries preparation and more. Categories : PHP, PHP Classes, Databases, MS SQL Server, MySQL | |
|
|