<?php function getServerAddress() { if($_SERVER['SERVER_ADDR']) { return $_SERVER['SERVER_ADDR']; } $ifconfig = shell_exec('/sbin/ifconfig eth0'); preg_match('/addr:([\d\.]+)/',$ifconfig,$match); return $match[1]; } ?> borg at sven-of-nine dot de 30-Jan-2007 07:22 Simple function to determine if a visitor is an agent or not function isbot($agent="") { //Handfull of Robots $bot_array =array("jeevesteoma", "msnbot", "slurp", "jeevestemoa", "gulper", "googlebot", "linkwalker", "validator", "webaltbot", "wget"); //no agent given => read from globals if ($agent=="") { @$agent=$_SERVER["HTTP_USER_AGENT"]; } //replace all but alpha $agent=strtolower(preg_replace("/[^a-zA-Z _]*/","",$agent)); //check für intersections return((BOOL)count(array_intersect(explode(" ",$agent),$bot_array))); } Joe Marty 25-Jan-2007 03:53 I think it is very important to note that PHP will automatically replace dots ('.') AND spaces (' ') with underscores ('_') in any incoming POST or GET (or REQUEST) variables. |