Hi, all
How do I make a Hit Counter for ny web page?
Printable View
Hi, all
How do I make a Hit Counter for ny web page?
does your server have php installed?
YES.Quote:
Originally Posted by dandono
why dont you have a php page as your index and make that so that it adds 1 to the value that is in a text file and make your default page have a little php code that prints what is in that text file to the page.
I do not know how to do it.
My web address is http://bob5731.no-ip.info
http://www.w3schools.com/php
what you want to do is get it to read the value that is in a text doc and then do a sum of (whats in text doc) + 1 and save to the doc. i can make a code but i dont have enough time at the mo. i will make it in like half an hour and post it.
The link dose not work for me.
Here, http://w3schools.com/php/. It's a typo.
Still a bad link.
Figured it out.
http://www.w3schools.com/php/
No help yet.
Full article, here.VB Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title></title> <link rel="stylesheet" href="style.css"/> </head> <body> <?php $count = file_get_contents("count.txt"); $count = explode("=", $count); $count[1] = $count[1]+1; $file = fopen("count.txt", "w+"); fwrite($file, "count=".$count[1]); fclose($file); print "count=".$count[1]; ?> </body> </html>
No help yet.
In html
how do I do it?
Instructions:
1) Download the EZ Counter zip.
2) Unzip its contents and upload the files to your PHP enabled webserver.
3) CHMOD "ezcounter.txt" to "777" so that the file is writeable.
4) Add this line of PHP code to your page to increment and print the counter:
include("ezcounter.php");
You need to follow those instructions. ;)Quote:
Originally Posted by bob5731
How do I do.
CHMOD "ezcounter.txt" to "777" so that the file is writeable
try CHMOD "excounter.txt" to "0777" i dont know if there is a difference between "0777" and "777". sorry that i did not write code in time but someone uploaded a virus to my website (i am not talking about my self) so i have now blocked anonymous ftp on it.
I have used the following code in my page and it works absolutely fine:
<?php
$countfilename = "VisitorCount.txt";
$whattoread = @fopen($countfilename, "r") or die("Error opening count file");
$contents = fread($whattoread, filesize($countfilename));
fclose($whattoread);
$contents = ($contents + 1);
$whattoread = @fopen($countfilename, "w") or die("Error opening count file1");
@fwrite($whattoread, $contents) or die("Error with addition");
fclose($whattoread);
echo $contents;
?>
Just make sure you set the VisitorCount.txt CHMOD to 777. I do this via an FTP client, much easier!!
BIOSTALL
Can you all make the file for me.
U mean the text file or the php file??
the text and php.
try this zip file. it is what i use on my server and it works fine. it is an image counter.