mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-21 13:09:41 +01:00
Changed the way create.php checks for existing usernames to be less intensive on the database
This commit is contained in:
parent
ff68278111
commit
c8315cf8f6
@ -72,12 +72,13 @@ foreach ($bannedWords as $i => $w) {
|
|||||||
error("Cannot create board matching banned pattern $w");
|
error("Cannot create board matching banned pattern $w");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$query = prepare('SELECT * FROM ``mods``');
|
$query = prepare('SELECT ``username`` FROM ``mods`` WHERE ``username`` = :username');
|
||||||
|
$query->bindValue(':username', $username);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
$users = $query->fetchAll(PDO::FETCH_ASSOC);
|
$users = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||||
foreach ($users as $i => $user) {
|
|
||||||
if ($user['username'] == $username)
|
if (sizeof($users) > 0){
|
||||||
error('Username taken!');
|
error('The username you\'ve tried to enter already exists!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$salt = generate_salt();
|
$salt = generate_salt();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user