Hello,
maybe it's a well known problem, maybe not. But here it is:
The following happens all in one .php code file: The idea is showing a page only after the user has clicked on the submit button on one page. I found out some time ago, that this can be very easily hacked by just giving the name of the submit button as a url parameter and assigning it any value. Then the code will parse the thing and see that the submit variable is declared and show the block of code that is supposed to be shown only when the submit button is pressed.
I hope it's a good description, here is also an example of it:
suppose I have a block in a source to show a page with a form and the button:
<code>
<input type='submit' name='mysubmit' value='send'>
</code>
Then somewhere else in the source I have a block like:
if ($mysubmit)
{
//do something here meant for people that pressed 'mysubmit' previously
}
Well, if I call the code like:
...myfile.php?mysubmit=x
then the code will show all the 'authorised' part at one, without caring if I clicked the button or not.
Is there any solution how to secure this piece of code?
Thanks in advance for your answer.