Seattle PHP User Group Message Board › Invalid Parameters URL

Invalid Parameters URL

Leigh
smee
Seattle, WA
Post #: 4
Hi all -

How do you validate the url parameters that if a user changes your query of your url, the user will be redirect to your error webpage.

For example if your webpage is
www.example.com/people.php?doe_john

A user change the url to at the top of the address bar to
www.example.com/people.php?Obama_Barac­k

Want it to go to an error webpage
www.example.com/people.php

Could I get suggestions on how to go about this? I looked up functions like
curl
fsockopen
parse_url()

I tried it out but don't fully understand it. Am I on the right path or are there other suggestions?

Thanks.

Leigh
Mark S.
msteudel
Seattle, WA
Post #: 17
Hi Leigh,

You'll probably get more response on the mailing, but it depends on your code, an easy way would be to write a function that checks to see if the parameters i correct and add it to the top of your

<?php

// some magic function that checks paramters based on your requirements
$paramterIsValid = checkParameters( $_GET );

if( !$paramterIsValid ) {
header( "location: people.php" );
exit;
}

?>
<start of html document>
Powered by mvnForum

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy