It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

invisible counter help

Moderator: Malcolm

invisible counter help

Postby Phate on Mon Oct 10, 2005 2:02 am

I am currently using the "invisible counter"
Code: Select all
<?php

$filename = "counter.txt";

$fp=fopen($filename,"r");
$count=fgets($fp,1024);
fclose($fp);
$fw=fopen("$filename","w");
$cnew=$count+1;
$countnew=fputs($fw,$count+1);
fclose($fw);

?>


However, I dont want it to be invisible anymore. I want it to say:
This page has been viewed XX times.

How can I do this?
Web-Developing since '03
Image
User avatar
Phate
500+ Club
 
Posts: 826
Joined: Sun Nov 21, 2004 4:12 am
Location: 127.0.0.1

Postby webmaster on Mon Oct 10, 2005 6:19 am

Like this:

[php]<?php

$filename = "counter.txt";

$fp=fopen($filename,"r");
$count=fgets($fp,1024);
fclose($fp);
$fw=fopen("$filename","w");
$cnew=$count+1;
$countnew=fputs($fw,$count+1);
fclose($fw);

echo "This page has been viewed " . $cnew . " times.";

?>[/php]
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby Phate on Mon Oct 10, 2005 6:13 pm

thanks man!
Web-Developing since '03
Image
User avatar
Phate
500+ Club
 
Posts: 826
Joined: Sun Nov 21, 2004 4:12 am
Location: 127.0.0.1


Who is online

Users browsing this forum: No registered users and 2 guests