]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/register_functions.php
Maybe now better, but a simple wget still gives HTTP/1.0 :(
[mailer.git] / inc / libs / register_functions.php
index 817cc3f3dd3b639af46cd7f81f027e55b5c55bab..d73f86568fe9d32b1e0f5aa40e7611e26cfb8d02 100644 (file)
@@ -18,6 +18,7 @@
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -222,11 +223,18 @@ function isRegistrationDataComplete () {
        } // 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?
+       //* 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')) {
@@ -238,13 +246,16 @@ function isRegistrationDataComplete () {
        } // END - if
 
        // Check for IP timeout?
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay));
        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
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'isOkay='.intval($isOkay));
        return $isOkay;
 }
 
@@ -370,7 +381,7 @@ VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONF
        // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable
        $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`=0 LIMIT 1",
                array($userid), __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == '0') {
+       if (SQL_HASZERONUMS($result)) {
                // Add only when the line was not found (maybe some more secure?)
                $locked = 'points';