[UPHPU] challenge!

Scott Barber scott.barber at tonservices.com
Fri Apr 16 10:20:29 MDT 2004

Umm... sorry to break your fun, but the subnet can't be determined from
the IP alone. You really have no idea what the subnet of the ip is. It
looks like you're just parsing for the 4th octet. That may or may not be
the real subnet.


On Fri, 2004-04-16 at 10:15, District Webmaster wrote:
> Here's a quick and fun coding challenge for y'all: I want to determine
> the subnet of the machine that is visiting my web page.
> I needed this for a script I'm running, and I could think of three  or
> four ways to do it - but I bet there's more. Show your creativeness and
> mad mad php skills!!!!
> Prizes will be awarded for:
> The fastest (execution time)
> The shortest code
> The most convoluted or complicated
> The most backwards compatible
> The fastest to respond
> The most original
> The most anti-Wade :)
> Prizes shall consist of me thinking very highly of you, at least
> momentarily.
> Dave
> P.S. ***SPOILER!!!!***
> Heres is my solution:
> $subnet = implode (".", array_slice ( explode (".",
> $_SERVER["REMOTE_ADDR"]), 0, 3));
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: list-unsubscribe at uphpu.org
> For additional commands, e-mail: list-help at uphpu.org
Scott Barber
UNIX SysAdmin
TON Services, Inc.
scott.barber at tonservices.com

More information about the UPHPU mailing list