Hello,
I'm building a search page and I'm a bit unsure on what I should in regard to sanitizing and validating user input.
The search page has filters which are passed via querystrings. (some passed from inputs and others from links with checkbox/radio like behavior)
What should I look out for in this situation? Can I be safe using just preg_replace (strip all but) and escaping?
Also - do I need to do anything to the querystrings (with the user input) before putting them in links? Should I add another query to retrieve possible values, loop through the results and exclude those user inputs that aren't found? (preventing the links from appending a bogus filter option the user might have put in. Although wouldn't that just affect the user with the altered url?)
I don't know if it matters but some filters passed in the querystrings are arrays.
What do you think? I'm quite new to this and I appreciate the help. Thanks!