Shadow Blade
Morrowland Presents Apron Tutorials
game - design - multimedia - web - programming - tutorials - There are currently viewers visiting Apron Tutorials.
   
 
TECHNICAL
GRAPHICAL
SOUND
GAME
WEB
ARTICLE
TOOL
PROJECT
 
 NEWS

  news

  history


 TECHNICAL TUTORIALS

  opengl

  direct3d

  c/c++

  visual basic

  java

  c#


 WEB TUTORIALS

  html

  dhtml

  asp

  php


 IMAGE EDITING

  photoshop

  draw sketch


 3D MODELING

  3d studio


 PROJECTS

  shadow blade

  game environment

  virtual 3d guide

  billy blue flame


 DEMOS

  win32 api


 ARTICLES

  general

  opengl


 COMMUNITY

  about us

  credit

  contact






YOUR HIT COUNTER IN PHP
I will in this tutorial show you how to make a simple hit counter, using a textfile.



Making the Hit-counter

When a user enters your site, you have to update the textfile. I have called my textfile, mycounter.txt. I first get the current value and then increment this before I store it. And at the end, I display the viewers that have entered the site. The code is given below. It is important that you give the textfile write permission.

//the filename
$filename = "mycounter.txt";
//open the file
$fileToOpen = fopen($filename,"w");
//set the content of the file into a variable
$content = fread($fileToOpen, filesize($filename));

//check if the textfile is empty
if($content == "")
{
 $content = 0;
}

//increment the file
$content++;
//store the file
fputs($content);
//close the file
fclose($fileToOpen);

//display the hits
echo($content);



PROJECT DESCRIPTION
Category Programming with PHP
Author Tommy Johannessen





Ronny André Reierstad
Morrowland All rights reserved Morrowland © 2002 Apron Tutorials

 LINKS

  morrowland home



 GAME DEVELOPEMENT

  nvidia

  gamedev

  polycount


 PROJECTS

  shadow blade

  game environment

  virtual 3d guide

  billy blue flame


 MATH AND PHYSICS

  mathworld

  physicsworld







PLEASE LINK TO


  All rights reserved Morrowland © 2007  
Ronny André Reierstad