$rpat = $pat; //Extraer puntos totales $ver_punt = mysql_query("SELECT SUM(`puntuacion`) FROM `markers`"); $ver_p = mysql_fetch_array($ver_punt); $puntost = $ver_p['SUM(`puntuacion`)']; // //Busca si la cadena a buscar es una localidad o provincia $ver_loc = mysql_query("SELECT * FROM localidades WHERE localidad = '{$pat}' OR provincia = '{$pat}'"); $num_loc = mysql_num_rows($ver_loc); // //prueba de rendimiento //$num_loc=0; //Si es mayor que 0, quiere decir que si es una localidad. if ($num_loc > 0) { include 'get_coord_gl.php'; $ver_city = ver_citt($pat); $city = $ver_city["LocalityNamee"]; $precoord = $ver_city["coordinates"]; $tsp = explode(",", $precoord); $new_lat = $tsp[1]; $new_long = $tsp[0]; if ($pre_lon) { $new_lat = $pre_lat; } if ($pre_lat) { $new_long = $pre_lon; } $pre_lat = $new_lat; $pre_lon = $new_long; //Recorta las Coordenadas a 40.0 para poder compararlas con la bbdd //$new_lat=substr($new_lat,0,4);
} // $username = $_SESSION['username']; //Si hay sesion iniciada, busca sus datos: if ($username) { $verdirecc = mysql_query("SELECT * FROM `usuarios` WHERE username = '******' LIMIT 1"); $mira = mysql_fetch_array($verdirecc); $uname = $mira['name']; $smstype = $mira['sms_type']; $_SESSION['sms_type'] = $smstype; $sitio = $mira['direccion']; //Si el usuario tiene direccion establecida, buscala if ($sitio) { $location["CountryCode"] = "ES"; include 'get_coord_gl.php'; $ver_city = ver_citt($sitio); $city = $ver_city["LocalityNamee"]; $precoord = $ver_city["coordinates"]; $tsp = explode(",", $precoord); $new_lat = $tsp[1]; $new_long = $tsp[0]; if ($_GET['mode'] == "debug") { echo $new_lat . "-" . $new_long; } $location['City'] = $city; $location["Longitude"] = $new_long; $location["Latitude"] = $new_lat; if ($new_lat == '') { include "logerror.php"; } else { $haydirec = true;