nitestryker Posted March 31, 2009 Share Posted March 31, 2009 I am not sure if I am posting this in the proper place but, feel free to move it I would like to share my source code with the PHPFreaks Community. I don't know how important people will find this script but Here it is anyways Description: This Scripts send you an Email alert when a bot is indexing a directory on your site. for me that is important because I might not want certain directories open to the public, I like to know when Google Is indexing my page so that I don't have any security vulnerabilities. then if i need to I can always password protect that directory or do whatever else is necessary. so here it is enjoy feel free to take my script and edit/modify to your liking. <? /* Bots Email Alert */ /*edit the email address for alerts */ /* Created by Jeremy Stevens 2009 */ $email = "yourname@example.com"; if( eregi("googlebot", $_SERVER['HTTP_USER_AGENT']) ) { $serv = $_SERVER['HTTP_USER_AGENT']; $req = $_SERVER['REQUEST_URI']; mail($email, "Googlebot Alert", "Google just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Lycos_Spider_(T-Rex)", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Lycos Spider Alert", "Lycos Spider has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Ask Jeeves/Teoma", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "LAsk Jeeves/Teoma Spider Alert", "Ask Jeeves/Teoma Spider has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Architext spider", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Excite Spider Alert", "Excite has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("FAST-WebCrawler", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "FAST-WebCrawler Alert", "FAST-WebCrawler has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Yahoo Slurp", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Yahoo Slurp Alert", "Yahoo Slurp has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("InfoSeek sidewinder", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "InfoSeek Bot Alert", "InfoSeek Bot has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("MSNbot", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "MSN Bot Alert", "MSN bot has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Scooter", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "AltaVista Spider Alert", "AltaVista Spider has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Scrubby", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Scrubby Spider Alert", "scrubby Spider has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Slurp/3.0", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Slurp Spider Alert", "slurp Spider has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Teoma_agent1", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Teoma_agent1 Spider Alert", "slurp Spider has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Winona", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Winona Spider Alert", "Winona Spider has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("ZyBorg", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "ZyBorg Spider Alert", "ZyBorg Spider has just indexed your following page: " . $_SERVER['REQUEST_URI']); } else /* Non Search Engine Bots */ if( eregi("Almaden", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Almaden Spider Alert", "Almaden Spider is snooping around on the following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Cyveillance", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Cyveillance Spider Alert", "Cyveillance Spider is snooping around on the following page: " . $_SERVER['REQUEST_URI']); } else if( eregi("Indy Library", $_SERVER['HTTP_USER_AGENT']) ) { mail($email, "Indy Library(Email harvester)Alert", "Indy Library Spider is snooping around on the following page: " . $_SERVER['REQUEST_URI']); } else ?> Installation Instructions: 1. Change the Email Address 2. Upload the script on to your server 3. Include the script to your index file using the following Code: <? include('scriptfile.php');?> Quote Link to comment 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.