The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
convert IP to 10 digit decimal number
Hi guys I need help in converting IP in php.
for example, if we have this IP: 123.456.789.012 I would like to make it as 012.789.456.123 and then convert it to a 10 digit decimal number. This is for a hack I am working on and will be greatful if anyone can help. Thanks Aurous |
#2
|
|||
|
|||
Why 10 digits, why not 12?
|
#3
|
|||
|
|||
Quote:
|
#4
|
|||
|
|||
<a href="http://us4.php.net/manual/en/function.ip2long.php" target="_blank">http://us4.php.net/manual/en/function.ip2long.php</a>
|
#5
|
|||
|
|||
Quote:
|
#6
|
|||
|
|||
How about:
PHP Code:
|
#7
|
|||
|
|||
That's what I was going to suggest as well.
|
#8
|
|||
|
|||
Yes i know you suggested it but he had trouble reversing it.
|
#9
|
|||
|
|||
Quote:
If the IP is suppose: 123.456.78.90 It should reverse it to 90.78.456.123 They way you suggest would make it 321.654.87.09 (i think), which I dont want to do. basically if the IP I need to get this -> 3092948441 when this is entered as IP -> 217.165.90.184 This is an example. |
#10
|
|||
|
|||
Don't think too much
It would already do that, i a review with the ip you now provided i found out that the sprintf is really neccesary to avoid negative numbers. PHP Code:
Code:
ip: 217.165.90.184 reversed: 184.90.165.217 reversedlong: 3092948441 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|