jeudi 24 décembre 2020

how can i restrict a person from entering a particular username in username field?

i want to block a certain word from being entered in my username field

    if($stmt = mysqli_prepare($link, $sql)){
        // Bind variables to the prepared statement as parameters
        mysqli_stmt_bind_param($stmt, "s", $param_username);
        
        
        $param_username = trim($_POST["username"]);
        
     
        if(mysqli_stmt_execute($stmt)){
            /* store result */
            mysqli_stmt_store_result($stmt);
            
            **if(mysqli_stmt_num_rows($stmt) == 1) {
                *$username_err = "This username is already taken.";*
            } else{
                $username = trim($_POST["username"]);
            }**

i want to add another condition where i want to block a specific username and show an echo for it

        } else{
            echo "Oops! Something went wrong. Please try again later.";
        }

        
       

Aucun commentaire:

Enregistrer un commentaire