Code written by php about the crawler record of static pages
$ Useragent = addslashes (strtolower ($ _ SERVER ['http _ USER_AGENT ']);
- If (strpos ($ useragent, 'googlebot ')! = False) {$ bot = 'Google ';}
- Elseif (strpos ($ useragent, 'mediapartners-google ')! = False) {$ bot = 'Google Adsense ';}
- Elseif (strpos ($ useragent, 'baidider Ider ')! = False) {$ bot = 'baidu ';}
- Elseif (strpos ($ useragent, 'sogou spider ')! = False) {$ bot = 'sogou ';}
- Elseif (strpos ($ useragent, 'sogou web ')! = False) {$ bot = 'sogou web ';}
- Elseif (strpos ($ useragent, 'sosospider ')! = False) {$ bot = 'sososo ';}
- Elseif (strpos ($ useragent, 'Yahoo ')! = False) {$ bot = 'Yahoo ';}
- Elseif (strpos ($ useragent, 'MSN ')! = False) {$ bot = 'MSN ';}
- Elseif (strpos ($ useragent, 'msnbot ')! = False) {$ bot = 'msnbot ';}
- Elseif (strpos ($ useragent, 'sohu ')! = False) {$ bot = 'sohu ';}
- Elseif (strpos ($ useragent, 'yodaobot ')! = False) {$ bot = 'yodao ';}
- Elseif (strpos ($ useragent, 'twiceler ')! = False) {$ bot = 'twiceler ';}
- Elseif (strpos ($ useragent, 'ia _ archiver ')! = False) {$ bot = 'Alexa _';}
- Elseif (strpos ($ useragent, 'iaarchiver ')! = False) {$ bot = 'Alexa ';}
- Elseif (strpos ($ useragent, 'slurp ')! = False) {$ bot = 'Yahoo ';}
- Elseif (strpos ($ useragent, 'bot ')! = False) {$ bot = 'other Spider ';}
- If (isset ($ bot )){
- $ Fp = @fopen('bot.txt ', 'A ');
- Fwrite ($ fp, date ('Y-m-d H: I: s '). "\ t ". $ _ SERVER ["REMOTE_ADDR"]. "\ t ". $ bot. "\ t ". 'http ://'. $ _ SERVER ['server _ name']. $ _ SERVER ["HTTP_X_REWRITE_URL"]. "\ r \ n ");
- Fclose ($ fp );
- }
- $ File = ".". $ _ SERVER [HTTP_X_REWRITE_URL];
- $ F_head = substr ($ file,-5 );
- If ($ f_head = ". html ")
- {
- If (file_exists ($ file ))
- {
- Echo file_get_contents ($ file );
- } Else
- {
-
- Header ('http/1.1 404 Not Found ');
- Header ("status: 404 Not Found ");
Echo "this page cannot be found ";
- }
- }
- Else
- {
- Header ('http/1.1 404 Not Found ');
- Header ("status: 404 Not Found ");
- Echo "this page cannot be found ";
- }
- ?>
Pseudo static file content:
[ISAPI_Rewrite]
#3600 = 1 hour
- CacheClockRate 3600
-
- RepeatLimit 32
-
- # Protect httpd. ini and httpd. parse. errors files
- # From accessing through HTTP
- RewriteRule/index.html/index. php
- RewriteRule ^/article/(. *)/bot. php [L]
- RewriteRule ^/list/(. *)/bot. php [L]
|