Re: user's ip
| From: | Renze Munnik | Date: | Wed, 08 Aug 2001 08:22:04 +0000 |
| Subject: | Re: user's ip | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-61769@lists.php.net to get a copy of this message | ||
On Wed, Aug 08, 2001 at 12:45:32PM +1000, Chris Birmingham wrote:
> I would use
>
> $HTTP_SERVER_VARS["REMOTE_ADDR"]
> or
> $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]
>
> to return the IP address..
>
> I have seen, people using if($ip == $REMOTE_ADDR) { // do whatever }
> but in some configurations of PHP this can be a bad thing..
>
> index.php?REMOTE_ADDR=10.0.0.1 would override the variable $REMOTE_ADDR (in
> SOME configurations)
>
> Its probably alot harder for a malicious user to fake the HTTP_SERVER_VARS
> array than just a normal variable.
>
> Just my .02c :)
>
> Regards
>
> Chris
You could not be more right!
Always use stuff like $HTTP_SERVER_VARS, $HTTP_POST_VARS, etc. It's
the savest/best way!
--
* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: renze@datalink.nl
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
-- H: +31 23 5516190
--
-- Stationsplein 82
-- 2011 LM HAARLEM
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««