Code: Select all
Page Viewed <?
$fp = fopen('Siteviews.txt', 'r+'); // Open Page .txt for reading from beginning
$read = fread($fp, '1000'); // Read from the file pointer
print($read);
$read+1;
$read = fread($fp, $read); ?>
Times<br>Moderator: General Moderators
Code: Select all
Page Viewed <?
$fp = fopen('Siteviews.txt', 'r+'); // Open Page .txt for reading from beginning
$read = fread($fp, '1000'); // Read from the file pointer
print($read);
$read+1;
$read = fread($fp, $read); ?>
Times<br>Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This is what I found a while ago and it works for me. You need to beef it up for your taste.
Good luck.Code: Select all
<?php
$file = fopen("counter.txt",(is_file("counter.txt"))?"r+":"w+");
$count = fread($file, filesize("counter.txt"));
rewind($file);
$count +=1;
fputs($file, $count);
fclose($file);
echo "You are visitor : $count";
?>Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]