I was trying to find a slick way to do validation of the URL's Query String
I only use a few special chars for my query strings and I was thinking
about automating the whole sanatization of my url base query strings with
something like this.
I only use '_', '&', '=' and of course Alpha Numberic.
I thought I could come up with some ereg tester to validate that it's
within my format.
I found
ereg( "^([-a-zA-Z0-9_\.\!@#\$&\*\+\=\|])*$" , $var )
What I WANT, I think...LOL
ereg( "^([-a-zA-Z0-9_@&=])*$" , $_SERVER['QUERY_STRING'] )
Here is an example of what I think I want to do
IF ( !ereg('[^A-Za-z0-9]', $_SERVER['QUERY_STRING'] )
$IsGoodQuery = TRUE
ELSE $IsGoodQuery = FALSE;
Then I add that to the top of any all my pages that require query strings and if $IsGoodQuery is not true then maybe uses list $_SERVER['QUERY_STRING'] to break it up and try to find out why but otherwise just continue with SQL stuff.
Also would this have any adverse effect if I did some mod - rewrite?
Any Thoughts advice ?
I don't know ereg that well and I've seen some stuff I couldn't begin to understand, it's all the different bracks and stuff that is a little :queasy:
Like what is the difference between
[A-Za-z0-9]
And
[-a-zA-Z0-9_@&=])*$
I added the _@&= but I don't know what the *$ does for it