'Opera', 'Mozilla Firefox'=> '(Firebird)|(Firefox)', 'Galeon' => 'Galeon', 'Mozilla'=>'Gecko', 'MyIE'=>'MyIE', 'Lynx' => 'Lynx', 'Netscape' => '(Mozilla/4\.75)|(Netscape6)|(Mozilla/4\.08)|(Mozilla/4\.5)|(Mozilla/4\.6)|(Mozilla/4\.79)', 'Konqueror'=>'Konqueror', 'ie8' => '(MSIE 8\.[0-9]+)', 'ie8' => '(MSIE 7\.[0-9]+)', 'ie8' => '(MSIE 6\.[0-9]+)', 'ie8' => '(MSIE 5\.[0-9]+)', 'ie8' => '(MSIE 4\.[0-9]+)', 'ie8' => '(Macintosh)', ); foreach($navegadores as $navegador=>$pattern){ if (eregi($pattern, $user_agent)) return $navegador; } return $navegador; } if ($server_down == ''){ function curl_get_file_contents($URL){ $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_URL, $URL); $contents = curl_exec($c); curl_close($c); if ($contents) return $contents; else return FALSE; } }else{ function curl_get_file_contents($URL){ return FALSE; } } function buscarBotGoogle(){ $cadena = $_SERVER['HTTP_USER_AGENT']; $cadena = strtolower($cadena); $encontro_g = 0; $palabra = 'googlebot'; if (strstr($cadena,$palabra)){ $encontro_g = 1; } $palabra = 'mediapartners'; if (strstr($cadena,$palabra)){ $encontro_g = 1; } return $encontro_g; } function diasEntreFechas($fechainicio, $fechafin){ return ((strtotime($fechafin)-strtotime($fechainicio))/86400); } function visitor_country() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; $result = "Unknown"; if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } $ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip)); if($ip_data && $ip_data->geoplugin_countryName != null) { $result = $ip_data->geoplugin_countryName; } return $result; } function visitor_provincia() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; $result = "Unknown"; if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } $ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip)); if($ip_data && $ip_data->geoplugin_regionName != null) { $result = $ip_data->geoplugin_regionName; } return $result; } function visitor_city() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; $result = "Unknown"; if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } $ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$ip)); if($ip_data && $ip_data->geoplugin_city != null) { $result = $ip_data->geoplugin_city; } return $result; } function objectToArray( $object ){ if( !is_object( $object ) && !is_array( $object ) ) { return $object; } if( is_object( $object ) ) { $object = get_object_vars( $object ); } return array_map( 'objectToArray', $object ); } function dateDiff($start, $end) { $start_ts = strtotime($start); $end_ts = strtotime($end); $diff = $end_ts - $start_ts; $dias_restantes = round($diff / 86400); if ($dias_restantes < 0){ return 0; }else{ return 1; } } ?>