|
|
Does any one have a php counter script? - Free counter script? | ||
Discussion by prodigy with 15 Replies.
Last Update: February 27, 2005, 2:22 pm | |||
![]() |
|
|
Then put this on your file:
CODE
<?php[br]$count = file_get_contents('counter.txt')+1;[/br]fwrite(fopen('counter.txt', 'w+'), $count);[br]echo $count;[/br]?>
QUOTE (Roly)
First upload a file anmed 'counter.txt' and chmod it to 666 with your ftp.Then put this on your file:
CODE
<?php[br]$count = file_get_contents('counter.txt')+1;[/br]fwrite(fopen('counter.txt', 'w+'), $count);[br]echo $count;[/br]?>uhh... shouldn you chmod it to 777 not 666?
QUOTE (jailbox)
uhh... shouldn you chmod it to 777 not 666?You can chmod it to any of those
I think the solution will be to create a counter which interacts with sessions or something like that.
Does anyone has a counter which works as i explained?
Thanks in advance.
Sergio
or Search in google.com
i tested over 500 counter and statistic scripts (big numer load of time)
look goyz
i have selected 10-20 of the best(be adviced that i dont use txt scripts only the ones based on Db's)
if any want a name or a script
just pm me
take care
Also it's very easy to use if you know the basics of php. It uses a MySQL database.
The error is
1 The count may not be correct. Suppose one request get count=1. At the mean time, another request get the same count=1. after both write finish, count=2 instead of count=3
2 The write to the file may cause the file corrupt, because fopen is not locked even you open it for write.
the process should be:
<?
fopen()
flock(LOCK_EX)
fread()
count++
fwrite()
flock(LOCK_UN)
fclose()
?>
QUOTE (Roly)
First upload a file anmed 'counter.txt' and chmod it to 666 with your ftp.Then put this on your file:
CODE
<?php$count = file_get_contents('counter.txt')+1;
fwrite(fopen('counter.txt', 'w+'), $count);
echo $count;
?>
QUOTE (no9t9)
omg.. the last post in this thread was over 4 months ago.. And the original poster isn't even a member of the board anymore! Why bring back a thread that has been dead for so long? Arrrrrggh..
Where can i find this CMS is really funny
So , U Can find Many Website support PHP Scripts Like hotscripts.com and You can search on search EN and u can find many tutoial about Flatfile And SQL for Counter Script and u can Use CGI Counter in Cpanel
I think best counter is Cpanel Counter
No DB No File Easy And Fast And No Space for upload Files
Similar Topics:
Php News Script
Php Upload Files To Secure Director...
Php From File To Javascript
Small PHP Board (0)
|
(2) Guestbook Script (Using Flat Files, no database)
|
Loading...
HOME 






