header('Location: http://ua.theafh.net/' , true, 301);
die();
$GLOBALS['AFH_LIB_PATH'] = "/home/project/code/php/afh-lib-dev/";
require_once($GLOBALS['AFH_LIB_PATH'].'inc.ua.php');
require_once($GLOBALS['AFH_LIB_PATH'].'inc.common_web_functions.php');
$GLOBALS['BASEDIR']      = '/var/www/vhosts/www.vwp-online.de/html/';
$ids_arr = log_raw_web_request_to_file();
$ajax = build_ajax_log_str($ids_arr['req_id']);
/*
function is_bot($ua){
	$ret = false;
        $bot_search = "/spider|crawl|search|wordpress|rss|feed|parse|grab|fetch|such|screenshot|urllib|curl|resolve|checker|microsoft.*url|hunter|link |AppEngine-Google|find|wget|collect|Rome Client|Twitturly|URL-Check|InetURL|slurp|drupal|Yandex\/|Inquirer|java\/[0-9]|perl|pear|facebook|Nutch|check_http|Yahoo Pipes|bot|HttpClient|Validat|Podder|reeder|Mediapartners|archiver|Google Desktop|Bookmark|Track|Analyzer|Hitfaker|extractor|Emulator|Library|Linkman|Mail\.RU|Linter|Rivva|Summify|nutch|vkShare|heritrix|http/i";
        if (preg_match($bot_search, $ua)){
                $ret = true;
        }
	return $ret;
}
function check_ua($ua){
	$ret = 'unknown';
        $browser_search = "/Mozilla|Opera|Konqueror|Browser|Firefox|Gecko|Safari|Chrome|Midori|Dillo/i";
	if (preg_match($browser_search, $ua)){
                $ret = 'browser';
		if(strlen($ua) <= 15){
			$ret = 'unknown';
		}
        }
	if(is_bot($ua)){
		$ret = 'bot';
	}
        $browser_search = "/Opera Mobi|Opera Mini|ipad|iphone|android|nokia|symbian|Ericsson|mobil|BlackBerry|SAMSUNG-/i";
	if (preg_match($browser_search, $ua)){
                $ret = 'mobile-browser';
		if(is_bot($ua)){
			$ret = 'mobile-bot';
		}
        }
        $browser_search = "/Internet Browser|\(000000000;|
User Agent List / Liste 
 
';
}
$ua = $_SERVER['HTTP_USER_AGENT'];
if($_GET['ua_type'] == ''){
	$ua_type = 'all';
}
else{
	$ua_type = $_GET['ua_type'];
}
$write = true;
$ua_list = file('ua_list.txt');
if ($ua == ''){
	$write = false;
}
else if(stripos($ua,'\n";
	if($ua_type == strtolower($line_type) || $ua_type == 'all'){
		//if ($found_nr == ($i+1)){
		//if ($ua_list[$i] == $ua){
		if($_GET['filetype'] == 'csv'){
			fputcsv($file_stream ,  array(trim($ua_list[$i]),$line_type),';','"');
		}
		else{
			if (strstr($ua_list[$i],$ua)){
				//$out_line [$i]= ''.htmlspecialchars($ua_list[$i]).'  '.($i+1).'.)  '.htmlspecialchars($ua_list[$i]).' '.$line_type." \n";
			}
			else{
				//$out_line [$i]= ''.($i+1).'.)  '.$line_type." \n";
			}
		}
	}
	//$i++;
}
if($_GET['filetype'] == 'csv'){
	fclose($file_stream);
	exit;
}
	/*
echo 'User Agent  lautet: '.htmlspecialchars($ua)." '.$found_nr.' '." bereits in der Liste  unten aufgeführt!';
	//echo 'Nr. User Agent Type User Agent Liste  aufgenommen! :-)Nr. User Agent Type ',$out_line)." \n";
	echo "
";
	//echo '';
	//echo implode("\n",$out_line)."\n";
	//echo " ";
	echo ($i+1).'.) '.htmlspecialchars($ua)."Danke fürs Mitmachen! :-) 
Top of User Agent List