...

View Full Version : How to make a hit counter with HTML



ZJ2001
08-23-2004, 06:12 AM
I was wondering if there is a way to make a hit counter using HTML. If any body knows of a way please reply. :confused:

WA
08-23-2004, 09:12 AM
Hmm unfortunately you'll need a server side script for this, such as PHP or CGI. Your best bet is simply to download a premade counter script. Check out http://hotscripts.com for leads.

gsnedders
08-23-2004, 03:38 PM
DesignersToolz wrote a simple counter script... then raf found a script in a comment at php.net to add st, nd, rd, th onto the end, here is the script put together:


function nth($in)
{
if(strlen($in)>1 && substr($in,-2,1)==1)
return $in."th";
switch(substr($in,-1,1))
{
case 1:
return $in."st";
case 2:
return $in."nd";
case 3:
return $in."rd";
default:
return $in."th";
}
}
$getcount = fopen("count.txt", "r");
while (!feof($getcount))
{
$oldcount .= fgets($getcount);
}
fclose($getcount);
$oldcount++;
$storenew = fopen("count.txt", "w");
fputs($storenew, $oldcount);
fclose($storenew);

print nth($oldcount);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum