- Only validate fields we care about, not any field we find in the loaded user

This commit is contained in:
dave 2009-09-26 18:18:43 +00:00
parent c23ce973b1
commit d10c98f8fd

View File

@ -113,16 +113,15 @@ case 'save':
/* Set values */
foreach($fields as $f) {
$u[$f] = stripslashes($_POST[$f]);
}
foreach($u as $f=>$v) {
if($v == '') continue;
/* Allow the user to clear a field regardless of regex */
if($u[$f] == '') continue;
/* See if this field has a validate */
if(isset($user_personal_fields[$f]['regexp'])) {
/* Match the regex */
if(!ereg($user_personal_fields[$f]['regexp'], $v)) {
if(!ereg($user_personal_fields[$f]['regexp'], $u[$f])) {
/* Bad */
echo "bad regex match ({$user_personal_fields[$f]['regexp']})";
$save = false;
$errorfields[] = $f;
}
@ -153,6 +152,7 @@ case 'save':
$q=mysql_query("SELECT id FROM users WHERE email='$em' AND uid!='{$u['uid']}' AND deleted='no'");
if(mysql_num_rows($q) > 0) {
error_("That email address is in use by another user");
echo "email error";
$save = false;
}