php store visits by referer in an external file

82 views Asked by At

I need to store information about visitors based on $_SERVER['HTTP_REFERER'];.
1) When a visitor comes to the site check if the referer exists in the table, if true then store data about him in the row with that referer. Referer are inserted manually.
2) When a visitor comes to the site with referer that already is in the table, increment the number of visitors sent from that referer, if the visitor has unique referer, add new row in table with this referer.

The table data must be stored in csv, or any other filetype database and it will contain more custom variables based on that referer. A visual example how should this table look to better understand my question:
Referer | Visitors | Var1 | Var2 | Var3
var1 = visitors sent back to that referer; var2 = visitors - var1; var3 = custom variable inputed by user;

About database based on file i read and understand that if script is accesed by more users simultaneously it might not work properly, but i found an answer on here to create a random delay before the fopen();

Also to track how many visitors where sent back to the referer, i think must be used javascript.

Thanks a Lot, And Happy Holidays ! :)

0

There are 0 answers