I am extremely new to this, so any help is appreciated.
1.) I want to polish off the player's username as much as I can. Basically try my best to remove everything besides numbers and letters. I heard of the other ways, but I want to use the sanitize options instead. My question is: By using the below code, is one line that's removing characters I want it to. Actually be removing them only to be replaced by one of the other lines?
I have tried over and over to notice anything strange and have not found it doing anything wrong. I would like some opinions on this question, because even know I think it's working. It may have some flaws.
$_POST['newname'] = strip_tags(mysql_real_escape_string($_POST['newname']));
$_POST['newname'] = filter_input(INPUT_POST, 'newname', FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_LOW);
$_POST['newname'] = filter_input(INPUT_POST, 'newname', FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_HIGH);
$_POST['newname'] = filter_input(INPUT_POST, 'newname', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
$_POST['newname'] = filter_input(INPUT_POST, 'newname', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
$_POST['newname'] = str_ireplace(array("<", ">", "&", "&", "!", "@", "#", "$", "%", "^", "*", "(", ")", "-", "+", "=", "[", "]", ":", ";", ".", "?", "{", "}", "|", "~", "<", ">", "/", "©", "™", "staff", "administrator", "programmer", "moderator", "owner", "'", "`", "39"), '', $_POST['newname']);2.) I would really like to be able to use these sanitize strings in the globals file to control all $_POST and $_GET vars, but only have to use it once instead of over and over for each field name in the forms.
Example:$_POST['text'] = filter_input(INPUT_POST, 'text', FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
The above only works for the above $_POST var and fieldname.
I would like it to work for all $_POST vars and fieldname's.
Something of the below to give you an idea of what I mean. It does not work, but you get the idea.
$_POST = filter_input(INPUT_POST, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW);
Thanks for your help, if any.
