View Single Post
  #1  
Old 04-04-2009, 04:53 PM
kisazeky kisazeky is offline
Member
 
Join Date: Mar 2009
Posts: 44
Credits: 19,370
kisazeky
Default 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')");