Jump to content


Photo

Cpannel


  • Please log in to reply
21 replies to this topic

#21 [MoD]Cha0s C0ntr0L

[MoD]Cha0s C0ntr0L

    title available

  • Project Team
  • 1,340 posts
  •  Not here

Posted 09 April 2005 - 01:41 AM

If you want it to count page views, and not unique visits, you could try:

<?php
$fp=fopen("counter.txt","r");
$count=fgets($fp,1024);
fclose($fp);
$fw=fopen("counter.txt","w");
$cnew=$count+1;
$countnew=fputs($fw,$count+1);
fclose($fw);
echo "$cnew";
?>

note: you need a file named counter.txt in the same directory, and it needs to start off with the number 0 in it.  Simply include it on any page you want counted.

<{POST_SNAPBACK}>


Nice scriptz0r :grin:

#22 the_kid

the_kid

    L337 Pwnerer of N00bs

  • Project Team
  • 1,734 posts
  • Location:La$ Vega$, NV
  • Projects:freelancing between what interests me
  •  + TRIPLEhelix

Posted 09 April 2005 - 06:56 AM

i use to use that script... but erm every now and then the text file would reset if there was an error loading the script or the page. so I've switched to a mysql one, and never have messing with mysql before hand (well, never writing a script that used one) it took me a bit of time to get it to work properly, but then i was able to make a users online and most users online script along with it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users