این یک نمونه شه که تنها با php نوشتمش.اگه می خوای php+html+txt باشه بگو چی می خوای تا کدش رو واست بنویسم.
این کد شمارنده تعداد بازدید ها است.یک فایل txt با نام visitors ایجاد کند بقیه اش رو php انجام میده :
<?php
$myfile = "visits.txt";
//we assign our file name to the variable we'll use to handle it
if(file_exists($myfile))//if the file exists
{ //we run our counter script
$var = fopen( $myfile,'r+');
//opens in read and write mode our file
$visits = fread($var,filesize($myfile));
//puts the content of the file for its whole lenght
rewind( $var );
//resets the file position indicator to the beginning
$visits++; //increments the actual number of vists by 1
fwrite($var, $visits);
//writes on the variable the actual (incremented) value
fclose($var);//closes our file reference
}
else
{
print "File $myfile doesn't exist...";
Die();
//if the file doesn't exist prompts a warning and kills the script
}
$message = sprintf("%s visitors since 08/20/2005.",$visits);
//saves our visits message in a variable ($message) that will be used as output
print $message;
?>