]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/sponsor/account.php
Complete rewrite of and , wrapper functions added, see bug #101
[mailer.git] / inc / modules / sponsor / account.php
index b5f9a51493a3c0045d560746126402ea3297f79c..03385407ce18fc2a2256711fc7907cbfb392d3a8 100644 (file)
@@ -58,24 +58,24 @@ if (SQL_NUMROWS($result) == 1) {
        $content = SQL_FETCHARRAY($result);
        if ($content['status'] == "CONFIRMED") {
                // Check if form was submitted or not
-               if (!empty($_POST['ok'])) {
+               if (IS_FORM_SENT()) {
                        // Check passwords
-                       if (empty($_POST['pass_old'])) {
+                       if (!REQUEST_ISSET_POST(('pass_old'))) {
                                // No current password entered
                                $MSG = getMessage('SPONSOR_NO_CURRENT_PASSWORD_ENTERED');
-                       } elseif (md5($_POST['pass_old']) != get_session('sponsorpass')) {
+                       } elseif (md5(REQUEST_POST('pass_old')) != get_session('sponsorpass')) {
                                // Entered password didn't match password in DB
                                $MSG = getMessage('SPONSOR_CURRENT_PASSWORD_DIDNOT_MATCH_DB');
-                       } elseif ((!empty($_POST['pass1'])) && (!empty($_POST['pass2'])) && ($_POST['pass1'] != $_POST['pass2'])) {
+                       } elseif ((REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))) && (REQUEST_POST('pass1') != REQUEST_POST('pass2'))) {
                                // Both new passwords did not match
                                $MSG = getMessage('SPONSOR_BOTH_NEW_PASSWORDS_DIDNOT_MATCH');
-                       } elseif ((empty($_POST['pass1'])) && (!empty($_POST['pass2']))) {
+                       } elseif ((!REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2')))) {
                                // No password one entered
                                $MSG = getMessage('SPONSOR_PASSWORD_ONE_EMPTY');
-                       } elseif ((!empty($_POST['pass1'])) && (empty($_POST['pass2']))) {
+                       } elseif ((REQUEST_ISSET_POST(('pass1'))) && (!REQUEST_ISSET_POST(('pass2')))) {
                                // No password two entered
                                $MSG = getMessage('SPONSOR_PASSWORD_TWO_EMPTY');
-                       } elseif ((!empty($_POST['pass1'])) && (strlen($_POST['pass1']) < getConfig('pass_len'))) {
+                       } elseif ((REQUEST_ISSET_POST(('pass1'))) && (strlen(REQUEST_POST('pass1')) < getConfig('pass_len'))) {
                                // Too short password
                                $MSG = sprintf(getMessage('SPONSOR_PASSWORD_TOO_SHORT'), getConfig('pass_len'));
                        } else {
@@ -83,10 +83,10 @@ if (SQL_NUMROWS($result) == 1) {
                                $PASS_AND = ""; $PASS_DATA = "";
 
                                // Check if we want to change password or not
-                               if (($_POST['pass1'] == $_POST['pass2']) && (!empty($_POST['pass1'])) && ($_POST['pass1'] != $_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($_POST['pass1']);
+                                       $PASS_DATA = md5(REQUEST_POST('pass1'));
                                }
 
                                // Unsecure data which we don't want here
@@ -94,14 +94,14 @@ if (SQL_NUMROWS($result) == 1) {
 
                                // Remove all (maybe spoofed) unsafe data from array
                                foreach ($UNSAFE as $remove) {
-                                       unset($_POST[$remove]);
+                                       REQUEST_UNSET_POST($remove);
                                }
 
                                // Set last change timestamp
-                               $_POST['last_change'] = time();
+                               REQUEST_SET_POST('last_change', "UNIX_TIMESTAMP()");
 
                                // Save data
-                               $MSG = SPONSOR_SAVE_DATA($_POST, $content);
+                               $MSG = SPONSOR_SAVE_DATA(REQUEST_POST_ARRAY(), $content);
                        }
 
                        if (!empty($MSG)) {