Currently, these are the preparations I'm making:
- Convert to lowercase.
- Strip HTML tags.
- Check if tag already exists
Are there any other things that I consider?
note: Tags may be in Arabic.
here the method i use
function sanitize_tag($tag){
//strip slashes
if(get_magic_quotes_gpc()) {
$tag = stripslashes(trim($tag));
}
//Remove white spaces
$tag = preg_replace('/\s\s+/',' ',$tag);
$tag = trim($tag);
$tag = ltrim($tag);
$tag=filter_var($tag, FILTER_SANITIZE_STRING);
return $tag;
}