Search for email with regular expression
authorRoland Häder <roland@mxchange.org>
Fri, 29 Jul 2011 10:00:13 +0000 (10:00 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 29 Jul 2011 10:00:13 +0000 (10:00 +0000)
inc/filters.php
inc/functions.php
inc/libs/admins_functions.php
inc/libs/sponsor_functions.php
inc/libs/user_functions.php
inc/modules/admin/admin-inc.php
inc/modules/guest/what-sponsor_login.php

index c24ca0c73614660b735a995c0e69a7d98da12f2b..2737ceca3b7dfc173bd3c7edcbb10dd8afc4d51b 100644 (file)
@@ -1150,7 +1150,7 @@ function FILTER_ADD_HISTORY_ENTRY ($filterData) {
                __FUNCTION__, __LINE__);
 
        // Remember insert id for other filters
-       $filterData['history_id'] = SQL_INSERT_ID();
+       $filterData['history_id'] = SQL_INSERTID();
 
        // Return data
        return $filterData;
index 0f96686c20698392812a06755c7db34096dde385..a452aab3571b95665f8c62be10e3d3dc062dd30d 100644 (file)
@@ -92,7 +92,7 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
        } // END - if
 
        // Set from header
-       if ((!isInStringIgnoreCase('@', $toEmail)) && ($toEmail > 0)) {
+       if ((!isInStringIgnoreCase('@', str_replace('{AT}', '@', $toEmail))) && ($toEmail > 0)) {
                // Does the user exist?
                if ((isExtensionActive('user')) && (fetchUserData($toEmail))) {
                        // Get the email
index 2b7c2de65247a1b10f0f0f6fc061e4be88451a49..5338cbdf59333665da0afb574cc7feb454e4c198 100644 (file)
@@ -138,13 +138,13 @@ function isAdminsAllowedByAcl ($action, $what) {
 // Create email link to admins's account
 function generateAdminEmailLink ($email, $mod = 'admin') {
        // Is it an email?
-       if (strpos($email, '@') !== false) {
+       if (strpos(str_replace('{AT}', '@', $email), '@') !== false) {
                // Create email link
                $result = SQL_QUERY_ESC("SELECT `id`
 FROM
        `{?_MYSQL_PREFIX?}_admins`
 WHERE
-       `email`='%s'
+       '%s' REGEXP `email`
 LIMIT 1",
                array($email), __FUNCTION__, __LINE__);
 
index 77e0654db9a01aa8007b76ce3e31cadd3d3537a4..48fabe24ea86c89c378dfbf169b91e3415c5b983 100644 (file)
@@ -535,7 +535,8 @@ function generateSponsorEmailLink ($email, $mod = 'admin') {
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
 WHERE
-       `email`='%s'" . $locked."
+       '%s' REGEXP `email`
+       " . $locked . "
 LIMIT 1",
                array($email), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
@@ -565,7 +566,7 @@ function doProcessSponsorFormRequest ($messageArray = array()) {
        switch ($status) {
                case 'added': // Sponsor successfully added with account status = UNCONFIRMED!
                        // Check for his id number
-                       $result = SQL_QUERY_ESC("SELECT `id`,`hash` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE `email`='%s' LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `id`,`hash` FROM `{?_MYSQL_PREFIX?}_sponsor_data` WHERE '%s' REGEXP `email` LIMIT 1",
                                array(postRequestParameter('email')), __FUNCTION__, __LINE__);
                        if (SQL_NUMROWS($result) == 1) {
                                // id found so let's load it for the confirmation email
index 33fa5067ceb38a1a224f049b956f914d6518b4e3..e4cd9e48b40460f7a617db8a5113616e841c4cab 100644 (file)
@@ -192,16 +192,22 @@ function generateUserEmailLink ($email, $mod = 'admin') {
        $locked = " AND `status`='CONFIRMED'";
 
        // But admins shall always see it
-       if (isAdmin()) $locked = '';
+       if (isAdmin()) {
+               $locked = '';
+       } // END - if
 
+       // Search for the email address
        $result = SQL_QUERY_ESC("SELECT
        `userid`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
-       `email`='%s'" . $locked."
+       '%s' REGEXP `email`
+       " . $locked . "
 LIMIT 1",
                array($email), __FUNCTION__, __LINE__);
+
+       // Do we have an entry?
        if (SQL_NUMROWS($result) == 1) {
                // Load userid
                list($userid) = SQL_FETCHROW($result);
index 9cba381f1dbba475a797414ffca283a2e24318c4..308939d9b888cb1eef89341830a6bf9d0bbe6ccc 100644 (file)
@@ -1410,7 +1410,7 @@ function sendAdminPasswordResetLink ($email) {
        $OUT = '';
 
        // Look up administator login
-       $result = SQL_QUERY_ESC("SELECT `id`,`login`,`password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `email`='%s' LIMIT 1",
+       $result = SQL_QUERY_ESC("SELECT `id`,`login`,`password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE '%s' REGEXP `email` LIMIT 1",
                array($email), __FUNCTION__, __LINE__);
 
        // Is there an account?
index fe65aaf38ed2d71d21f00de8180e11c7302c3fdb..d58af71f6edff48cc350b56546516edf35f9fba6 100644 (file)
@@ -161,7 +161,7 @@ LIMIT 1",
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
 WHERE
-       `email`='%s' AND
+       '%s' REGEXP `email` AND
        (`status`='UNCONFIRMED' OR `status`='EMAIL')
 LIMIT 1",
                array(postRequestParameter('email')), __FILE__, __LINE__);
@@ -212,7 +212,7 @@ LIMIT 1",
 FROM
        `{?_MYSQL_PREFIX?}_sponsor_data`
 WHERE
-       `email`='%s' AND
+       '%s' REGEXP `email` AND
        `id`=%s AND
        `status`='CONFIRMED'
 LIMIT 1",