Login   Register  
PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mario Enrique López Guzmán  >  counter visits class  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Main example
Class: counter visits class
Record site visits in a MySQL database
Author: By
Last change: change for new example
Date: 2004-09-17 16:39
Size: 1,688 bytes
 

Contents

Class file image Download
<?php

include_once ("./config.inc.php");
include_once(
"./counter.class.php");

unset(
$visited);
session_start();
 
$statics = new counter();
 
$conn $statics -> connect();
 
$statics->increment();
 
$visitstoday $statics->visitstoday();
 
$visitstotal $statics->visitstotal();
 print 
"Today visits: <b>".$visitstoday."</b>";
 print 
"<br>Total visits: <b>".$visitstotal."</b>";
 
 if (isset(
$daysearch)) {
 
$daysearch $year.$month.$day;
 if (
$daysearch == "" ) { 
 print 
"<br>Enter correct values for search!!!"
 print 
"<FORM ACTION = \"?$daysearch\" METHOF=\"POST\">";
 print 
"<INPUT TYPE = \"HIDDEN\" NAME = \"daysearch\" VALUE=1>";
 print 
"Year: <br> <INPUT TYPE = \"TEXT\" NAME = \"year\" MAXLENGTH=4><br>";
 print 
"Month: <br> <INPUT TYPE = \"TEXT\" NAME = \"month\" MAXLENGTH=2><br>";
 print 
"Day: <br> <INPUT TYPE = \"TEXT\" NAME = \"day\" MAXLENGTH=2><br>";          
 print 
"<INPUT TYPE = \"SUBMIT\" NAME = \"see it!!!\">";    
 print 
"</FORM>";
  exit;}
 
 
$visitsday $statics->visitssearch($daysearch);
 print 
"<br>Total visits at : <b>".$year."/".$month."/".$day."/" ." was :" .$visitsday."</b>";
 }
 
 print 
"<FORM ACTION = \"?$daysearch\" METHOF=\"POST\">";
 print 
"<INPUT TYPE = \"HIDDEN\" NAME = \"daysearch\" VALUE=1>";
 print 
"Year: <br> <INPUT TYPE = \"TEXT\" NAME = \"year\" MAXLENGTH=4><br>";
 print 
"Month: <br> <INPUT TYPE = \"TEXT\" NAME = \"month\" MAXLENGTH=2><br>";
 print 
"Day: <br> <INPUT TYPE = \"TEXT\" NAME = \"day\" MAXLENGTH=2><br>";          
 print 
"<INPUT TYPE = \"SUBMIT\" NAME = \"see it!!!\">";    
 print 
"</FORM>";
 
 
$statics -> disconnect($conn);
 
session_register("visited");
 
$visited=1;
?>