Page 1 of 1

Counting how many times a address has been accessed

Posted: Sat Feb 28, 2004 9:39 am
by gangboy
What I would like to do is to store in a file the number of times that a website was visited.

I already have the following extern.php file:

Code: Select all

<?php
if (!empty($_GET['catre'])) { 
    $catre = $_GET['catre']; 
} else { 
    $catre = "null"; 
} 

if ($catre != "null") { 
   header("Location:http://$catre"); 
}  else { 
   echo "Dump!";
}
?>
How can I generate, mantain and read from a "extern.txt" file the number of times a user goes to a website; let's say http://localhost/extern.php?catre=www.yahoo.com

Hope this isn't too much but I didn't figured it by myself. Thanks in advance for bothering :)

Posted: Sat Feb 28, 2004 9:52 am
by Illusionist
Well, your first going to want to learn how to open files, write to files, and read from files. Then your going to want to read from the file. Get the number, increase it then write it back.