]> git.mxchange.org Git - mailer.git/commitdiff
Possible fix for non-working profile update
authorRoland Häder <roland@mxchange.org>
Wed, 7 Oct 2009 23:01:21 +0000 (23:01 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 7 Oct 2009 23:01:21 +0000 (23:01 +0000)
inc/language/de.php
inc/modules/member/what-mydata.php

index 0a4c9b0bbc694b13b1f1d5fa62348aa1c5a87a26..bb29007de0473475abeeaf55f924f01d09b1fe46 100644 (file)
@@ -335,6 +335,7 @@ define('GENDER_C', "&quot;Firma&quot;");
 define('SAVE_CHANGES', "&Auml;nderungen speichern");
 define('MYDATA_NOTE', "Geben Sie nur bei <strong>Passwort</strong> Ihr aktuelles Passwort ein, wenn Sie nur Daten &auml;ndern wollen. Geben Sie bei <strong>Passwortbest&auml;tigung</strong> das neue Passwort erneut ein, wenn Sie Ihr aktuelles Passwort &auml;ndern wollen.");
 define('MEMBER_UPDATE_PWD_WRONG', "Bitte geben Sie Ihr aktuelles Passwort zum &Auml;ndern Ihrer Einstellungen ein. Wir haben dies zur Sicherheit unserer Mitglieder eingebaut.");
+define('MEMBER_UPDATE_FAILED', "Bei der Aktualisierung Ihres Kontos ist ein Fehler entstanden. Es wurden keine Daten aktualisiert.");
 define('MEMBER_HAVE_CHANGED_DATA', "Sie haben heute Ihr Mitgliedsprofil ge&auml;ndert.");
 define('YOUR_NEW_DATA', "Hier sind Ihre neuen Profildaten");
 define('PLEASE_NOTIFY_ABUSE_MYDATA', "Sollten Sie diese &auml;nderungen nicht durchgef&uuml;hrt haben, benachrichten Sie uns bitte! ({!WEBMASTER!})");
index 2a90cfa4bdf7d68d53a4fc1e6124c011799b7596..d4768332ddb0b001a66cc2bb755536b4eed26138 100644 (file)
@@ -86,15 +86,15 @@ switch ($mode) {
                        define('CHANGE', "<div class=\"member_failed\">".sprintf(getMessage('MEMBER_PROFILE_LOCKED'), generateDateTime($DATA[13] + getConfig('profile_lock'), '0'))."</div>");
                } else {
                        // He is allowed to change his profile
-                       define('CHANGE', LOAD_TEMPLATE("member_mydata_button", true));
+                       define('CHANGE', LOAD_TEMPLATE('member_mydata_button', true));
                }
 
                if (strlen($DATA[7]) == 1) $DATA[7] = '0'.$DATA[7];
                if (strlen($DATA[8]) == 1) $DATA[8] = '0'.$DATA[8];
 
                switch (getLanguage()) {
-                       case 'de': define('DOB', $DATA[7].'.'.$DATA[8].'.'.$DATA[9]); break;
-                       default  : define('DOB', $DATA[8].'-'.$DATA[7].'-'.$DATA[9]); break;
+                       case 'de': define('DOB', $DATA[7] . '.' . $DATA[8] . '.' . $DATA[9]); break;
+                       default  : define('DOB', $DATA[8] . '-' . $DATA[7] . '-' . $DATA[9]); break;
                } // END - switch
 
                if (EXT_IS_ACTIVE('country')) {
@@ -189,8 +189,8 @@ FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
                break;
 
        case 'save': // Save entered data
-               // Load old email / password:      0        1          2
-               $result = SQL_QUERY_ESC("SELECT email, password, last_update FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
+               // Load old email / password:      0          1           2
+               $result = SQL_QUERY_ESC("SELECT `email`, `password`, `last_update` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
                        array(getUserId()), __FILE__, __LINE__);
                $DATA = SQL_FETCHROW($result);
                SQL_FREERESULT($result);
@@ -228,17 +228,21 @@ FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
                                // Update member's profile
                                if (EXT_IS_ACTIVE('country')) {
                                        // New way
-                                       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET
-`gender`='%s', `surname`='%s', `family`='%s',
-`street_nr`='%s',
-`country_code`=%s, `zip`=%s, `city`='%s',
-`email`='%s',
-`birth_day`=%s, `birth_month`=%s, `birth_year`=%s,
-`max_mails`=%s,
-`last_update`=UNIX_TIMESTAMP()".$AND.",
-`notified`='N',
-`last_profile_sent`=UNIX_TIMESTAMP()
-WHERE `userid`=%s AND `password`='%s' LIMIT 1",
+                                       SQL_QUERY_ESC("UPDATE
+       `{!_MYSQL_PREFIX!}_user_data`
+SET
+       `gender`='%s', `surname`='%s', `family`='%s',
+       `street_nr`='%s',
+       `country_code`=%s, `zip`=%s, `city`='%s',
+       `email`='%s',
+       `birth_day`=%s, `birth_month`=%s, `birth_year`=%s,
+       `max_mails`=%s,
+       `last_update`=UNIX_TIMESTAMP()".$AND.",
+       `notified`='N',
+       `last_profile_sent`=UNIX_TIMESTAMP()
+WHERE
+       `userid`=%s
+LIMIT 1",
                                                array(
                                                        REQUEST_POST('gender'),
                                                        REQUEST_POST('surname'),
@@ -252,8 +256,7 @@ WHERE `userid`=%s AND `password`='%s' LIMIT 1",
                                                        bigintval(REQUEST_POST('month')),
                                                        bigintval(REQUEST_POST('year')),
                                                        bigintval(REQUEST_POST('max_mails')),
-                                                       getUserId(),
-                                                       getSession('u_hash')
+                                                       getUserId()
                                                ), __FILE__, __LINE__);
                                } else {
                                        // Old way
@@ -270,7 +273,7 @@ SET
        `notified`='N',
        `last_profile_sent`=UNIX_TIMESTAMP()
 WHERE
-       `userid`=%s AND `password`='%s'
+       `userid`=%s
 LIMIT 1",
                                                array(
                                                        REQUEST_POST('gender'),
@@ -285,16 +288,21 @@ LIMIT 1",
                                                        bigintval(REQUEST_POST('month')),
                                                        bigintval(REQUEST_POST('year')),
                                                        bigintval(REQUEST_POST('max_mails')),
-                                                       getUserId(),
-                                                       getSession('u_hash')
+                                                       getUserId()
                                                ), __FILE__, __LINE__);
                                }
 
-                               // Get all modes ...
-                               $modes = explode(';', $mode);
+                               // Did something change?
+                               if (SQL_AFFECTEDROWS() == 1) {
+                                       // Get all modes ...
+                                       $modes = explode(';', $mode);
 
-                               // ... and run them through
-                               sendModeMails ('mydata', $modes);
+                                       // ... and run them through
+                                       sendModeMails ('mydata', $modes);
+                               } else {
+                                       // Something went wrong
+                                       LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEMBER_UPDATE_FAILED'));
+                               }
                        } else {
                                // Entered wrong pass for updating profile
                                LOAD_TEMPLATE('admin_settings_saved', false, getMessage('MEBER_UPDATE_PWD_WRONG'));
@@ -303,7 +311,7 @@ LIMIT 1",
                break;
 
        case 'notify': // Switch off notfication
-               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET notified='N', last_update=UNIX_TIMESTAMP() WHERE userid=%s LIMIT 1",
+               SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `notified`='N', `last_update`=UNIX_TIMESTAMP() WHERE `userid`=%s LIMIT 1",
                        array(getUserId()), __FILE__, __LINE__);
                $URL = 'modules.php?module=login&amp;what=welcome&amp;msg=' . urlencode(getMessage('PROFILE_UPDATED'));
                break;