Fix profile form validation
parent
0a79d465ac
commit
879b1d8e3f
|
@ -5,7 +5,7 @@
|
||||||
$query = $RUNTIME['PDO']->prepare('SELECT 1 FROM UserAccounts WHERE '.$part.' = ? AND '.$otherPart.' = ?');
|
$query = $RUNTIME['PDO']->prepare('SELECT 1 FROM UserAccounts WHERE '.$part.' = ? AND '.$otherPart.' = ?');
|
||||||
$query->execute(array($value, $otherValue));
|
$query->execute(array($value, $otherValue));
|
||||||
|
|
||||||
if($query->rowCount() != 0) {
|
if($query->rowCount() == 0) {
|
||||||
$statement = $RUNTIME['PDO']->prepare('UPDATE UserAccounts SET '.$part.' = ? WHERE PrincipalID = ?');
|
$statement = $RUNTIME['PDO']->prepare('UPDATE UserAccounts SET '.$part.' = ? WHERE PrincipalID = ?');
|
||||||
$statement->execute(array($value, $_SESSION['UUID']));
|
$statement->execute(array($value, $_SESSION['UUID']));
|
||||||
return true;
|
return true;
|
||||||
|
@ -39,11 +39,11 @@
|
||||||
}
|
}
|
||||||
else if(isset($_POST['saveProfileData'])) {
|
else if(isset($_POST['saveProfileData'])) {
|
||||||
$validator = new FormValidator(array(
|
$validator = new FormValidator(array(
|
||||||
'formInputFeldVorname' => array('regex' => '/[^\\/<>\s]{1,64}/'),
|
'formInputFeldVorname' => array('regex' => '/^[^\\/<>\s]{1,64}$/'),
|
||||||
'formInputFeldNachname' => array('regex' => '/[^\\/<>\s]{1,64}/'),
|
'formInputFeldNachname' => array('regex' => '/^[^\\/<>\s]{1,64}$/'),
|
||||||
'formInputFeldEMail' => array('regex' => '/\S{1,64}@\S{1,250}.\S{2,64}/'),
|
'formInputFeldEMail' => array('regex' => '/^\S{1,64}@\S{1,250}.\S{2,64}$/'),
|
||||||
'formInputFeldOfflineIM' => array('regex' => '/(|on)/'),
|
'formInputFeldOfflineIM' => array('regex' => '/^(|on)$/'),
|
||||||
'formInputFeldPartnerName' => array('regex' => '/[^\\/<>\s]{1,64} [^\\/<>\s]{1,64}/')
|
'formInputFeldPartnerName' => array('regex' => '/^[^\\/<>\s]{1,64} [^\\/<>\s]{1,64}$/')
|
||||||
));
|
));
|
||||||
|
|
||||||
if($validator->isValid($_POST)) {
|
if($validator->isValid($_POST)) {
|
||||||
|
|
Loading…
Reference in New Issue