Jump to content

IP address range


lama16

Recommended Posts

hi what i want to do is when a user registers it checks the ip address to see if it is already in the database and if it is it would refuse the user..... the problem is if the user are on a LAN so he could register on one computer then move to the nxt and register again creating lots of users. so what i want to do is to stop users registering on a LAN only to restrict it to one user.

so far this is what i have below


$ip = ($_SERVER['HTTP_X_FORWARDED_FOR'])
? $_SERVER['HTTP_X_FORWARDED_FOR']
: $_SERVER['REMOTE_ADDR'];
$q=mysql_query("SELECT * FROM users WHERE lastip='$ip'",$c);
if(mysql_num_rows($q))
{
die("Only <B>ONE</B> user per IP");
}


Link to comment
Share on other sites

It's possible but it's not a particulalrly good idea.

Here's 2 reasons why:

Quite a often a Lan will share an internet connection and consequently only have 1 public IP address. Your script would see this public IP address and NOT the machines private (internal LAN) IP that the machines have.

This could mean anything from 2 machines on the Lan, to 100+ machines on the lan having the same public IP address. If there were two people who wanted to legitimately sign up to your site, only one of them would be able to as you will have already added the lan's public IP to the database.

The second reason is that alot of ISP's still issue their customers with dynamic IP addresses. (this is where a persons IP address may change every time they connect to the internet).

Say person 1 signs up with his IP address then disconnects from the internet. Person 2 turns on their connection and is dynamically assigned the IP address that person 1 had before. Person 2 is now unable to sign up to your site, despite having absolutely no relation to person 1.

You see? it can cause more problems than it solves.

You are far better off using the commonly used method of taking a unique email address from your signup form, and sending a validation email to the address that is provided. It's unlikley that many people would go to the effort of obtaining a new email account just to create more than one account at a website.


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.