/** Searches a string for an array of posibilities. */ function array_stringsearch($string, $arr){ return knjarray::stringsearch($string, $arr); }
/** Returns the registered operating-system - "windows", "linux", "mac" or "bot". */ static function getOS(){ require_once("knj/functions_array.php"); $bots = array( "yahoo! slurp", "msnbot", "googlebot", "adsbot", "ask jeeves", "conpilot crawler", "yandex", "exabot", "hostharvest", "dotbot", "ia_archiver", "httpclient", "spider.html", "comodo-certificates-spider", "sbider", "speedy spider", "spbot", "aihitbot", "scoutjet", "com_bot", "aihitbot", "robot.html", "robot.htm", "catchbot", "baiduspider", "setoozbot", "sslbot", "browsershots", "perl", "wget", "w3c_validator" ); if (array_key_exists("HTTP_USER_AGENT", $_SERVER)){ $ua = strtolower($_SERVER["HTTP_USER_AGENT"]); }else{ return "unknown"; } if (strpos($ua, "windows") !== false){ return "windows"; }elseif(strpos($ua, "linux") !== false){ return "linux"; }elseif(strpos($ua, "mac") !== false){ return "mac"; }elseif(strpos($ua, "playstation") !== false){ return "playstation"; }elseif(strpos($ua, "nintendo wii") !== false){ return "wii"; }elseif(knjarray::stringsearch($ua, $bots)){ return "bot"; }elseif(strpos($ua, "sunos") !== false){ return "sun"; }elseif(trim($ua) == ""){ return false; }else{ return "unknown"; } }