Users IP Addressez

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
khaki_monster
Forum Commoner
Posts: 73
Joined: Tue Oct 11, 2005 12:36 am
Location: Philippines
Contact:

Users IP Addressez

Post by khaki_monster »

helo pepz!

simple question("i guess"). how do i know if an IP address of Location A("192.168.0.1") is
different from an IP of Location B("192.168.0.1")?

cheerz!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you don't.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Can you maybe elaborate a bit more?
duk
Forum Contributor
Posts: 199
Joined: Wed May 19, 2004 8:45 am
Location: London

Post by duk »

he have two diferent networks accessing the same internal page...

now what can i think is, if you have a login system, set a cookie with information from the diferent networks, and then you can catch in the cookies the information you need...
duk
Forum Contributor
Posts: 199
Joined: Wed May 19, 2004 8:45 am
Location: London

Post by duk »

you can try to see

http://uk.php.net/gethostbyaddr

you can see other functions as:

http://uk.php.net/manual/en/ref.network.php

$_SERVER['REMOTE_HOST'] -> could help you to to identify dirent names in ip addres's
User avatar
khaki_monster
Forum Commoner
Posts: 73
Joined: Tue Oct 11, 2005 12:36 am
Location: Philippines
Contact:

Post by khaki_monster »

im actually thinking of making an IP blocker for my shoutbox, and im concern of
maybe im banning or blocking a wrong visitors because of having same IP's
though they belong from different Location A and B.

sorry... bout question. i know it kind'a confusing... my english grammar kind'a
limited :)

thanx for the responsez.

cheerz!
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

I dont think it is possible to have the same IP address.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

nickman013 wrote:I dont think it is possible to have the same IP address.
It is both possible, and common. AOL users, proxy visitors (think of corporate workers going through a proxy from work), kids in schools, various national proxies (Romania and Estonia both have ISP's with proxies that put all users behind one IP)...

The list goes on. I'm excluding people spoofing, dns attacks, and other more malicious approaches that also allow it to occur.

IP addresses are not in any way reliably related to a person.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

Oh yeah, the people on the same network have the same IP. I thought you meant like totally different people, not in the same network.
User avatar
khaki_monster
Forum Commoner
Posts: 73
Joined: Tue Oct 11, 2005 12:36 am
Location: Philippines
Contact:

Post by khaki_monster »

is the IP address of network "A" is different from network "B"? though they have same IP's as 192.168.0.1
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

well, yeah the have the same external. That ip is called internal ip, meaning it is behind some sort of router.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

Actually that's misleading. No two machines can have the same IP address assigned to them at the same time, but multiple machines can be behind a router, or switch thus exposing themselves as the router / switch's IP address. The two machines have different IPs but are visiting you from the same IP, just like two different users using the same proxy are both going through the proxy's IP address. Your only reliable way is setting a session cookie, use PHP's built in session management and just store any info that needs to be associated with each unique user in their session. The users could still trick your system into thinking they are one person but they would have to deliberately do so, not sure if this is what you're after.
duk
Forum Contributor
Posts: 199
Joined: Wed May 19, 2004 8:45 am
Location: London

Post by duk »

i think if you play with get-host-by-addr first you can identify proxys.. if there is a private IP, you can identify the hostname that in most cases they are diferent, because in a internal network, it cant be two machines with the same name with the same internal ip even if they are separated by a switch...

if that happens, the router ddon't know who is who...

is a good way yo start!!
User avatar
khaki_monster
Forum Commoner
Posts: 73
Joined: Tue Oct 11, 2005 12:36 am
Location: Philippines
Contact:

Post by khaki_monster »

tanx for the contribution guyz. though im still a bit in confusion. anyway il try to update
with this subject sooner.

cheerz!
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

A quick diag for what khaki means:

Code: Select all

server --------- Router/Gateway A (ip=234.32.1.89)--------- User A (ip=192.168.2.1)
    |
     ----------- Router/Gateway B (ip=86.56.34.12)--------- User B (ip=192.168.2.1)
at least, that's my interpretation..
Post Reply