Prevent people making multiple accounts

Forum
Last Post
Threads / Messages
Status
Not open for further replies.

kisazeky

Member
Member
Joined
Mar 14, 2009
Messages
44
Points
0
Mysidian Dollar
11,537
This is hard to believe, but some people are desperate as to keep registering accounts to level up their adoptables. Let's make this method of leveling up not worth it.

Step 1:

Run this query
PHP:
ALTER TABLE users ADD (ip VARCHAR(30) NOT NULL DEFAULT "0")

Step 2:

Open register2.php

Find
PHP:
// Connect to our database

Above this line, put

PHP:
$ip = $_SERVER['REMOTE_ADDR']; 
$ip = preg_replace("/[^a-zA-Z0-9@._-]/", "", $ip);

Step 3:

Still in register2.php, find this code:

PHP:
//Check that username does not already exist

$query = "SELECT * FROM users WHERE username = '$username'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$luser=@mysql_result($result,$i,"username");


$i++;
}

$luser = strtolower($luser);
$u2 = $str = strtolower($username);

if($luser == $u2){
$template = replace(':ARTICLETITLE:','Error',$template);
$template = replace(':ARTICLECONTENT:','Your username has been taken.  Please <a href="register.php">go back</a> and select a different username.',$template);
echo $template;
die();
}


Below all of that, put

PHP:
// Check that user is not making multiple accounts

$query = "SELECT * FROM users WHERE ip = '$ip'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$ip2=@mysql_result($result,$i,"ip");


$i++;
}

if($ip == $ip2){
$template = replace(':ARTICLETITLE:','Error',$template);
$template = replace(':ARTICLECONTENT:','You are not allowed to make multiple accounts.',$template);
echo $template;
die();
}

Step 4:

Find this line

PHP:
//All checks pass, create the user

Insert below it:

PHP:
$pass1 = md5($pass1); //MD5 the password
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free', '$ip')");

Note: if you have installed my currency mod, you'll want to insert this instead:

PHP:
$pass1 = md5($pass1); //MD5 the password
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free', '0', '$ip')");
 
Awesome, trying it now.

EDIT:

Works perfectly but Members registered before the mod was installed have an IP "0" so they can still make double accounts. With sites like Arvyre, which already has over 4000 members, this is useless.
 
This is a bad idea because of legitimate users sharing IP addresses, such as Dial Up Users and DSL users who get a new IP each time they connect, users in public places such as schools and countries where the IP address pool for all users is limited or the same, such as Turkey where everyone shares about 20 IP addresses. :)
 
Point taken Brandon, but, what if you have a limit, say you cant register with the same IP address for say 30 mins, just to be safe say.
 
Good idea but I don't know how to do time in php.

For now I'm letting people ask for exceptions in my forums.
 
Well... since brandon made the 24 hours limit adoptable part... go to that section and change a little to fit the requirements! :D
 
Status
Not open for further replies.

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,119
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top