![]() |
|
|
#1
|
||
|
A common feature on most websites is a counter to show how many visitors have been to your site. This is our first example to show how to achieve this .
This example is very basic and far from ideal if you want an accurate count of your visitors because if you press refresh your counter will always increment by 1. This example does show some useful techniques such as opening and closing files. Lets go through the process one step at a time . Firstly you have to create a simple text file and enter the number you wish the counter to start at , note this does not have to be 1 it can be any number you wish. The next task will be to upload this to your server , if you have a Unix server this is where you have to watch because you have to set the permissions for your text file so the script can read and write to the file . To change this you CHMOD your text file to 755. Refer to the help file or documentation of your FTP program to see how to achieve this. Now for the script , call this something like counter.php PHP Code:
Now add the following to your page where you wish the counter to appear PHP Code:
And that's it. You now have a working counter ready to be used!
__________________
█ INCRIPT TECHNOLOGIES - webhosting India █ iTALKS FORUMS - Designing & Hosting Community |
|
|
|
||
|
#2
|
||
|
I started a thread to find something similar yesterday. I didn't see this thread earlier. Thats what I was looking for thanks bunches.
![]()
__________________
|
|
|
|
||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|