runeveryday Posted August 8, 2010 Share Posted August 8, 2010 now i use this code to show where the visitors came from to my site. <?php $referer=$_SERVER['HTTP_REFERER']; echo $referer; ?> now, i want to show the 5 latest vistors referer's site url on my site ? Quote Link to comment https://forums.phpfreaks.com/topic/210130-how-to-show-the-5-latest-vistors-referers-site-url-on-my-site/ Share on other sites More sharing options...
TOA Posted August 8, 2010 Share Posted August 8, 2010 My guess is you'll need to store them in a file or a database. I think referer only remembers one step back. Quote Link to comment https://forums.phpfreaks.com/topic/210130-how-to-show-the-5-latest-vistors-referers-site-url-on-my-site/#findComment-1096630 Share on other sites More sharing options...
runeveryday Posted August 8, 2010 Author Share Posted August 8, 2010 My guess is you'll need to store them in a file or a database. I think referer only remembers one step back. if i want to put every url into a database table, with the time going , the table will become larger and larger.so, i want to let the database only save one day 's records。 when a new day comes, the old day's record will be deleted. is there a way to get this? Quote Link to comment https://forums.phpfreaks.com/topic/210130-how-to-show-the-5-latest-vistors-referers-site-url-on-my-site/#findComment-1096633 Share on other sites More sharing options...
TOA Posted August 8, 2010 Share Posted August 8, 2010 For sure...both php and mysql can get you the current date to compare against. If you're worried about size (which you shouldn't be, thats what databases do best) then write the script to overwrite so there will be only 5 entries at any time. I would avoid wiping out a full days worth of url's because if someone comes to the site right after you wipe out the list, there will be no url's to show (except their own referer of course). Quote Link to comment https://forums.phpfreaks.com/topic/210130-how-to-show-the-5-latest-vistors-referers-site-url-on-my-site/#findComment-1096634 Share on other sites More sharing options...
runeveryday Posted August 8, 2010 Author Share Posted August 8, 2010 For sure...both php and mysql can get you the current date to compare against. If you're worried about size (which you shouldn't be, thats what databases do best) then write the script to overwrite so there will be only 5 entries at any time. I would avoid wiping out a full days worth of url's because if someone comes to the site right after you wipe out the list, there will be no url's to show (except their own referer of course). how to write a script to overwrite so there will be only 5 entries at any time? Quote Link to comment https://forums.phpfreaks.com/topic/210130-how-to-show-the-5-latest-vistors-referers-site-url-on-my-site/#findComment-1096637 Share on other sites More sharing options...
TOA Posted August 8, 2010 Share Posted August 8, 2010 It would depend on your database setup, but the first time you'd just insert, the rest of the time update Quote Link to comment https://forums.phpfreaks.com/topic/210130-how-to-show-the-5-latest-vistors-referers-site-url-on-my-site/#findComment-1096643 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.