Brugte en gang dette, men det var jo så for antal visniger på en enkelt side:
<?
/*
|- ----------------------------------------------------------
|- Simple Visitor Counter Script
|- Author: Tre - tre@lansystems.com
|- Created: (6/22/2000) (e)
|- ----------------------------------------------------------
|- Info:
|- Example Script / Tutorial
|- Guidance via comments
|- Format:
|- // Code Explanation
|- line_of_code();
|- Req's:
|- Data file must have permissions set
|- to allow overwriting.
|- PHP4 functions used...
|-
|- ----------------------------------------------------------
*/
// Set var to local path to the counter file.
$data_file = "counter.txt";
// Create array using the file() function to open the datafile.
$data_in = file($data_file);
// If the array is null,
if (!$data_in) {
// Throw error.
echo "Error: Could not open data file.";
// And exit the script.
exit;
}
// Set var $visits to the trimmed first element of the file input array.
$visits = trim($data_in[0]);
// If the var $visits does not equal null,
if ($visits != "") {
// Increment the var by 1
$visits++;
// Use fopen to create file pointer var $data_out.
$data_out = fopen($data_file,"w");
// Use fputs to write the new total visits to the file.
fputs($data_out,$visits);
// Use fclose to close the file for output.
fclose($data_out);
// Echo output count and text.
echo "$visits Visit[s]";
}
// Else, meaning $visits was null,
else {
// Throw error.
echo "Error: Could not increment counter.";
}
// End Script
/*
|- ----------------------------------------------------------
|- (e) and all documents created "under" the
|- symbol are Copyleft Tre Harmon 1998+
|- ----------------------------------------------------------
|- What is Copyleft?
|-
http://gnu.org/copyleft/copyleft.html |-
|- Main Site Url:
|-
http://php.lansystems.com |-
|- Feel free to edit or mirror...
|- ----------------------------------------------------------
*/
?>
Men kunne vel nok laves om til at indholde flere links/filer