Marijn button #99

Merged
11166932 merged 152 commits from marijn-button into master 2017-01-23 13:25:08 +01:00
Showing only changes of commit 7df182676a - Show all commits

View File

@@ -1,4 +1,10 @@
<?php
/**
* Function for checking inputfields
* @param variable $example Give name of the inputfield.
* @param string $example2 Give the name of the option.
* @return sets correct to false and gives value to error message if it doesn't pass the checks.
*/
function checkInputChoice($variable, $option){
if (empty($_POST[$variable])) {
$GLOBALS[$variable . "Err"] = "Verplicht!";
@@ -25,18 +31,18 @@ function checkInputChoice($variable, $option){
default:
break;
}
}
}
/* Checks for only letters and spaces. */
function checkOnly($variable){
if (!preg_match("/^[a-zA-Z ]*$/",$GLOBALS[$variable])) {
$GLOBALS[$variable . "Err"] = "Alleen letters en spaties zijn toegestaan!";
$correct = false;
}
}
/* checks if username exist and if its longer than 6 characters. */
function username($variable){
if (strlen($GLOBALS[$variable]) < 6) {
$GLOBALS[$variable . "Err"] = "Gebruikersnaam moet minstens 6 karakters bevatten";
@@ -47,6 +53,7 @@ function username($variable){
}
}
/* checks if an input is longer that 8 characters. */
function longerEigth($variable){
if (strlen($GLOBALS[$variable]) < 8) {
$GLOBALS[$variable . "Err"] = "Moet minstens 8 karakters bevatten";
@@ -54,6 +61,7 @@ function longerEigth($variable){
}
}
/* checks if an input is a valid email. */
function validateEmail($variable){
if (!filter_var($GLOBALS[$variable], FILTER_VALIDATE_EMAIL)) {
$GLOBALS[$variable . "Err"] = "Geldige email invullen!";
@@ -66,6 +74,7 @@ function validateEmail($variable){
}
}
/* checks if two passwords matches. */
function matchPassword(){
if ($_POST["password"] != $_POST["confirmpassword"]) {
$GLOBALS["confirmpasswordErr"] = "Wachtwoorden matchen niet";
@@ -86,6 +95,7 @@ function registerCheck(){
}
}
/* removes weird characters of an input. */
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);