Counting how many times a address has been accessed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gangboy
Forum Newbie
Posts: 14
Joined: Tue Jan 06, 2004 11:58 am
Location: Constanţa, România

Counting how many times a address has been accessed

Post 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 :)
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post 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.
Post Reply