WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Identify and log search engine access (spiders, robots, etc.) to a page.
Categories : HTTP, Environment Variables, PHP, MySQL, Databases Update Picture
Michael Kablitz
Date : Oct 28th 1998
Grade : 3 of 5 (graded 3 times)
Viewed : 14782
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Michael Kablitz
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?
/***************************************************************************/
/* You can log search engine activity on your web pages with this script. */
/* Use require("logspiders.php3"); on top of the page you wish to monitor. */
/* */
/* Michael Kablitz (mkab@zedat.fu-berlin.de) 28 Oct 1998 */
/***************************************************************************/


/**** user variables ****/

$log_file = "/home/joe/log/spiderlog"; /* create this file and chmod 777 */
$date = date("d.M.Y H:i:s", time());


/* Major search engines match either $spider_footprint or $spider_ip. */
/* If no match can be made, popular browsers are sorted out and the */
/* request is supposed to be from a smaller search engine. */

$spider_footprint = array("cooter", "lurp", "rawler", "pider", "obot", "eek",
"oogle", "canner", "rachnoidea", "ulliver", "arvest", "ireball", "idewinder");

$spider_ip = array("204.123.", "204.74.103.", "203.108.10.", "195.4.183.",
"195.242.46.", "198.3.97.", "204.62.245.", "193.189.227.", "209.1.12.",
"204.162.96.", "204.162.98.", "194.121.108.", "128.182.72.", "207.77.91.",
"206.79.171.", "207.77.90.", "208.213.76.", "194.124.202.", "193.114.89.",
"193.131.74.", "131.84.1.", "208.219.77.", "206.64.113.", "195.186.1.",
"195.3.97.", "194.191.121.", "139.175.250.", "209.73.233.", "194.191.121.",
"198.49.220.", "204.62.245.", "198.3.99.", "198.2.101.", "204.192.112.",
"206.181.238", "208.215.47.", "171.64.75.", "204.162.98.", "204.162.96.",
"204.123.9.52", "204.123.2.44", "204.74.103.39", "204.123.9.53", "204.62.245.",
"206.64.113.", "194.100.28.20", "204.138.115.", "94.22.130.", "164.195.64.1",
"205.181.75.169", "129.170.24.57", "204.162.96.", "204.162.96.", "204.162.98.",
"204.162.96.", "207.77.90.", "207.77.91.", "208.200.146.", "204.123.9.20",
"204.138.115.", "209.1.32.", "209.1.12.", "192.216.46.49", "192.216.46.31",
"192.216.46.30", "203.9.252.2");
/* Visit www.searchengine.com to keep the list up to date */

$browser_footprint = array("95", "98", "MSIE", "NT", "Opera", "16", "32",
"MAC", "Mac", "X11", "WebTV", "OS", "Lynx", "IBrowse", "IWENG", "PRODIGY",
"Mosaic", "InterGO", "Gold", "zzZ", "Mozzarella", "Vampire", "Cache", "libwww",
"TURBO", "WebCompass", "Konqueror", "Wget", "Amiga");
/* 'Mozilla' is not included, for many spiders pretend to be a Mozilla */
/* browser. Regular Mozilla browsers include almost always one of the */
/* above footprints additionally. */



/**** spider or not? ********/

$agent = getenv('HTTP_USER_AGENT');
$host_ip = getenv('REMOTE_ADDR');
$is_spider = 0;

$i = 0;
while ($i < (count($spider_footprint))) {
        if (strstr($agent, $spider_footprint[$i])) {
                $is_spider = 1;
                break;
        }
        $i++;
}

if ($is_spider != 1) {
        $i = 0;
        while ($i < (count($spider_ip))) {
                if (strstr($host_ip, $spider_ip[$i])) {
                                $is_spider = 1;
                                break;
                        }
                        $i++;
        }
}

if ($is_spider != 1) {
        $is_spider = 1; /* when in doubt, it's logged */
        $i = 0;
        while ($i < (count($browser_footprint))) {
                if (strstr($agent, $browser_footprint[$i])) {
                        $is_spider = 0;
                        break;
                }
                $i++;
        }
}



/*** log the spider access ***/

if ($is_spider = 1) {
        $host_name = @GetHostByAddr($host_ip);

        $readit = file($log_file);
        
        $i = 0;
        while ($i < (count($readit))) {
                $alreadythere = $alreadythere.$readit[$i];
                $i++;
        }
        
        $newentry = "URL: $PHP_SELF, Date: $date, RemoteHost: $host_name
($host_ip), UserAgent: $agent\n";

        $fp = fopen($log_file, "w" );
        fputs($fp, $alreadythere.$newentry);
        fclose($fp);
}

?>



This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server.
Categories : Databases, MySQL, Complete Programs, PHP, Databases
Inserting data to a MySQL Database using AJAX
Categories : AJAX, HTTP, PHP, Databases, MySQL
A simple script to count and report hits and the last modification time of an HTML page. Requires MySQL support (other DBs should work too, except possibly mSQL).
Categories : HTTP, MySQL, PHP, Databases
usercounter class
Categories : PHP, PHP Classes, Databases, MySQL, Environment Variables
bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
Simple pipe delimited file export program that downloads to a local machine
Categories : PHP, Filesystem, Databases, MySQL, HTTP
The simple counter with use MySql and gd.
Categories : MySQL, HTTP, Graphics, PHP, Databases
AITSH Download
Categories : PHP, Complete Programs, MySQL, Databases
Simple PHP Form Auto Generation based on MySQL query
Categories : PHP, Form Processing, Databases, MySQL, Sessions
Checks Date-Input from HTML-Forms and converts to YYYY-MM-DD Format for MySQL Date-Fields
Categories : MySQL, Date Time, PHP, Databases
How to Insert a Date Format Into MySQL from PHP
Categories : PHP, Databases, MySQL, Date Time, Beginner Guides
A very simple and efficient split bar the B-Z bar , for mysql and php ... Tired of obfuscated code try this one ...
Categories : PHP, Databases, MySQL, Algorithms
How to thread a list of messages in database and show it in a treelike structure
Categories : PHP, MySQL, Databases
Convert SQL from oracle,mysql,mssql,sqlite and odbc to SQL compatible
Categories : PHP, PHP Classes, Databases, MySQL, MS SQL Server
http://phpMySearch.web4.hm - The phpMySearch search engine system is a completeworld wide web indexing and searching system for a small domain or intranet.
Categories : Search Engines, PHP, Databases, MySQL