From 4e56e2399f035e122ea7861e024829b8e4927f9c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 30 May 2016 00:03:37 +0200 Subject: [PATCH] Allow Email checking for account availability --- security/Security.php | 8 ++++++-- security/qq/SYS_SECURITY_AVAILABLE_EMAIL.php | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 security/qq/SYS_SECURITY_AVAILABLE_EMAIL.php diff --git a/security/Security.php b/security/Security.php index a53b1f8..5d8ed28 100644 --- a/security/Security.php +++ b/security/Security.php @@ -77,8 +77,12 @@ class Security { return $_SESSION[\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL)];} // Determine if username exists - public static function available($username){ - $res = \SYSTEM\SQL\SYS_SECURITY_AVAILABLE::Q1(array($username)); + public static function available($username,$email=null){ + if($email){ + $res = \SYSTEM\SQL\SYS_SECURITY_AVAILABLE_EMAIL::Q1(array($username,$email)); + } else { + $res = \SYSTEM\SQL\SYS_SECURITY_AVAILABLE::Q1(array($username));} + if(!$res){ throw new \SYSTEM\LOG\ERRROR("Cannot determine the availability of username!");} if($res['count'] != 0){ diff --git a/security/qq/SYS_SECURITY_AVAILABLE_EMAIL.php b/security/qq/SYS_SECURITY_AVAILABLE_EMAIL.php new file mode 100644 index 0000000..5694791 --- /dev/null +++ b/security/qq/SYS_SECURITY_AVAILABLE_EMAIL.php @@ -0,0 +1,13 @@ +