]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/register_functions.php
Fixes for member registration (IP lock) and rewrites for remote IP address
[mailer.git] / inc / libs / register_functions.php
index 8dc9420473d6b80a321838fcbef9b7dbc5fe0ad1..5a50b7df0741121bac180c4c2b534d8017e23b75 100644 (file)
@@ -223,11 +223,18 @@ function isRegistrationDataComplete () {
        } // END - if
 
        // Do this check only when no admin is logged in
        } // END - if
 
        // Do this check only when no admin is logged in
-       foreach (postRequestParameter('cat') as $id => $answer) {
-               if ($answer == 'Y') $GLOBALS['register_selected_cats']++;
-       } // END - foreach
+       if (is_array(postRequestParameter('cat'))) {
+               // Only continue with array
+               foreach (postRequestParameter('cat') as $id => $answer) {
+                       // Is this category choosen?
+                       if ($answer == 'Y') {
+                               $GLOBALS['register_selected_cats']++;
+                       } // END - if
+               } // END - foreach
+       } // END - if
 
        // Enougth categories selected?
 
        // Enougth categories selected?
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay).',selected='.$GLOBALS['register_selected_cats'].'/'.getConfig('least_cats'));
        $isOkay = (($isOkay) && ($GLOBALS['register_selected_cats'] >= getConfig('least_cats')));
 
        if ((postRequestParameter('email') != '!') && (getConfig('check_double_email') == 'Y')) {
        $isOkay = (($isOkay) && ($GLOBALS['register_selected_cats'] >= getConfig('least_cats')));
 
        if ((postRequestParameter('email') != '!') && (getConfig('check_double_email') == 'Y')) {
@@ -239,13 +246,16 @@ function isRegistrationDataComplete () {
        } // END - if
 
        // Check for IP timeout?
        } // END - if
 
        // Check for IP timeout?
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay));
        if ((!isAdmin()) && (getConfig('ip_timeout') > 0)) {
                // Check his IP number
        if ((!isAdmin()) && (getConfig('ip_timeout') > 0)) {
                // Check his IP number
-               $GLOBALS['registration_ip_timeout'] = (countSumTotalData(detectRemoteAddr()  , 'user_data', 'userid', 'REMOTE_ADDR', true, " AND (`joined` > (UNIX_TIMESTAMP() - {?ip_timeout?}) OR `last_update` > (UNIX_TIMESTAMP() - {?ip_timeout?}))") == 1);
-               $isOkay = false;
+               $GLOBALS['registration_ip_timeout'] = (countSumTotalData(detectRemoteAddr()  , 'user_data', 'userid', 'REMOTE_ADDR', true, " AND ((UNIX_TIMESTAMP() - `joined`) < {?ip_timeout?} OR (UNIX_TIMESTAMP() - `last_update`) < {?ip_timeout?}) LIMIT 1") == 1);
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay).',timeout='.intval($GLOBALS['registration_ip_timeout']));
+               $isOkay = (($isOkay) && (!$GLOBALS['registration_ip_timeout']));
        } // END - if
 
        // Return result
        } // END - if
 
        // Return result
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay));
        return $isOkay;
 }
 
        return $isOkay;
 }