Does anyone know of/ have a script (perhaps php) that can show the latest X number of referers?
Does anyone know of/ have a script (perhaps php) that can show the latest X number of referers?
I don't have/know of a script, but I can think of at least one way to do it. Use a MySQL database to keep track of referers. Every time the page is loaded, stick the referer in the database, and if the number of rows is greater than X, delete the last row.
In php, $_SERVER['HTTP_REFERER'] will tell you the referer.
To expand on this, set up a second column in the above said database. That column will be the "count" column.
Simply do something like this:
Hope this helps.Code:$info = mysql_query("SELECT * FROM `$table`"); while ($qry = mysql_fetch_array($info)) { if ($_SERVER['HTTP_REFERER'] == $qry['referer']) { $qry['count']++; } else { mysql_query("INSERT INTO `$table` (`referer`,`count`) VALUES ('$_SERVER["HTTP_REFERER"]','1')"); } }
Last edited by thetestingsite; 02-27-2007 at 03:36 AM.
Bookmarks