Jump to content
Addic73d

geoIP nelamurire...

Recommended Posts

Posted

Am gasit un fisier cu lista tarilor si clasele de ip-uri aferente fiecarei tari.

Acum am cateva nelamuriti...

1.0.0.0 1.0.0.255 16777216 16777471 AU Australia

1.0.1.0 1.0.3.255 16777472 16778239 CN China

1.0.4.0 1.0.7.255 16778240 16779263 AU Australia

1.0.8.0 1.0.15.255 16779264 16781311 CN China

1.0.16.0 1.0.31.255 16781312 16785407 JP Japan

1.0.32.0 1.0.63.255 16785408 16793599 CN China

1.0.64.0 1.0.127.255 16793600 16809983 JP Japan

1.0.128.0 1.0.255.255 16809984 16842751 TH Thailand

1.1.0.0 1.1.0.255 16842752 16843007 CN China

1.1.1.0 1.1.1.255 16843008 16843263 AU Australia

1.1.2.0 1.1.63.255 16843264 16859135 CN China

1.1.64.0 1.1.127.255 16859136 16875519 JP Japan

Fisierul arata asa...

Acum am inteles ca, prima coloana reprezinta inceputul clasei, a doua reprezinta sfarsitul clasei, dar ce reprezinta coloanele 3 si 4???

Posted (edited)

Mersi pentru raspunsuri, m-am lamurit cum sta treaba...

Conversia se face dupa formula: 16777216*w + 65536*x + 256*y + z unde IP = w.x.y.z

Am facut si un script simplu..


<?php

echo '<strong>IP converter</strong><br />';
echo "<form name='scan_ip' method='post' action='' >
IP: <input type='text' name='ip' />
<input type='submit' name='calc' value='Hit >>' />
</form>";

if((isset($_POST['calc']) && (empty($_POST['ip'])))) {

echo 'An empty field can not be converted.';

} else if((isset($_POST['calc']) && (!empty($_POST['ip'])))) {

$ip = $_POST['ip'];
$div = explode('.', $ip);

$w = ($div[0]*16777216);
$x = ($div[1]*65536);
$y = ($div[2]*256);
$z = ($div[3]*1);


echo '<strong>'.($w + $x + $y + $z).'</strong>';



}

?>

@Zatarra am incercat si o metoda asemanatoare si de foarte multe ori la oras returneaza 'unknown location'.

Edited by Addic73d

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...