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')) {
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);
// 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'),
bigintval(REQUEST_POST('month')),
bigintval(REQUEST_POST('year')),
bigintval(REQUEST_POST('max_mails')),
- getUserId(),
- getSession('u_hash')
+ getUserId()
), __FILE__, __LINE__);
} else {
// Old way
`notified`='N',
`last_profile_sent`=UNIX_TIMESTAMP()
WHERE
- `userid`=%s AND `password`='%s'
+ `userid`=%s
LIMIT 1",
array(
REQUEST_POST('gender'),
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'));
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&what=welcome&msg=' . urlencode(getMessage('PROFILE_UPDATED'));
break;