mercredi 25 mars 2020

the last else if statment wont wont work it's like there's is nothing there

the last else if statment wont wont work it's like there's is nothing there and i can't figure out why

<?php

if (isset($_POST["submit"])) {

      require 'db.inc.php';

      $username = $_POST["username"];
      $email = $_POST["email"];
      $password = $_POST["password"];
      $confirme = $_POST["confirme"];

      if(empty($username) || empty($email) || empty($password) || empty($confirme)) {

        header( 'Location: ../signup.php?error=empty&usern=' . $username .  '&mail='  . $email );
        exit();
      }
      else if(!filter_var($email, FILTER_VALIDATE_EMAIL) && !perg_match('/^[a-zA-Z0-9]*$/', $username)) {

        header( 'Location: ../signup.php?error=invalidmailusern');
        exit();
      }
      else if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {

        header( 'Location: ../signup.php?error=invalidmail&usern=' . $username );
        exit();
      }
      else if(!perg_match('/^[a-zA-Z0-9]*$/', $username)) {

        header( 'Location: ../signup.php?error=invalidusern&mail=' . $email );
        exit();
      }
     else if (true) {
       // code...
       header( 'Location: ../signup.php?error=empty&usern=' . $username .  '&mail='  . $email );
       exit();
     }

}

Aucun commentaire:

Enregistrer un commentaire