socket_select($r, $w, $e, 5, 0); // Nothing to read, which means a timeout has occurred. if (count($r)) { // Receive data from socket (and fetch destination address from where this data was found) socket_recvfrom($recv_socket, $buf, 512, 0, $recv_addr, $recv_port); // Calculate the roundtrip time $roundtrip_time = (microtime(true) - $t1) * 1000; // No decent address found, display a * instead if (empty($recv_addr)) { $recv_addr = "*"; $recv_name = "*"; } else { // Otherwise, fetch the hostname and geoinfo for the address found $recv_name = gethostbyaddr($recv_addr); if ($argv[1] == "-g") { $recv_geo = ip2geo($recv_addr); } } // Print statistics if ($argv[1] == "-g") { printf("%3d %-15s %.3f ms %-30s %s\n", $ttl, $recv_addr, $roundtrip_time, $recv_geo, $recv_name); } else { printf("%3d %-15s %.3f ms %s\n", $ttl, $recv_addr, $roundtrip_time, $recv_name); } } else { // A timeout has occurred, display a timeout printf("%3d (timeout)\n", $ttl); } // Close sockets socket_close($recv_socket); socket_close($send_socket);
Baseia-se na identificação do IP e no pacote geoip */ /* Valor: LOCALIZAIP Localiza as coordenadas geográficas do usuário atual. Baseia-se na identificação do IP e no pacote geoip */ case "LOCALIZAIP": copiaSeguranca($map_file); $ip = pegaIPcliente(); $r = ip2geo($ip); if ($r["latitude"] == null) { $ip = pegaIPcliente2(); $r = ip2geo($ip); } $retorno = $r; break; /* Valor: ZOOMPONTO Desloca o centro do mapa para um ponto específico. <Navegacao->zoomPonto> */ /* Valor: ZOOMPONTO Desloca o centro do mapa para um ponto específico.