forked from science-ation/science-ation
- Only validate fields we care about, not any field we find in the loaded user
This commit is contained in:
parent
c23ce973b1
commit
d10c98f8fd
@ -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,13 +152,14 @@ 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;
|
||||
}
|
||||
|
||||
if($save == true) {
|
||||
user_save($u);
|
||||
happy_("%1 %2 successfully updated",array($_POST['firstname'],$_POST['lastname']));
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user