Obtain IP address by PHP... - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Obtain IP address by PHP...

hadipardishadipardis Posts: 134Member
Hi
I want to obtain the IP address of each visitor of my web site. How I can do this? I do this in ASP by the following code:
[code]
<%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>
[/code]
But how in PHP?
Thanks

Comments

  • tvientitvienti Posts: 230Member
    [code]echo $_SERVER['REMOTE_ADDR'];[/code]

    T

    : Hi
    : I want to obtain the IP address of each visitor of my web site. How I can do this? I do this in ASP by the following code:
    : [code]
    : <%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>
    : [/code]
    : But how in PHP?
    : Thanks
    :

  • hadipardishadipardis Posts: 134Member
    : Hi
    : I want to obtain the IP address of each visitor of my web site. How I can do this? I do this in ASP by the following code:
    : [code]
    : <%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>
    : [/code]
    : But how in PHP?
    : Thanks
    :
    Thanks. But is it possible to change the IP address when we connect to internet? If so ,how? In fact, I want to design a login system by which only special users ,that their IP address is known for us, can log in.
    Do you know any better way to do so?

  • tvientitvienti Posts: 230Member
    I'm sorry, I don't follow. You can fake your IP in a couple ways, namely spoofing it and going through an HTTP proxy. If you want to allow login only to certain IP addresses you can do that easily enough, but it isn't foolproof. Somebody could spoof their IP to look like an 'allowed' IP.

    Hope that helps,
    T

    : : Hi
    : : I want to obtain the IP address of each visitor of my web site. How I can do this? I do this in ASP by the following code:
    : : [code]
    : : <%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>
    : : [/code]
    : : But how in PHP?
    : : Thanks
    : :
    : Thanks. But is it possible to change the IP address when we connect to internet? If so ,how? In fact, I want to design a login system by which only special users ,that their IP address is known for us, can log in.
    : Do you know any better way to do so?
    :
    :

  • MEGAG3EKMEGAG3EK Posts: 10Member
    : Hi
    : I want to obtain the IP address of each visitor of my web site. How I can do this? I do this in ASP by the following code:
    : [code]
    : <%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>
    : [/code]
    : But how in PHP?
    : Thanks
    :

    [code]
    $IP = $_SERVER['REMOTE_ADDR'];
    [/code]
    S ska det se ut...


    [code][green] //MEGAG3EK
    //Homepage: hackers.doesntexist.com [/green]
    [blue]return[/blue] 0; [/code]

  • Piotr HorzyckiPiotr Horzycki Posts: 8Member
    : I'm sorry, I don't follow. You can fake your IP in a couple ways, namely spoofing it and going through an HTTP proxy. If you want to allow login only to certain IP addresses you can do that easily enough, but it isn't foolproof. Somebody could spoof their IP to look like an 'allowed' IP.

    I'd add something:
    #1 NAT. Many people connect to Internet via local area networks.
    #2 What if someone wants to jump on the website from an Internet cafe, friend's PC, school etc.?
    #3 What to do with dialup connections? "Dialup" doesn't mean "56k modem" - I've got an ADSL and my IP changes every time I connect.
    --
    piotr horzycki "piotrala"
    kutno, poland +0200

Sign In or Register to comment.