700) { return true; } else { return false; } } ### Auslesen der höchsten Post-ID function sem_getMaxPostID() { global $wpdb; $maxpostid = $wpdb->get_var("SELECT MAX(ID) FROM ".$wpdb->posts." LIMIT 0,1"); return $maxpostid; //Ganzzahl } ### Auslesen des User- bzw. Kommentarautornamen function sem_getUsername() { global $user_ID, $user_login, $isAdmin; get_currentuserinfo(); if($user_ID > 0) { $useronline = $user_login; if(current_user_can('manage_options')) { $isAdmin = 1; } else { $isAdmin = 0; } } elseif(isset($_COOKIE["comment_author_".COOKIEHASH])) { $useronline = trim($_COOKIE["comment_author_".COOKIEHASH]); $isAdmin = -1; } else { $useronline = "Gast"; $isAdmin = -1; } return $useronline; } ### Prüfen, ob Besucher ein Bot ist function sem_AreYouBot($user_agent) { global $isBot; $bots = array( 'aipbot', 'amfibibot', 'appie', 'ask jeeves/teoma', 'aspseek', 'axadine', 'baiduspider', 'becomebot', 'blogcorpuscrawler', 'blogpulse', 'blogsnowbot', 'boitho.com', 'bruinbot', 'cerberian', 'cfnetwork', 'check_http', 'cipinetbot', 'claymont', 'cometsearch@cometsystems.com', 'converacrawler', 'cydralspider', 'digger', 'es.net_crawler', 'eventax', 'everyfeed-spider', 'exabot@exava.com', 'faxobot', 'findlinks', 'fireball', 'francis', 'gaisbot', 'gamekitbot', 'gazz@nttr.co.jp', 'geonabot', 'getrax crawler', 'gigabot', 'girafa.com', 'goforitbot', 'googlebot', 'grub-client', 'holmes', 'houxoucrawler', 'http://www.almaden.ibm.com/cs/crawler', 'http://www.istarthere.com', 'http://www.relevantnoise.com', 'httrack ?', 'ia_archiver', 'ichiro', 'iltrovatore-setaccio', 'inelabot', 'infoseek', 'inktomi.com', 'irlbot', 'jetbot', 'jobspider_ba', 'kazoombot', 'larbin', 'libwww', 'linkwalker', 'lmspider', 'mackster', 'mediapartners-google', 'microsoft url control', 'mj12bot', 'moreoverbot', 'mozdex', 'msnbot', 'msrbot', 'naverbot', 'netresearchserver', 'ng/2.0', 'np(bot)', 'nutch', 'objectssearch', 'ocelli', 'omniexplorer_bot', 'openbot', 'overture', 'patwebbot', 'php', 'phpdig', 'pilgrim html-crawler', 'pipeliner', 'pompos', 'psbot', 'python-urllib', 'quepasacreep', 'robozilla', 'rpt-httpclient', 'savvybot', 'scooter', 'search.ch', 'seekbot', 'semager', 'seznambot', 'sherlock', 'shelob', 'sitesearch', 'snapbot', 'snappreviewbot', 'speedy spider', 'sphere scout', 'stackrambler', 'steeler', 'surveybot', 'szukacz', 'technoratibot', 'telnet', 'themiragorobot', 'thesubot', 'thumbshots-de-bot', 'topicblogs', 'turnitinbot', 'tutorgigbot', 'tutorial crawler', 'twiceler', 'vagabondo', 'versus', 'voilabot', 'w3c_css_validator', 'w3c_validator', 'w3c-checklink', 'web downloader', 'webcopier', 'webcrawler', 'webfilter robot', 'west wind internet protocols', 'wget', 'wwweasel robot', 'wwwster', 'xaldon webspider', 'xenu', 'yahoo! slurp', 'yahoofeedseeker', 'yahoo-mmcrawler', 'zao', 'zipppbot', 'zyborg', ); foreach($bots as $bot) { if(stristr($user_agent, $bot) !== false) { return true; } } return false; } ### Referer nach Suchmaschinen-Queries und interner Suche prüfen und Suchstring extrahieren function sem_getKeyword($referer) { $keyword = @parse_url($referer); if (preg_match("/google\./i", $keyword["host"])) { if (preg_match("/imgurl/i", $keyword["query"])) { parse_str($keyword["query"],$q); $keyword = substr($q["prev"],10); } else if (preg_match("/translate\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["q"]; } else { parse_str($keyword["query"],$q); $keyword = $q["q"]; } if($keyword == "") return; return "Google: ".$keyword; } elseif (preg_match("/search\.live\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["q"]; if($keyword == "") return; return "LiveSearch: ".$keyword; } elseif (preg_match("/bing\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["q"]; if($keyword == "") return; return "Bing: ".$keyword; } elseif (preg_match("/yahoo\./i", $keyword["host"])) { if (preg_match("/images/i", $keyword["query"])) { parse_str($keyword["query"],$q); $keyword = $q["p"]; } else { parse_str($keyword["query"],$q); $keyword = $q["p"]; } if($keyword == "") return; return "Yahoo: ".$keyword; } elseif (preg_match("/aol\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["q"]; if($keyword == "") return; return "AOL: ".$keyword; } elseif (preg_match("/aolsvc\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["q"]; if($keyword == "") return; return "AOL: ".$keyword; } elseif (preg_match("/search\.msn\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["q"]; if($keyword == "") return; return "MSN: ".$keyword; } elseif (preg_match("/gmx\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["su"]; if($keyword == "") return; return "GMX: ".$keyword; } elseif (preg_match("/\.bild\.t\-/i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["query"]; if($keyword == "") return; return "BILD: ".$keyword; } elseif (preg_match("/t\-online\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["q"]; if($keyword == "") return; return "T-Online: ".$keyword; } elseif (preg_match("/suche\.web\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["su"]; if($keyword == "") return; return "WEB.de: ".$keyword; } elseif (preg_match("/suche\.lycos\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["query"]; if($keyword == "") return; return "Lycos: ".$keyword; } elseif (preg_match("/altavista\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["q"]; if($keyword == "") return; return "Altavista: ".$keyword; } elseif (preg_match("/alltheweb\./i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["q"]; if($keyword == "") return; return "alltheweb: ".$keyword; } elseif (preg_match("/technorati\.com\/search\//", $referer)) { $q = preg_split("/technorati\.com\/search\//", $referer,-1,PREG_SPLIT_NO_EMPTY); $keyword = $q[1]; if($keyword == "") return; return "Technorati: ".$keyword; } elseif (preg_match("/".$homehost."/i", $keyword["host"])) { parse_str($keyword["query"],$q); $keyword = $q["s"]; if($keyword == "") return; return "Interne Suche: ".$keyword; } else { return; } } ### Anzahl der Datensätze in der statz-Tabelle function sem_showNumStatzEntries() { global $wpdb; $numstatzentries = $wpdb->get_var("SELECT COUNT(id) FROM ".$wpdb->statz); return $numstatzentries; // Zahl } ### Aufgezeichnete Tage in der statz-Tabelle function sem_countDaysInStatzTable() { global $wpdb; $firstdate = $wpdb->get_var("SELECT MIN(time) FROM ".$wpdb->statz." LIMIT 0,1"); if(!$firstdate) { return 1; } else { $firstdate = strtotime($firstdate); $now = time(); $days = (int) (($now - $firstdate) / (60*60*24)+1); return $days; // KOMPLETTE! Tage } } ### Wenn Tage in statz-Tabelle kleiner als Tage in Daily-Statz, dann nimm Tage in Daily-Statz function sem_compareLimitDays2DailyStatz () { global $wpdb; $sem_options = get_option('semmelstatzR_options'); ### optionsarray auslesen if (sem_countDaysInStatzTable() << $sem_options["statz_days_limit"]) { $sem_options["statz_days_limit"] = sem_countDaysInStatzTable(); update_option("semmelstatzR_options", $sem_options); } } ### Zeigt Copyright-Notiz an function sem_showCopyright() { print "
semmelstatzR ". SEMMELSTATZR_VERSION . " happily coded by PHP-Backoffice