Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Show Visitors Ip Addresss


10 replies to this topic

#1 cragllo

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 933 posts

Posted 06 December 2004 - 04:43 PM

Want to show the IP of the visitor to your site?
All you have to do is add this code to your page where you want the IP to be shown:
[br]
<?php[/br]echo "Your IP is $_SERVER["REMOTE_ADDR"]";
?>

Edited by cragllo, 06 August 2005 - 06:33 PM.


#2 desimela

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 50 posts
  • Location:cANADA ONTARIO

Posted 07 December 2004 - 01:40 AM

o tht was a cool lil script
thx for shairing

#3 nancmu

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 136 posts
  • Location:Thailand
  • Interests:Computer.....

Posted 15 December 2004 - 02:04 PM

This is one choice!! Posted Image
i usually use this for count my user and show ip. i got user more...

if (getenv(HTTP_CLIENT_IP)) { // check ip from share internet
  $ip = getenv(HTTP_CLIENT_IP);
} elseif (getenv(HTTP_X_FORWARDED_FOR)) { // ip is pass from proxy??
  $ip = getenv(HTTP_X_FORWARDED_FOR);
} else {
  $ip = getenv(REMOTE_ADDR);
}

Edited by moderator, 21 May 2012 - 09:26 AM.


#4 faceofdie

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 65 posts

Posted 31 December 2004 - 10:19 AM

I Use this Code ::
< ?
echo "Your IP is $REMOTE_ADDR";
?>
but It Show Me Last IP and Not Today IP
what is problem >?

Edited by moderator, 21 May 2012 - 09:27 AM.


#5 cragllo

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 933 posts

Posted 31 December 2004 - 11:10 AM

What do you mean Last IP? Go to the page where that code it, and then go into dos and type in ipconfig
it the ip's match, then it is working ok...

if you nitice there is a space between the < and the ?, take taht out, so it should look like <? try that...

Edited by cragllo, 31 December 2004 - 12:22 PM.


#6 mrkill47

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 31 posts

Posted 31 December 2004 - 12:12 PM

i tried it and it doesn't work for me either, i get this error:

Notice: Undefined variable: REMOTE_ADDR in c:\program files\easyphp1-7\www\index.php on line 10

Code i used is:

<p><?php echo "Your IP is $REMOTE_ADDR"; ?></p>

the page is located here: http://82.43.57.227/index.php (this is my home pc/server btw, its not always up lol... sorry if its down)

Edited by moderator, 21 May 2012 - 09:28 AM.


#7 cragllo

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 933 posts

Posted 31 December 2004 - 12:18 PM

Are all the features og PHP turned on, on your server?

#8 mrkill47

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 31 posts

Posted 31 December 2004 - 02:12 PM

not sure lol, does this help: http://82.43.57.227/...hp?page=phpinfo

i tried this code instead:

echo "User's IP address: " . $_SERVER["REMOTE_ADDR"];

that seems to have worked...

Edited by moderator, 21 May 2012 - 09:28 AM.


#9 FaLgoR

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 217 posts

Posted 03 January 2005 - 11:56 PM

If global vars are turned on, use $REMOTE_ADDR, else, use $_SERVER["REMOTE_ADDR"]. :rolleyes:

#10 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 05 February 2009 - 04:04 AM

Use
<?If (getenv(HTTP_CLIENT_IP)) {$ip = getenv(HTTP_CLIENT_IP);} elseif (getenv(HTTP_X_FORWARDED_FOR)) {$ip = getenv(HTTP_X_FORWARDED_FOR);} else {$ip = getenv(REMOTE_ADDR);} Echo "Your IP is $ip";?>

already script for you.

-reply by AnonymousKeywords:

Edited by moderator, 21 May 2012 - 09:29 AM.





Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users