$_POST [ 'username' ], 'password' => $_POST [ 'password' ], ]; if ( false ) { //TODO: ask the database if the user exists and check if the password is correct then } else { header ( "Location /" ); //TODO: modify with json response with "Wrong username or password" message exit; }