Answered: How to validate username?

Post date: 2020-09-16 04:55:28
Views: 112

Manipulate this filter_handle function found in /qa-include/plugins/qa-filter-basic.php

    public function filter_handle(&$handle, $olduser)
    {
        if (!strlen($handle)) {
            return qa_lang('users/handle_empty');
        }
        if (in_array($handle, array('.', '..'))) {
            return qa_lang_sub('users/handle_has_bad', '. ..');
        }
        if (preg_match('/@+/#,`"*!|()$;^=<>]/', $handle)) {
            return qa_lang_sub('users/handle_has_bad', '@ + /');
        }
        if (qa_strlen($handle) > QA_DB_MAX_HANDLE_LENGTH) {
            return qa_lang_sub('main/max_length_x', QA_DB_MAX_HANDLE_LENGTH);
        }
        // check for banned usernames (e.g. "anonymous")
        $wordspreg = qa_block_words_to_preg(qa_opt('block_bad_usernames'));
        $blocked = qa_block_words_match_all($handle, $wordspreg);
        if (!empty($blocked)) {
            return qa_lang('users/handle_blocked');
        }
    }
 

Please click Here to read the full story.
 
Other Top and Latest Questions:
3 Body Problem: Countdown
Trying to recall British TV drama from 2000s about teen model
Graphic novels for 13 year old girl
requiem
Movable stationary bicycle
Answered: Are AI generated answers on q2a site bad for seo?
Hazbin Hotel: Hello Rosie
Top Chef: Chef's Test
A follow up to my automated transcription question
Bakers of Askme!