php+tomcat on windows

Got a task to install php on top of tomcat (Tomcat5) on Windows. Was strugling to make it work for a while. Was reading wrong blogs and newsgroups for a while without success untill I found a very good resource – JavaBridge. It was so easy as to run msi to install php and [...]

anonymous, dynamic, variable classes and methods

To call a method by dynamic name you can do this:

$methodName=”MyMethod”; $result=$methodName();

To create a class by dynamic name you can do this:

$className=”MyClass”; $classVar=new $className;

To call any method by dynamic name in previously initialized class you can do this:

$methodName=”MyMethod”; $result=$classVar->$methodName();

Php Script To Detect And Verify Googlebot

Php Script To Detect And Verify Googlebot

function IsGooglebot(){ // check if user agent contains googlebt if(eregi(“Googlebot”,$_SERVER['HTTP_USER_AGENT'])){ $ip = $_SERVER['REMOTE_ADDR']; //server name e.g. crawl-66-249-66-1.googlebot.com $name = gethostbyaddr($ip); //check if name ciontains googlebot if(eregi(“Googlebot”,$name)){ //list of IP’s $hosts = gethostbynamel($name); foreach($hosts as $host){ if ($host == $ip){ return true; } } return false; // Pretender, [...]