shero Posted September 2, 2015 Share Posted September 2, 2015 I want to know how to remove special characters from url like: product.php?id=--35 i want to remove all the special characters from url like ( ', " , - , /, etc) all special characters. THanks Quote Link to comment https://forums.phpfreaks.com/topic/298025-filter-in-php/ Share on other sites More sharing options...
scootstah Posted September 2, 2015 Share Posted September 2, 2015 str_replace preg_replace Quote Link to comment https://forums.phpfreaks.com/topic/298025-filter-in-php/#findComment-1520138 Share on other sites More sharing options...
requinix Posted September 2, 2015 Share Posted September 2, 2015 So you're concerned that someone can mess with your URLs and put all sorts of bad stuff into the "id" value? Honestly, I think it's better to treat invalid values (like "--35") as invalid values, not try to somehow force them to be valid. Take the same action you would as if someone entered "id=foo" or "id=" or removed the id entirely. 1 Quote Link to comment https://forums.phpfreaks.com/topic/298025-filter-in-php/#findComment-1520139 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.