PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1848
Number of posts: 5016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Obtain IP address by PHP... Posted by hadipardis on 1 Dec 2005 at 7:25 AM
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:
<%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>

But how in PHP?
Thanks
Report
Re: Obtain IP address by PHP... Posted by tvienti on 1 Dec 2005 at 10:32 AM
echo $_SERVER['REMOTE_ADDR'];


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:
:
: <%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>
: 

: But how in PHP?
: Thanks
:

Report
Re: Obtain IP address by PHP... Posted by hadipardis on 1 Dec 2005 at 1:22 PM
: 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:
:
: <%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>
: 

: 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?

Report
Re: Obtain IP address by PHP... Posted by tvienti on 1 Dec 2005 at 2:16 PM
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:
: :
: : <%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>
: : 

: : 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?
:
:

Report
Re: Obtain IP address by PHP... Posted by Piotr Horzycki on 17 Jan 2006 at 11:33 AM
: 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

Report
Re: Obtain IP address by PHP... Posted by MEGAG3EK on 3 Jan 2006 at 6:23 AM
: 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:
:
: <%Response.Write(Request.ServerVariables("LOCAL_ADDR"))%>
: 

: But how in PHP?
: Thanks
:

$IP = $_SERVER['REMOTE_ADDR'];

S ska det se ut...


	//MEGAG3EK
	//Homepage: hackers.doesntexist.com 
return 0; 





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.