Thread: Multi Account
View Single Post
  #4  
Old 11-12-2009, 12:39 PM
Bloodrun's Avatar
Bloodrun Bloodrun is offline
I am, who I am.
 
Join Date: Apr 2009
Posts: 532
Gender: Male
Credits: 30,031
Bloodrun
Send a message via Yahoo to Bloodrun
Default RE: Multi Account

MyBB doesn't even have the function to ban multiple users at the same time. But that doesn't mean it can't be done.

Also the solution to making only one account allowed per IP is fairly simple.

In your register.php find where it says"

PHP Code:
else {



//Grab the post data from the form



$status $_POST["status"];

$username $_POST["username"];

$pass1 $_POST["pass1"];

$pass2 $_POST["pass2"];

$email $_POST["email"];

$tos $_POST["tos"];

$hidden $_POST["hidden"];

$css2 $_POST["css2"];

$profilepic $_POST["profilepic"];

$displayquote $_POST["displayquote"]; 
And put this right below it:

PHP Code:
$ip=$_SERVER['REMOTE_ADDR']; 
Then place this somewhere in the register form:

PHP Code:
        <p><input name='ip' type='hidden' id='ip' value='".$ip."'></p

Then find the where it says

PHP Code:
    else{



    
//All checks are done, actually create the user's account on the database



    
$date date('Y-m-d');



        
mysql_query("INSERT INTO ".$prefix."users VALUES ( 

And place this at the end, but inside the perenthesis:

PHP Code:
'$ip' 
Thn go to your MySql Database and add at they very bottom of your adopts_users table this:

Code:
  `ip` varchar(20) NOT NULL,
Doing all this will get and store each users IP upon registration, to actually block a user from registering using the same IP find whereit says:

PHP Code:
    }

    else{



    
//We are attempting to register the user...



    //First MD5 hash the passwords:



    
$pass1 md5($pass1);

    
$pass2 md5($pass2); 
and right below it place this:

PHP Code:
    //Next check that the IP does not already exist...



    
$flag1 0;

    
$query "SELECT * FROM ".$prefix."users WHERE ip = '$ip'";

    
$result = @mysql_query($query);

    
$num1 = @mysql_numrows($result);



    if(
$num1 0){

    
$flag1 1;

    } 
Then find where it says:

PHP Code:
    else if($tos != "yes"){



    
//User did not agree to TOS

    
$article_title "Terms of Service Error";

    
$article_content $notos;



    } 
And right below it put this:

PHP Code:
    else if($flag1 0){



    
//IP already exists

    
$article_title "Multiple Accounts is not permitted on this website.";

    
$article_content $userexists;    



    } 
If you followed everything, this should work. To test it out, create two more test accounts. You should get a message saying that you are not allowed to have multiple accounts once you attempt to create the second account.
Reply With Quote