Re: IP address enconding

From: Date: Thu, 19 Apr 2001 20:48:21 +0000
Subject: Re: IP address enconding
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-49349@lists.php.net to get a copy of this message
No! I can encode IP address to an Integer: 192.168.0.1 consider as: a.b.c.d and now the formula goes: a shl 24 + b shl 16 + c shl 8 + d but i was looking for something ready made.... -elias http://www.kameelah.org/eassoft ""Knut H. Hassel Nielsen"" <Knut.H.Hassel.Nielsen@idi.ntnu.no> wrote in message news:Pine.GSO.4.33.0104191143060.5310-100000@hades.idi.ntnu.no... On Thu, 19 Apr 2001, elias wrote: > Hello. > > How can i get the IP address of the user who's browsing my current script? > how can i do it via JavaScript and PHP please. $REMOTE_ADDR should do the trick (use 'phpinfo()' to see for yourself) > And if i got an IP address such 192.168.0.2 > i believe it will be returned as a string....Is there is a function to > encode it to an Integer and the decode it back to a string? or i have to > code it myself? > > -elias It is a string, so you couldn't make an integer out of it anymore than making any other string into an integer. The '.' isn't a legal digit. You'll have to split it up into different blocks (use split) -- Knut ------ Knut H. Hassel Nielsen Principal Engineer / Avdelingsingeniør Norwegian University of Science and Technology / NTNU Department of Computer and Information Science / IDI N-7491 Trondheim, Norway Phone Office / Telefon jobb : (+47) 73 59 18 46 Fax Office / Telefax jobb : (+47) 73 59 17 33 Cell. Phone / Mobiltelefon : 91 59 86 06 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#49349) next »