473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How to get client IP address?

Don
How can I get the client's IP address from within an HTML page using embedded JS?

Thanks for your help,
Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #1
9 18427
Don
On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
How can I get the client's IP address from within an HTML page using embedded JS?

Thanks for your help,
Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Sorry, I meant how can I do it using PHP on the server?

Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #2
Don wrote:
On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:

How can I get the client's IP address from within an HTML page using embedded JS?

Thanks for your help,
Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----


Sorry, I meant how can I do it using PHP on the server?

Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

run phpinfo it gives you, amongst other things the clients IP, Its in an
environment variable, sorry can't remember which one it is
Jul 17 '05 #3
Don wrote:
On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
How can I get the client's IP address from within an HTML page
using embedded JS?

[snip]
Sorry, I meant how can I do it using PHP on the server?


Using the REMOTE_ADDR server variable:

$_SERVER['REMOTE_ADDR']

Be aware that the IP address might not be accurate due to proxying. Be
careful when using it.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 17 '05 #4
Michael Winter wrote:
Don wrote:
On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
How can I get the client's IP address from within an HTML page
using embedded JS?

[snip]
Sorry, I meant how can I do it using PHP on the server?

Using the REMOTE_ADDR server variable:

$_SERVER['REMOTE_ADDR']

Be aware that the IP address might not be accurate due to proxying. Be
careful when using it.

Mike

True, only rely upon the IP for a session, Asychronous fun <g>
Jul 17 '05 #5
Michael Winter wrote:
Don wrote:
On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
How can I get the client's IP address from within an HTML page
using embedded JS?

[snip]
Sorry, I meant how can I do it using PHP on the server?

Using the REMOTE_ADDR server variable:

$_SERVER['REMOTE_ADDR']

Be aware that the IP address might not be accurate due to proxying. Be
careful when using it.

Mike

Hell,

life is hard, I started off with procedural languages and some clown
comes up with objects, now the web requires me to go back to
asynchronous. Thank God my first job was as a sytems programmer, what
goes around comes around <g>
Jul 17 '05 #6
Don
On Thu, 17 Mar 2005 15:23:34 GMT, Michael Winter <m.******@blueyonder.co.invalid> wrote:
Don wrote:
On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
How can I get the client's IP address from within an HTML page
using embedded JS?


[snip]
Sorry, I meant how can I do it using PHP on the server?


Using the REMOTE_ADDR server variable:

$_SERVER['REMOTE_ADDR']

Be aware that the IP address might not be accurate due to proxying. Be
careful when using it.

Mike

Thanks for your replies guys. It looks like I've got someone abusing my domain, and I want to ban
his IP. So, if IP's are changing all the time how can I accomplish this. Suppose maybe, I can ban
an IP range. Will that work?

Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #7
Don wrote:
On Thu, 17 Mar 2005 15:23:34 GMT, Michael Winter <m.******@blueyonder.co.invalid> wrote:

Don wrote:

On Thu, 17 Mar 2005 08:00:17 -0700, Don <no@adr.com> wrote:
How can I get the client's IP address from within an HTML page
using embedded JS?


[snip]

Sorry, I meant how can I do it using PHP on the server?


Using the REMOTE_ADDR server variable:

$_SERVER['REMOTE_ADDR']

Be aware that the IP address might not be accurate due to proxying. Be
careful when using it.

Mike


Thanks for your replies guys. It looks like I've got someone abusing my domain, and I want to ban
his IP. So, if IP's are changing all the time how can I accomplish this. Suppose maybe, I can ban
an IP range. Will that work?

Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Anyone with a dial-up connection (or even broadband) has got a dynamic
IP. It changes...
Jul 17 '05 #8
Don wrote:

[snip]
So, if IP's are changing all the time how can I accomplish this.
Suppose maybe, I can ban an IP range. Will that work?


[Conjecture. Practicality not assured. Regulars: feel free to flame away.]

In principle, yes. If you can't quite determine the range, you should
be able to use a regional registry (like ARIN or RIPE) to determine
the range held by the provider.

However, there is an obvious risk: if the necessary range involves a
major ISP or proxy, you're going to block a *lot* of people. In that
case, use the registry information to find the provider and determine
if the user's actions violate their terms of service. If so, make sure
your server has the correct time (record the discrepancy, if
necessary, including timezone) and wait for an attack to appear in
your logs. You can then send the record to the provider and they
should be able to trace who it is and terminate their account[1].

Reporting is probably a better route, assuming the attacker isn't
already spoofing their IP. If they find themselves banned, they might
then start spoofing and it will be difficult to try reporting then.

Good luck,
Mike
[1] Well, assuming the provider cares about violators. I've
encountered false abuse addresses, or at least unmonitored
mailboxes. There's not much you can do then unless the
provider has been leased their IP range from another
company.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 17 '05 #9
Don
On Thu, 17 Mar 2005 18:16:34 GMT, Michael Winter <m.******@blueyonder.co.invalid> wrote:
Don wrote:

[snip]
So, if IP's are changing all the time how can I accomplish this.
Suppose maybe, I can ban an IP range. Will that work?


[Conjecture. Practicality not assured. Regulars: feel free to flame away.]

In principle, yes. If you can't quite determine the range, you should
be able to use a regional registry (like ARIN or RIPE) to determine
the range held by the provider.

However, there is an obvious risk: if the necessary range involves a
major ISP or proxy, you're going to block a *lot* of people. In that
case, use the registry information to find the provider and determine
if the user's actions violate their terms of service. If so, make sure
your server has the correct time (record the discrepancy, if
necessary, including timezone) and wait for an attack to appear in
your logs. You can then send the record to the provider and they
should be able to trace who it is and terminate their account[1].

Reporting is probably a better route, assuming the attacker isn't
already spoofing their IP. If they find themselves banned, they might
then start spoofing and it will be difficult to try reporting then.

Good luck,
Mike
[1] Well, assuming the provider cares about violators. I've
encountered false abuse addresses, or at least unmonitored
mailboxes. There's not much you can do then unless the
provider has been leased their IP range from another
company.

Thanks Michael and everyone else for your help. I really appreciate your assistance.

Regards,
Don

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: JezB | last post by:
Any way I can get at a unique "Client ID" within server code ? I'm writing some auditing and I want to record which particular client machine initiated a request, for example. I imagine in an...
4
by: Andy | last post by:
Hi all, In a recent intranet project, I want to limit the access to my mobile asp.net appl only to a set of authorized MAC addresses by determining client's MAC address. Is there any way to...
4
by: rs | last post by:
how I the client tell the server that the socket is closed? or this there an even that informs the server that the clients socket is close? Oh, I am using vb.net 2003 Thanks
4
by: Goh | last post by:
Hi, I would like to know how can we implement a web page that intelligent enough to unique identify that pc have been visit before without any cookies and login user require. I have try...
13
by: Sandeep Singh | last post by:
I am making socket client application in C# how can i get ip address of client who has connected to server
14
by: Ankit Aneja | last post by:
The code of classes given below is for server to which clients connect i want to get ip address of client which has connected pls help how can i get //listen class public class listen {
13
by: James | last post by:
Hi, I'm new to ASP .NET, working on a school project, which i need to find out the client's MAC address. However in my search on the web, i have not find any method available, and some mention...
2
by: WhatHappend | last post by:
I have converted a .Net 1.0 application to .Net 2.0 and the web service invocations have delay of around 10seconds on each intial access. After the first access subsequent access are fast (After a...
3
by: RFD | last post by:
I've been slaving at this problem for over a week, and would appreciate some help from you kind folks. Basic Problem: I have made a server program and a client program. When I try to use the...
15
by: Mike | last post by:
Hi ASP Gurus, Please help me solving my problem. I am trying to get the clients IP address but I am not able to do it successfully. I have tried: Request.ServerVariables("http_user_agent")...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.