Possible further fix for #128
authorRoland Häder <roland@mxchange.org>
Sun, 20 Sep 2009 12:47:38 +0000 (12:47 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 20 Sep 2009 12:47:38 +0000 (12:47 +0000)
inc/functions.php
inc/libs/register_functions.php
inc/modules/admin.php
inc/modules/admin/what-admins_add.php
inc/modules/admin/what-edit_sponsor.php
inc/modules/admin/what-edit_user.php
inc/modules/guest/what-register.php
inc/modules/guest/what-sponsor_reg.php
inc/modules/member/what-mydata.php
inc/modules/sponsor/account.php

index eedc021..f55f513 100644 (file)
@@ -1421,7 +1421,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align =
                        $OUT .= "  <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_YEARS--}</strong></td>\n";
                }
 
-               if (ereg("M", $display) || (empty($display))) {
+               if (ereg('M', $display) || (empty($display))) {
                        $OUT .= "  <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_MONTHS--}</strong></td>\n";
                }
 
@@ -1461,7 +1461,7 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align =
                        $OUT .= "<INPUT type=\"hidden\" name=\"" . $prefix."_ye\" value=\"0\" />\n";
                }
 
-               if (ereg("M", $display) || (empty($display))) {
+               if (ereg('M', $display) || (empty($display))) {
                        // Generate month selection
                        $OUT .= "  <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix."_mo\" size=\"1\">\n";
                        for ($idx = 0; $idx <= 11; $idx++)
index 91cd13f..5ffff9c 100644 (file)
@@ -44,8 +44,8 @@ if (!defined('__SECURITY')) {
 
 //
 function registerMustFillout () {
-       $result = SQL_QUERY("SELECT field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`",
-       __FUNCTION__, __LINE__);
+       $result = SQL_QUERY("SELECT `field_name`, `field_required` FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id` ASC",
+               __FUNCTION__, __LINE__);
 
        while ($content = SQL_FETCHARRAY($result)) {
                $value = '';
@@ -67,36 +67,39 @@ function registerMustFillout () {
 }
 
 //
-function REGISTER_CHECK_REQUIRED_FIELDS (&$array) {
-       $ret = false;
+function ifRequiredRegisterFieldsAreSet (&$array) {
+       // By default all is fine
+       $ret = true;
        foreach ($array as $key => $value) {
-               $result = SQL_QUERY("SELECT field_required FROM `{!_MYSQL_PREFIX!}_must_register` WHERE field_name='".$key."' LIMIT 1",
-               __FUNCTION__, __LINE__);
+               // Check all fields that must register
+               $result = SQL_QUERY("SELECT `id` FROM `{!_MYSQL_PREFIX!}_must_register` WHERE `field_name`='".$key."' AND `field_required`='Y' LIMIT 1",
+                       __FUNCTION__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
-                       // "Must-line" found
-                       list($chk) = SQL_FETCHROW($result);
-
                        // Check if extension country is not found (you have to enter the 2-chars long country code) or
                        // if extensions is present check if country code was selected
                        //         01              2         21    12             3         32    234     5      54    4               43    34                      4    4      5      5432    2      3                      3210
-                       $country = ((!EXT_IS_ACTIVE('country')) || ((EXT_IS_ACTIVE('country')) && (((empty($value)) && ($key == "cntry")) || (($key == "country_code") && (!empty($value)))) && (!empty($array['country_code']))));
-                       if ((empty($value)) && ($chk == 'Y') && (!$country))
-                       {
+                       $country = ((!EXT_IS_ACTIVE('country')) || ((EXT_IS_ACTIVE('country')) && (((empty($value)) && ($key == 'cntry')) || (($key == 'country_code') && (!empty($value)))) && (!empty($array['country_code']))));
+                       if ((empty($value)) && (!$country)) {
                                // Required field not set
                                $array[$key] = '!';
-                               $ret = true;
-                       }
-               }
+                               $ret = false;
+                       } // END - if
+               } // END - if
 
                // Free result
                SQL_FREERESULT($result);
-       }
+       } // END - foreach
+
+       // Return result
        return $ret;
 }
 
-//
+// @TODO This function is no longer used???
 function REGISTER_OUTPUT_REQUIRE_CHECK (&$array) {
+       // Get all fields for output
        $result = SQL_QUERY("SELECT `field_name`, `field_required` FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FUNCTION__, __LINE__);
+
+       // Loop through them
        while ($content = SQL_FETCHARRAY($result)) {
                if (($array[$content['field_name']] == '!') && ($content['field_required'] == 'Y')) {
                        // Empty entry found
index cb12054..fde00d3 100644 (file)
@@ -178,7 +178,7 @@ if (!isAdminRegistered()) {
                        // Cannot validate the login data and hash
                        LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_VALIDATION_RESET_LOGIN_HASH_FAILED'));
                }
-       } elseif ((REQUEST_ISSET_POST('reset_pass')) && (REQUEST_ISSET_POST('hash')) && (REQUEST_ISSET_POST('login')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
+       } elseif ((REQUEST_ISSET_POST('reset_pass')) && (REQUEST_ISSET_POST('hash')) && (REQUEST_ISSET_POST('login')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
                // Okay, we shall the admin password here. So first revalidate the hash
                if (ADMIN_VALIDATE_RESET_LINK_HASH_LOGIN(REQUEST_POST('hash'), REQUEST_POST('login'))) {
                        // Set the password now
index 1d936d4..7dc2947 100644 (file)
@@ -48,7 +48,7 @@ ADD_DESCR('admin', __FILE__);
 // Display form is default
 $FORM = true;
 
-if ((REQUEST_ISSET_POST('add')) && (REQUEST_ISSET_POST('login')) && (REQUEST_ISSET_POST('email')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
+if ((REQUEST_ISSET_POST('add')) && (REQUEST_ISSET_POST('login')) && (REQUEST_ISSET_POST('email')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2')) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
        // Add admin when not added already
        if (REGISTER_ADMIN(REQUEST_POST('login'), generateHash(REQUEST_POST('pass1')), REQUEST_POST('email')) == 'done') {
                // Do not ouput any form!
index e0da7d4..d2b000d 100644 (file)
@@ -64,19 +64,19 @@ if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
                //  Personal data
                switch ($DATA['gender'])
                {
-                       case "M":
+                       case 'M':
                                define('__GENDER_M', ' selected="selected"');
                                define('__GENDER_F', '');
                                define('__GENDER_C', '');
                                break;
 
-                       case "F":
+                       case 'F':
                                define('__GENDER_M', '');
                                define('__GENDER_F', ' selected="selected"');
                                define('__GENDER_C', '');
                                break;
 
-                       case "C":
+                       case 'C':
                                define('__GENDER_M', '');
                                define('__GENDER_F', '');
                                define('__GENDER_C', ' selected="selected"');
@@ -95,9 +95,10 @@ if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
                define('__CELL'       , $DATA['cell']);
                define('__EMAIL'      , $DATA['email']);
                define('__URL'        , $DATA['url']);
+
                //  Warning because low points
-               define('__REC_WARNING', ADD_SELECTION('yn', $DATA['receive_warnings'], "receive_warning"));
-               define('__INTERVAL'   , createTimeSelections($DATA['warning_interval'], "warning_interval", "MWDh"));
+               define('__REC_WARNING', ADD_SELECTION('yn', $DATA['receive_warnings'], 'receive_warning'));
+               define('__INTERVAL'   , createTimeSelections($DATA['warning_interval'], 'warning_interval', 'MWDh'));
 
                // Init variables here
                $TPL = sprintf("admin_edit_sponsor_%s", REQUEST_GET('mode'));
@@ -156,10 +157,10 @@ if ((REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET('mode'))) {
 
                                case 'edit': // Edit sponsor account
                                        $PASS = true;
-                                       if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) || ((!REQUEST_ISSET_POST(('pass1'))) && (!REQUEST_ISSET_POST(('pass1'))))) {
+                                       if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) || ((!REQUEST_ISSET_POST('pass1')) && (!REQUEST_ISSET_POST('pass1')))) {
                                                // Remove passwords
-                                               REQUEST_UNSET_POST(('pass1'));
-                                               REQUEST_UNSET_POST(('pass2'));
+                                               REQUEST_UNSET_POST('pass1');
+                                               REQUEST_UNSET_POST('pass2');
                                                $PASS = false;
                                        }
 
index e8d3fbd..683a836 100644 (file)
@@ -53,7 +53,7 @@ if (REQUEST_ISSET_GET('uid')) {
 FROM `{!_MYSQL_PREFIX!}_user_data`
 WHERE userid=%s
 LIMIT 1",
-       array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+               array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
 }
 
 if ((SQL_NUMROWS($result_main) == 1) || (!REQUEST_ISSET_GET('uid')))
@@ -68,75 +68,66 @@ if ((SQL_NUMROWS($result_main) == 1) || (!REQUEST_ISSET_GET('uid')))
        {
                // Ok, change the account...
                $PASS = false; $add = '';
-               if ((!REQUEST_ISSET_POST(('pass1'))) && (!REQUEST_ISSET_POST(('pass2'))))
-               {
+               if ((!REQUEST_ISSET_POST('pass1')) && (!REQUEST_ISSET_POST('pass2'))) {
                        // Don't change the password
                        $PASS = true;
-               }
-               elseif ((REQUEST_POST('pass1') == REQUEST_POST('pass2')))
-               {
+               } elseif ((REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
                        // Change the password
                        $PASS = true;
-                       $add = ", password='".generateHash(REQUEST_POST('pass1'))."'";
+                       $add = ", `password`='" . generateHash(REQUEST_POST('pass1')) . "'";
                }
-               if ($PASS)
-               {
+
+               if ($PASS) {
                        // We have to add the following things: birthday and max receive mails
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET
-gender='%s',
-surname='%s',
-family='%s',
-street_nr='%s',
-country='%s',
-zip=%s,
-city='%s',
-email='%s'
+`gender`='%s',
+`surname`='%s',
+`family`='%s',
+`street_nr`='%s',
+`country`='%s',
+`zip`=%s,
+`city`='%s',
+`email`='%s'
 ".$add."
 WHERE userid=%s LIMIT 1",
                        array(
-                       substr(REQUEST_POST('gender'), 0, 1),
-                       REQUEST_POST('surname'),
-                       REQUEST_POST('family'),
-                       REQUEST_POST('street_nr'),
-                       REQUEST_POST('country'),
-                       bigintval(REQUEST_POST('zip')),
-                       REQUEST_POST('city'),
-                       REQUEST_POST('email'),
-                       bigintval(REQUEST_GET('uid')),
+                               substr(REQUEST_POST('gender'), 0, 1),
+                               REQUEST_POST('surname'),
+                               REQUEST_POST('family'),
+                               REQUEST_POST('street_nr'),
+                               REQUEST_POST('country'),
+                               bigintval(REQUEST_POST('zip')),
+                               REQUEST_POST('city'),
+                               REQUEST_POST('email'),
+                               bigintval(REQUEST_GET('uid')),
                        ), __FILE__, __LINE__);
-                       $content = USER_ACCOUNT_SAVED;
-               }
-               else
-               {
+                       $content = getMessage('USER_ACCOUNT_SAVED');
+               } else {
                        // Problem while saving data
-                       $content = USER_ACCOUNT_NOT_SAVED;
+                       $content = getMessage('USER_ACCOUNT_NOT_SAVED');
                }
 
                // Load template
                LOAD_TEMPLATE('admin_settings_saved', false, $content);
-       }
-       else
-       {
+       } else {
                // Display form to edit
                list($gender, $surname, $family, $street, $zip, $city, $country, $email, $bday, $bmonth, $byear, $max) = SQL_FETCHROW($result_main);
-               SQL_FREERESULT($result_main);
 
                // Transfer data to constants for the template
-               switch ($gender)
-               {
-                       case "M":
+               switch ($gender) {
+                       case 'M':
                                define('_GENDER_M', ' selected="selected"');
                                define('_GENDER_F', '');
                                define('_GENDER_C', '');
                                break;
 
-                       case "F":
+                       case 'F':
                                define('_GENDER_M', '');
                                define('_GENDER_F', ' selected="selected"');
                                define('_GENDER_C', '');
                                break;
 
-                       case "C":
+                       case 'C':
                                define('_GENDER_M', '');
                                define('_GENDER_F', '');
                                define('_GENDER_C', ' selected="selected"');
@@ -148,12 +139,15 @@ WHERE userid=%s LIMIT 1",
                define('_COUNTRY', $country); define('_EMAIL' , $email);
 
                // Load template
-               LOAD_TEMPLATE("admin_edit_user", false, bigintval(REQUEST_GET('uid')));
+               LOAD_TEMPLATE('admin_edit_user', false, bigintval(REQUEST_GET('uid')));
        }
 } else {
        // Account does not exists!
        LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
 }
 
+// Free the result
+SQL_FREERESULT($result_main);
+
 //
 ?>
index 5b37fad..44790f1 100644 (file)
@@ -62,8 +62,8 @@ if (!REQUEST_ISSET_POST(('agree')))        REQUEST_SET_POST('agree'       , '');
 if (!REQUEST_ISSET_POST(('addy')))         REQUEST_SET_POST('addy'        , '');
 if (!REQUEST_ISSET_POST(('surname')))      REQUEST_SET_POST('surname'     , '');
 if (!REQUEST_ISSET_POST(('family')))       REQUEST_SET_POST('family'      , '');
-if (!REQUEST_ISSET_POST(('pass1')))        REQUEST_SET_POST('pass1'       , '');
-if (!REQUEST_ISSET_POST(('pass2')))        REQUEST_SET_POST('pass2'       , '');
+if (!REQUEST_ISSET_POST('pass1'))        REQUEST_SET_POST('pass1'       , '');
+if (!REQUEST_ISSET_POST('pass2'))        REQUEST_SET_POST('pass2'       , '');
 if (!REQUEST_ISSET_POST(('day')))          REQUEST_SET_POST('day'         , '');
 if (!REQUEST_ISSET_POST(('month')))        REQUEST_SET_POST('month'       , '');
 if (!REQUEST_ISSET_POST(('year')))         REQUEST_SET_POST('year'        , '');
@@ -119,17 +119,23 @@ if (isFormSent()) {
                $isFailed = true;
        } // END - if
 
+       // Get temporary array for modification
+       $postArray = REQUEST_POST_ARRAY();
+
        // Check for required fields
-       if ($isFailed === false) $isFailed = REGISTER_CHECK_REQUIRED_FIELDS(REQUEST_POST_ARRAY());
+       if ($isFailed === false) $isFailed = ifRequiredRegisterFieldsAreSet($postArray);
+
+       // Set it back in request
+       REQUEST_SET_POST_ARRAY($postArray);
 
        // Did he enter his password twice?
-       if (((!REQUEST_ISSET_POST(('pass1'))) || (!REQUEST_ISSET_POST(('pass2')))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))))) {
-               if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2')))) {
+       if (((!REQUEST_ISSET_POST('pass1')) || (!REQUEST_ISSET_POST('pass2'))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2')))) {
+               if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2'))) {
                        REQUEST_SET_POST('pass1', '!');
                        REQUEST_SET_POST('pass2', '!');
                } else {
-                       if (!REQUEST_ISSET_POST(('pass1'))) { REQUEST_SET_POST('pass1', '!'); } else { REQUEST_SET_POST('pass1', ''); }
-                       if (!REQUEST_ISSET_POST(('pass2'))) { REQUEST_SET_POST('pass2', '!'); } else { REQUEST_SET_POST('pass2', ''); }
+                       if (!REQUEST_ISSET_POST('pass1')) { REQUEST_SET_POST('pass1', '!'); } else { REQUEST_SET_POST('pass1', ''); }
+                       if (!REQUEST_ISSET_POST('pass2')) { REQUEST_SET_POST('pass2', '!'); } else { REQUEST_SET_POST('pass2', ''); }
                }
                $isFailed = true;
        } // END - if
index 86f7f0b..ce88fd8 100644 (file)
@@ -166,17 +166,17 @@ if (isFormSent()) {
        }
 
        // Did he enter his password twice?
-       if (((!REQUEST_ISSET_POST(('pass1'))) || (!REQUEST_ISSET_POST(('pass2')))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))))) {
-               if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2')))) {
+       if (((!REQUEST_ISSET_POST('pass1')) || (!REQUEST_ISSET_POST('pass2'))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2')))) {
+               if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2'))) {
                        // Passwords missmatch
                        $FORM_ERRORS[] = getMessage('SPONSOR_PASSWORDS_MISMATCH');
                } else {
-                       if (!REQUEST_ISSET_POST(('pass1'))) {
+                       if (!REQUEST_ISSET_POST('pass1')) {
                                // Password 1 is empty
                                $FORM_ERRORS[] = getMessage('SPONSOR_PASSWORD1_EMPTY');
                        }
 
-                       if (!REQUEST_ISSET_POST(('pass2'))) {
+                       if (!REQUEST_ISSET_POST('pass2')) {
                                // Password 2 is empty
                                $FORM_ERRORS[] = getMessage('SPONSOR_PASSWORD2_EMPTY');
                        }
@@ -321,19 +321,19 @@ ORDER BY pay_name", __FILE__, __LINE__);
                        // Check for gender selection
                        switch (REQUEST_POST('gender'))
                        {
-                               case "M": // Male
+                               case 'M': // Male
                                        define('__GENDER_M'  , ' selected="selected"');
                                        define('__GENDER_F'  , '');
                                        define('__GENDER_C'  , '');
                                        break;
 
-                               case "F": // Female
+                               case 'F': // Female
                                        define('__GENDER_M'  , '');
                                        define('__GENDER_F'  , ' selected="selected"');
                                        define('__GENDER_C'  , '');
                                        break;
 
-                               case "C": // Company
+                               case 'C': // Company
                                        define('__GENDER_M'  , '');
                                        define('__GENDER_F'  , '');
                                        define('__GENDER_C'  , ' selected="selected"');
index e1fef34..7323139 100644 (file)
@@ -207,7 +207,7 @@ FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
                } else {
                        // Generate hash
                        $hash = generateHash(REQUEST_POST('pass1'), substr($DATA[1], 0, -40));
-                       if ((($hash == $DATA[1]) || (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) && (REQUEST_ISSET_POST(('pass1')))) {
+                       if ((($hash == $DATA[1]) || (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) && (REQUEST_ISSET_POST('pass1'))) {
                                // Only on simple changes normal mode is active = no email or password changed
                                $mode = 'normal'; $AND = '';
 
index 1052d83..7a3ada0 100644 (file)
@@ -49,13 +49,13 @@ if (!defined('__SECURITY')) {
 }
 
 // Data for the formular
-$result = SQL_QUERY_ESC("SELECT company, position, tax_ident,
-gender, surname, family, street_nr1, street_nr2, zip, city, country,
-phone, fax, cell, email, url,
-status, receive_warnings
+$result = SQL_QUERY_ESC("SELECT `company`, `position`, `tax_ident`,
+`gender`, `surname`, `family`, `street_nr1`, `street_nr2`, `zip`, `city`, `country`,
+`phone`, `fax`, `cell`, `email`, `url`,
+`status`, `receive_warnings`
 FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE `id`='%s' AND password='%s' LIMIT 1",
-array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FILE__, __LINE__);
+WHERE `id`='%s' AND `password`='%s' LIMIT 1",
+       array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FILE__, __LINE__);
 
 // Entry found?
 if (SQL_NUMROWS($result) == 1) {
@@ -71,16 +71,16 @@ if (SQL_NUMROWS($result) == 1) {
                        } elseif (md5(REQUEST_POST('pass_old')) != getSession('sponsorpass')) {
                                // Entered password didn't match password in DB
                                $message = getMessage('SPONSOR_CURRENT_PASSWORD_DIDNOT_MATCH_DB');
-                       } elseif ((REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))) && (REQUEST_POST('pass1') != REQUEST_POST('pass2'))) {
+                       } elseif ((REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2')) && (REQUEST_POST('pass1') != REQUEST_POST('pass2'))) {
                                // Both new passwords did not match
                                $message = getMessage('SPONSOR_BOTH_NEW_PASSWORDS_DIDNOT_MATCH');
-                       } elseif ((!REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2')))) {
+                       } elseif ((!REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2'))) {
                                // No password one entered
                                $message = getMessage('SPONSOR_PASSWORD_ONE_EMPTY');
-                       } elseif ((REQUEST_ISSET_POST(('pass1'))) && (!REQUEST_ISSET_POST(('pass2')))) {
+                       } elseif ((REQUEST_ISSET_POST('pass1')) && (!REQUEST_ISSET_POST('pass2'))) {
                                // No password two entered
                                $message = getMessage('SPONSOR_PASSWORD_TWO_EMPTY');
-                       } elseif ((REQUEST_ISSET_POST(('pass1'))) && (strlen(REQUEST_POST('pass1')) < getConfig('pass_len'))) {
+                       } elseif ((REQUEST_ISSET_POST('pass1')) && (strlen(REQUEST_POST('pass1')) < getConfig('pass_len'))) {
                                // Too short password
                                $message = sprintf(getMessage('SPONSOR_PASSWORD_TOO_SHORT'), getConfig('pass_len'));
                        } else {
@@ -88,7 +88,7 @@ if (SQL_NUMROWS($result) == 1) {
                                $PASS_AND = ''; $PASS_DATA = '';
 
                                // Check if we want to change password or not
-                               if ((REQUEST_POST('pass1') == REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_POST('pass1') != REQUEST_POST('pass_old'))) {
+                               if ((REQUEST_POST('pass1') == REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_POST('pass1') != REQUEST_POST('pass_old'))) {
                                        // Change current password
                                        $PASS_AND  = ", password='%s'";
                                        $PASS_DATA = md5(REQUEST_POST('pass1'));
@@ -120,19 +120,19 @@ if (SQL_NUMROWS($result) == 1) {
                        // Check for gender selection
                        switch ($content['gender'])
                        {
-                               case "M": // Male
+                               case 'M': // Male
                                        define('__GENDER_M', ' selected="selected"');
                                        define('__GENDER_F', '');
                                        define('__GENDER_C', '');
                                        break;
 
-                               case "F": // Female
+                               case 'F': // Female
                                        define('__GENDER_M', '');
                                        define('__GENDER_F', ' selected="selected"');
                                        define('__GENDER_C', '');
                                        break;
 
-                               case "C": // Company
+                               case 'C': // Company
                                        define('__GENDER_M', '');
                                        define('__GENDER_F', '');
                                        define('__GENDER_C', ' selected="selected"');
@@ -140,7 +140,7 @@ if (SQL_NUMROWS($result) == 1) {
                        }
 
                        // Output formular
-                       $OUT = LOAD_TEMPLATE("sponsor_account_form", true, $content);
+                       $OUT = LOAD_TEMPLATE('sponsor_account_form', true, $content);
                }
        } else {
                // Locked or so?