Jump to content

Archived

This topic is now archived and is closed to further replies.

lama16

IP address range

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");
}


Share this post


Link to post
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.


Share this post


Link to post
Share on other sites
i've been looking for a script for email validation to check if the email is vaild also to send an email validation to validate that account. any help? also how would the account be activated via email?

Share this post


Link to post
Share on other sites

×

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.