Can anyone point me out or tell me how to code a referer log? I needed something that records the referer URL and save it into a text file somewhere in the server. Appreciate it, TheRazor
$f_name = 'ref_log.txt'; if(isset($_SERVER[''HTTP_REFERER''])) file_put_contents($f_name,$_SERVER[''HTTP_REFERER'']."\n"); Code (markup): php5+ only
So any of these examples actually need a MySQL database, right? It's just pasting the piece of php code on the page and it's done?
No. 1. Create log file 2. Edit the php code with your log file name 3. If your using SmartFTP, right click on your log file and on the bottom hit properties, then edit the properties to 777, this is called chmodding. None of this needs a mysql database.
If this is on a server where you are able to restart/reload apache, using the CustomLog directive in your sites httpd.conf is a lot more efficient. If you're on shared hosting, just ignore this post.