Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ControleGeldigheid($aantalErrors){
- //echo "ControleGeldigheid() Started"."<br>";
- $errors = array();
- $userName = $_POST['user'];
- $email = $_POST['email'];
- $password = $_POST['pass'];
- $cpassword = $_POST['cpass'];
- $mainCharacter = $_POST['mainCharacter'];
- //echo "Controle username"."<br>";
- if (!preg_match("/^[0-9a-zA-Z ]*$/",$userName)) {
- $errors[] = "Username: Only letters, numbers and white space allowed. 6-18 characters";
- }
- //echo "Controle email"."<br>";
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
- $errors[] = "Invalid email format";
- }
- //echo "Controle passwords"."<br>";
- if ($password == $cpassword) {
- if(!preg_match('/^(?=.*\d)(?=.*[@#\-_$%^&+=§!\?])(?=.*[a-z])(?=.*[A-Z])[0-9A-Za-z@#\-_$%^&+=§!\?]{8,20}$/',$password)) {
- $errors[] = "Invalid password.<br>Must contain: at least one lowercase char, at least one uppercase char, at least one digit, at least one special sign of @#-_$%^&+=§!?";
- }
- }
- else {
- $errors[] = "Passwords do not match";
- }
- //echo "Controle armory link"."<br>";
- if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$mainCharacter)) {
- $errors[] = "Invalid Character Armory link";
- }
- // Tellen van aantal fouten
- $aantalErrors = 0;
- $aantalErrors = $aantalErrors + count($errors);
- if($aantalErrors > 0){
- echo "<div id='foutBox'><p class='foutLijst'>";
- for ($i = 0; $i < count($errors);$i++){
- $errorTeller = $i + 1;
- echo $errors[$i]."<br /><br />";
- }
- echo "</div></p>";
- }
- return $aantalErrors;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement