From 7ddb2bd1831fd14fe249f922e25aebedf4d491fd Mon Sep 17 00:00:00 2001 From: fen7azy Date: Thu, 19 Jun 2014 21:23:44 +0300 Subject: [PATCH] Add Checking if email is already used Add Checking if email is already used when try to register. If email is already in the DB, you will get error that this email is already used. --- sections/register/index.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sections/register/index.php b/sections/register/index.php index 864801a0..de654aed 100644 --- a/sections/register/index.php +++ b/sections/register/index.php @@ -59,6 +59,7 @@ $Err = 'You cannot have a username of "0" or "1".'; } + // Check if username is already used $DB->query(" SELECT COUNT(ID) FROM users_main @@ -69,6 +70,18 @@ $Err = 'There is already someone registered with that username.'; $_REQUEST['username'] = ''; } + + // Check if email is already used + $DB->query(" + SELECT COUNT(ID) + FROM users_main + WHERE Email LIKE '".db_string(trim($_POST['email']))."'"); + list($EmailCount) = $DB->next_record(); + + if ($EmailCount) { + $Err = 'There is already someone registered with that email.'; + $_REQUEST['email'] = ''; + } if ($_REQUEST['invite']) { $DB->query("