FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » ip address of client
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: ip address of client [message #173237 is a reply to message #173236] Tue, 29 March 2011 06:47 Go to previous messageGo to previous message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma:
Senior Member
On Mon, 28 Mar 2011 22:46:48 -0700 (PDT), suresh wrote:

> Hi
> I was using the following script to get ip address of client, but I
> get Welcom ::1 from the following script. How to get the real ip
> address?
>
> <?php
> function getRealIpAddr()
> {
> if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share
> internet
> {
> $ip=$_SERVER['HTTP_CLIENT_IP'];
> }
> elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is
> pass from proxy
> {
> $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
> }
> else
> {
> $ip=$_SERVER['REMOTE_ADDR'];
> }
> return $ip;
> }
> $ip = getRealIpAddr();
> echo "Welcome "; echo $ip;
>
> thanks
> suresh

echo "welcome " $ip;
echo "welcome ".$ip;

only one echo per physical line.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Very strange behaviour of imageftbbox()?
Next Topic: CLP - ON TOPIC! - Need PHP form email help, Please!
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Oct 06 18:24:26 GMT 2024

Total time taken to generate the page: 0.04593 seconds