?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?how to make counter?
Author:??(202.174.149.---)
Date:???02-17-04 09:03

I just one to make a counter but i don't know how to make that i found some tutorial but i didn't get any thing in detail
$count = ("counter.txt");
//now this is where we open the file
$visits = file($count);
//this adds 1 hit
$visits[0]++;
//Now open the counter
$fp = fopen($count , "w");
//put the new count value into the txt file
fputs($fp , "$visits[0]");
//close the file
fclose($fp);
//display the count
echo $visits[0];
?>
Save as counter.php or anything you wish

Now just upload the counter.php and counter.txt to the same dir, and command the txt file to 777
then this hould work perfect!

To add the counter to anywhere on your site just add the following code
include ("counter.php");
?>
i try this one but i don't understant this line
Now just upload the counter.php and counter.txt to the same dir, and command the txt file to 777
then this hould work perfect!

what it means is there any one who show me right way to make counter

?Topics Author? Date
?how to make counter???new
Suman 02-17-04 09:03?
?Re: how to make counter???new
bastien 02-17-04 09:11?
?Re: how to make counter???new
Suman 02-17-04 09:30?
?Re: how to make counter???new
Suman 02-18-04 07:54?
?Re: how to make counter???new
eon 02-23-04 17:19?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > I just one to make a counter but i don't know how to make > that i found some tutorial but i didn't get any thing in detail > $count = ("counter.txt"); > //now this is where we open the file > $visits = file($count); > //this adds 1 hit > $visits[0]++; > //Now open the counter > $fp = fopen($count , "w"); > //put the new count value into the txt file > fputs($fp , "$visits[0]"); > //close the file > fclose($fp); > //display the count > echo $visits[0]; > ?> > Save as counter.php or anything you wish > > Now just upload the counter.php and counter.txt to the same > dir, and command the txt file to 777 > then this hould work perfect! > > To add the counter to anywhere on your site just add the > following code > include ("counter.php"); > ?> > i try this one but i don't understant this line > Now just upload the counter.php and counter.txt to the same > dir, and command the txt file to 777 > then this hould work perfect! > > what it means is there any one who show me right way to make > counter ">??

Provided By
Phorum