PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Alfredo Sanchez   Online Visitors Count   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Sample Code
Class: Online Visitors Count
Keep track of the current site number of visitors
Author: By
Last change: Added database wrapper and a configuration file
Date: 15 years ago
Size: 392 bytes
 

Contents

Class file image Download
<?php

   
require_once("configuration.php");
    require_once(
"class.database.php");
    require_once(
"class.visitors.php");
   
   
$visitor = new visitors();
   
$visitor->insert();
   
// display online users, no parameters
   
echo $visitor->display();
   
   
// display hits
   
echo $visitor->display(1);
   
   
// display online users, same as without parameters
   
echo $visitor->display(2);

?>