Php counter

I did a search, please don’t beat me too hard if this has been asked a million times.
How could I make a hit counter in PHP? Just a simple text one.
I’m sure it would be an easy task and I have a semi-solid idea how to do it, I just don’t really know how to code it.

I was thinking you would set up a variable that would just be increased each time someone visited a page and that number would be drawn from the text file and displayed. I’m not worried about IP stuffs or anything.

Any help would be thuper

there ya go :wink:
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=18524&highlight=*counter*

http://www.daydreamgraphics.com/tutorials/list.php?cat_id=2

theres a tutorial for a counter on that page…

hmmmm grrrrrr

*Originally posted by ahmed *
**


<<!--- --->?php
$handle = fopen("counter.txt", "r");
$contents = fgets($handle, 4096);
$temp = sprintf("%d", $contents);
$temp++;
fclose($handle);
$handle = fopen("counter.txt", "w");
fputs($handle, "$temp");
fclose($handle);
echo ($temp);
?<!--- --->>

this should do it :slight_smile: **

ok i found that, and im assuming that is what you would put in the html page that would load the variable, but what would be in the txt file?

that is a php file.

save a text file with the extention .php

so that would be

“counter.php”

then make a text file called “counter.txt”

and then in Flash you would loadVariables from counter.php

I’m not doin it in flash:P
I just tried the link you said jubba, and I’m uploading right now to see if it worked

http://xxviii.net/

do you see that big 'ol ugly thingy too?

oh ok, you don’t want flash, then you would use the same code. that prints out the number you want :slight_smile: check out that tutorial, it should be of use… if you don’t know php then Ahmed’s explanation might not help too much…

haha oops… i didnt have it CHMODed
sorry for the dumb post
thanks a ton jubba and ahmed
really helpful as always

just a quick question, how can i edit the color and stuff it displays in?

print out font tags before and after you print out the varialbe…

thanks jubba… got it all worked out now… i even get how it works
thanks for puttin up with me:beam:

*Originally posted by Jubba *
**hmmmm grrrrrr **
sorry jubbs :stuck_out_tongue: :wink:

always beating me! :stuck_out_tongue: