php – how can I validate users and passwords before sending data? From already thank you very much

enter the description of the image here

enter the code here

×
        Add User
      
      
        

          
          

            

              
              
            
          

          
          

            

              
              
            
          

          
          

            

              
              
            
          

           
          

            

              
              
            
          

          

          

            

              
              
            
          

           

          

            

              
              
            
          

          
          

            

              
              
            
          

           
          

            

              
             

               Select profile

               Administrator

                Special

                Seller

                Provider

                Client
             
            
          

          

            UPLOAD PHOTO
            
             Maximum weight of the photo 200MB
          
        
      
       
        Go out

        Save user
       

       ctrCreateUser ();

      ?>


class ControllerUsers {
    /User Login/

static public function ctrIngresoUsuario () {

    if (isset ($ _ POST["ingUsuario"])) {
        if (preg_match ('/ ^[a-zA-Z0-9]+ $ / ', $ _POST["ingUsuario"]) && preg_match ('/ ^[a-zA-Z0-9]+ $ / ', $ _POST["ingPassword"])) {

            $ table = "users";
            $ item = "user";
            $ value = $ _ POST["ingUsuario"];
            $ answer = User Model :: MdlShowUsers ($ table, $ item, $ value);

            if ($ answer["usuario"] == $ _POST["ingUsuario"] && $ response["password"] == $ _POST["ingPassword"]) {

                $ _SESSION["iniciarSesion"]= "ok";

                threw out '';



            } else {

                threw out'
The User or the Password are not valid
';             }         }     } } /*User register*/  static public function ctrCreateUser () {     if (isset ($ _ POST["nuevoUsuario"])) {         if (preg_match ('/ ^[a-zA-Z0-9ñÑáéíóúÁÉÍÓÚ ]+ $ / ', $ _POST["nuevoNombre"])         && preg_match ('/ ^[a-zA-Z0-9]+ $ / ', $ _POST["nuevoUsuario"])         && preg_match ('/ ^[a-zA-Z0-9]+ $ / ', $ _POST["nuevoPassword"])         && preg_match ('/ ^[a-zA-Z0-9]+ $ / ', $ _POST["repetirPassword"])         && preg_match ('/ ^[a-zA-Z0-9ñÑáéíóúÁÉÍÓÚ ]+ $ / ', $ _POST["nuevaDireccion"])         && preg_match ('/ ^[0-9]+ $ / ', $ _POST["nuevoTelefono"])         && preg_match ('/ ^[a-zA-Z0-9ñÑáéíóúÁÉÍÓÚ ]+ $ / ', $ _POST["nuevaObservacion"]))         {         }         else         {             threw out '';         }     } }

}