marksie1988 Posted January 24, 2008 Share Posted January 24, 2008 Is it possible to add to my page a bit that basically says when a spider is on my website, i have seen this in smf and wondered if it is easy to do for a normal website? and does anyone know of a tut? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/87630-solved-track-spiders-on-my-site/ Share on other sites More sharing options...
kts Posted January 24, 2008 Share Posted January 24, 2008 Been looking into this lately as well. I know there are many softwares to purchase, but haven't found a tut yet, will post here if I do. Hope you do the same cheers Quote Link to comment https://forums.phpfreaks.com/topic/87630-solved-track-spiders-on-my-site/#findComment-448219 Share on other sites More sharing options...
marksie1988 Posted January 24, 2008 Author Share Posted January 24, 2008 yea if i find anything i will let you know at the moment im seeing if it is possible to rip the mod appart from smf and use bits of that but i dont reali know where to start :S Quote Link to comment https://forums.phpfreaks.com/topic/87630-solved-track-spiders-on-my-site/#findComment-448232 Share on other sites More sharing options...
Daniel0 Posted January 24, 2008 Share Posted January 24, 2008 Check the useragent. Googlebot's useragent is (surprise!) googlebot for instance. Quote Link to comment https://forums.phpfreaks.com/topic/87630-solved-track-spiders-on-my-site/#findComment-448264 Share on other sites More sharing options...
marksie1988 Posted January 24, 2008 Author Share Posted January 24, 2008 So would something like the following work? and would this be able to post the information for all users to see or just the bot? or would i need to write the information into a database and then display this information? <?php function agent($bot) { $useragent = $_SERVER['HTTP_USER_AGENT']; return strstr($useragent,$bot); } if(agent("WISENutbot") !== FALSE) { echo "Looksmart Bot"; } else if(agent("Googlebot") !== FALSE) { echo "Google Bot"; } else { echo ""; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/87630-solved-track-spiders-on-my-site/#findComment-448282 Share on other sites More sharing options...
redbullmarky Posted January 25, 2008 Share Posted January 25, 2008 it's the way your session handler works. many forums and other CMS's use the database to store sessions, so they can store additional info such as the user agent, IP, etc. This way, all you need is a simple query to the sessions table and you're away. see http://uk.php.net/session_set_save_handler there are other ways of doing it, made easier if you have a common include file for every request (such as a front controller). simply store the IP/Agent/Timestamp, etc followed by a cleanup of records that are older than a certain period, and you're done. Just query the table when you need the info. The reason why I personally use sessions is just keeping all info together as there are many other uses, too. Quote Link to comment https://forums.phpfreaks.com/topic/87630-solved-track-spiders-on-my-site/#findComment-448716 Share on other sites More sharing options...
steelmanronald06 Posted January 26, 2008 Share Posted January 26, 2008 http://www.ronaldsteelman.com the first post on there. I wrote it up real quick like for ya. Has sample code and a site with a list of ALL the bots that exist. Pick your favorite ones and go with it. Quote Link to comment https://forums.phpfreaks.com/topic/87630-solved-track-spiders-on-my-site/#findComment-449584 Share on other sites More sharing options...
marksie1988 Posted January 31, 2008 Author Share Posted January 31, 2008 http://www.ronaldsteelman.com the first post on there. I wrote it up real quick like for ya. Has sample code and a site with a list of ALL the bots that exist. Pick your favorite ones and go with it. tried this but nothing gets written to the database i did it the same as in your tutorial aswell Quote Link to comment https://forums.phpfreaks.com/topic/87630-solved-track-spiders-on-my-site/#findComment-454714 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.