From 374683503aacadbd6ae2221a9b1245ce602c559d Mon Sep 17 00:00:00 2001 From: Fabrixxm Date: Tue, 13 Nov 2012 04:52:32 -0500 Subject: [PATCH] uimport: check check to ensure the username isn't already taken before import (issue 508) --- include/uimport.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/uimport.php b/include/uimport.php index 9427931687..38b1772475 100644 --- a/include/uimport.php +++ b/include/uimport.php @@ -73,6 +73,18 @@ function import_account(&$a, $file) { return; } + + // check for username + $r = q("SELECT uid FROM user WHERE nickname='%s'", $account['user']['nickname']); + if ($r===false) { + logger("uimport:check nickname : ERROR : ".last_error(), LOGGER_NORMAL); + notice(t('Error! Cannot check nickname')); + return; + } + if (count($r)>0) { + notice(sprintf(t("User '%s' already exists on this server!"),$account['user']['nickname'])); + return; + } $oldbaseurl = $account['baseurl']; $newbaseurl = $a->get_baseurl(); -- 2.39.5