Re: Getting the Leftmost 7 Characters of String
| From: | Stephen Hui | Date: | Wed, 28 Jun 2000 21:17:49 +0000 |
| Subject: | Re: Getting the Leftmost 7 Characters of String | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3668@lists.php.net to get a copy of this message | ||
You could use split() to break it up into the separate bytes, then
recombine whichever pieces you need.
list ($b1, $b2, $b3, $b4) = split ("\.", $REMOTE_ADDR);
so if $REMOTE_ADDR == "192.168.1.1",
$b1 == 192
$b2 == 168
$b3 == 1
$b4 == 1
Hope this helps!
Stephen.
Graham Pearson wrote:
>
> Group:
>
> I have been trying to acquire via php the class c address of a specific
> $REMOTE_ADDR variable. I have a series of webpages that need to be viewed
> only from remote clients that are on the local lan and if a client views
> the specific pages from outside the lan, redirect them to another webpage.
>
> I am able to do this via ColdFusion but yet in PHP. Any Ideas or directions
> to look at.
>
--
Stephen Hui, ARL:UT, Austin, Texas
Computer Terms: Programmer - A red-eyed, mumbling mammal
capable of conversing with inanimate objects.