Xenous
o shi
- Nov 15, 2011
- 383
- 101
As the title says i'm wondering what would be the best way to filter out characters using php, characters like : ~!@#$%^&*()_+{}[]:";'<>,.?/ ect.
I had an idea for a method but it seems to have failed none to less the idea I had is
Care to elaborate on what I may have done wrong or the correct method for doing so, any help is appreciated as usual
I had an idea for a method but it seems to have failed none to less the idea I had is
PHP:
$username = strip_tags(mysql_real_escape_string($_POST['username']));
$password = md5(strip_tags(mysql_real_escape_string($_POST['password'])));
$password2 = md5(strip_tags($_POST['password2']));
$email = strip_tags(mysql_real_escape_string($_POST['email']));
$ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
if (empty ($username)||empty($password)||empty($password2)||empty($email))
{
echo 'Please fill in all areas and try again';
}
else
{
$clean = '`,~,-,_,(,),*,&,^,%,$,#,@,!,;,:,.,/,?,<,>,{';
if ($username = $clean)