Jump to content

Rejecting characters


acctman

Recommended Posts

I would like to have the code re-written so that it rejects all characters that is not A-Z,a-z,0-9

 

//illegal characters in username?
        $illegal = array('#','?','&','"','/','%','!','$','\'','*','-','_','~');
        foreach ($illegal as $value)
            if (strpos($en['user'],$value) !== false)
                $ill = true;

        if ($ill)
            $err .= _reg_illegal.'<br>';

Link to comment
https://forums.phpfreaks.com/topic/89870-rejecting-characters/
Share on other sites

how would i apply this to my existing code?

 

//illegal characters in username?
        $illegal = array('#','?','&','"','/','%','!','$','\'','*','-','_','~');
        foreach ($illegal as $value)
            if (strpos($en['user'],$value) !== false)
                $ill = true;

        if ($ill)
            $err .= _reg_illegal.'<br>';

Link to comment
https://forums.phpfreaks.com/topic/89870-rejecting-characters/#findComment-460729
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.