URL GETs and Others

reginaalcaraz62

New Member
Messages
15
Reaction score
1
Points
0
Hey Good day,

First time posting here.

I got some problem about these GETs in PHP.

For example, I got this sample URL with a GET below:

Code:
http://somesite.com?action=dothis
So here's the issue; what if some user messed up the URL like this:

Code:
http://somesite.com?asdfasdfasdf=dothis
And that messed up URL with the GET doesn't exist in the code.

How can I redirect or do something like an error message?

Thanks! Hoping for a reply. :smile:
 

learning_brain

New Member
Messages
206
Reaction score
1
Points
0
I can't quite figure why you would have a "messed up" parameter definition, unless they are coming in from another site.

That said, the verification would be fairly simple. You don't have to check the definition, provided you check that the particular variable is picking up correctly.

This is your get stuff on the receiving page..

PHP:
if (isset($_GET['action']) && $_GET['action'] <> ""){//check that the action variable has a value and that the value does not equal nothing

//do whatever you want with this variable...

} else {// if the action variable is null

echo "Incorrect action definition";

}
 

reginaalcaraz62

New Member
Messages
15
Reaction score
1
Points
0
Oh God, I'm quite the slow kid there. Hehe. I didn't even know why I posted this topic on this part of the forums.

Thanks for letting me know that code. Gladly appreciated.

Thanks and God bless.
 
Top