Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Addons/Mods Graveyard (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=41)
-   -   Prevent people making multiple accounts (http://www.mysidiaadoptables.com/forum/showthread.php?t=615)

kisazeky 04-04-2009 04:53 PM

Prevent people making multiple accounts
 
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 Code:

ALTER TABLE users ADD (ip VARCHAR(30NOT NULL DEFAULT "0"

Step 2:

Open register2.php

Find
PHP Code:

// Connect to our database 

Above this line, put

PHP Code:

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

Step 3:

Still in register2.php, find this code:

PHP Code:

//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 Code:

// 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 Code:

//All checks pass, create the user 

Insert below it:

PHP Code:

$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 Code:

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


Ashje 04-04-2009 05:30 PM

RE: Prevent people making multiple accounts
 
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.

kisazeky 04-04-2009 05:47 PM

RE: Prevent people making multiple accounts
 
I am not sure if exceptions can be made, honestly

BMR777 04-04-2009 07:57 PM

RE: Prevent people making multiple accounts
 
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. :)

eaglelegend 04-06-2009 12:27 PM

RE: Prevent people making multiple accounts
 
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.

kisazeky 04-06-2009 07:57 PM

RE: Prevent people making multiple accounts
 
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.

Blue Icebox 04-24-2009 01:44 AM

RE: Prevent people making multiple accounts
 
Well... since brandon made the 24 hours limit adoptable part... go to that section and change a little to fit the requirements! :D


All times are GMT -5. The time now is 04:30 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.