X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fregister.php;h=06ed1e0f18fb4bb936bd3fd627f8d9077e97e7eb;hb=a41b4c6e6726b1158a8d05f37c1630d67e462fe5;hp=95e9d581f1c9806e19d1818ed3da73f972252d9f;hpb=067626380db6d5ed71d68bd91481ff51cfa76915;p=friendica.git diff --git a/mod/register.php b/mod/register.php index 95e9d581f1..06ed1e0f18 100644 --- a/mod/register.php +++ b/mod/register.php @@ -199,6 +199,24 @@ function register_post(&$a) { return; } + /** + * if somebody clicked submit twice very quickly, they could end up with two accounts + * due to race condition. Remove this one. + */ + + $r = q("SELECT `uid` FROM `user` + WHERE `nickname` = '%s' ", + dbesc($nickname) + ); + if((count($r) > 1) && $newuid) { + $err .= t('Nickname is already registered. Please choose another.') . EOL; + q("DELETE FROM `user` WHERE `uid` = %d LIMIT 1", + intval($newuid) + ); + notice ($err); + return; + } + if(x($newuid) !== false) { $r = q("INSERT INTO `profile` ( `uid`, `profile-name`, `is-default`, `name`, `photo`, `thumb`, `publish`, `net-publish` ) VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, %d ) ",