Fixed date and other extras

This commit is contained in:
Joey Lai
2017-01-26 14:50:41 +01:00
parent 4c5ea08614
commit 96f70e1a11
8 changed files with 156 additions and 72 deletions

View File

@@ -38,8 +38,7 @@ function checkName($variable){
if (empty($variable)) {
throw new lettersAndSpacesException("Verplicht!");
} else if (!preg_match("/^[a-zA-Z ]*$/", $variable)) {
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
}
}
@@ -48,12 +47,12 @@ function validateBday($variable){
if (empty($variable)) {
throw new bdayException("Verplicht!");
} else {
if (!(validateDate($variable, "Y/m/d"))) {
if (!(validateDate($variable, "Y-m-d"))) {
throw new bdayException("Geen geldige datum");
} else {
$dateNow = date("Y/m/d");
$dateNow = date("Y-m-d");
if ($dateNow < $variable) {
throw new bdayException("Geen geldige datum");
throw new bdayException("Geen geldige datum!");
}
}
}
@@ -97,6 +96,12 @@ function validateEmail($variable){
}
}
function matchEmail(){
if (strtolower($_POST["email"]) != strtolower($_POST["confirmEmail"])){
throw new confirmEmailException("Emails matchen niet!");
}
}
/* checks if an input is a valid email. */
function resetEmail($variable){
if (empty($variable)) {
@@ -206,6 +211,14 @@ class emailException extends Exception
}
}
class confirmEmailException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
class captchaException extends Exception
{
public function __construct($message = "", $code = 0, Exception $previous = null)