Hello.
I am looking for a way to perform POST Form Authentication. ie I want to make sure that the data being posted is from my form ONLY and not from anywhere else.
<form id="form2" name="form2" method="post" action="">
<p>
<label>System Value
<input type="text" name="Sysval" id="Sysval" />
</label>
</p>
<p>
<label>
<input type="submit" name="Buton_Submit" id="Buton_Submit" value="Submit" />
</label>
</p>
</form>
The above is a simple form that will send the POST data to it's own page.
I first thought of using a simple hidden form element.
<input name="hiddenField" type="hidden" id="hiddenField" value="ItIsSecure" />
and on receiving the POST data PHP would check first that that if there was POST data then then check for the value of the hidden fiels. If the value is correct then it is authenticated.
However I feel this to be too lax as anybody could just look at the HTML page source to see the contents of the hidden field then use it to forge the form.
I thought that maybe using the server variable to check the referring page and if it is the correct page then form is authenticated however I am sure that someone could also forge this.
So, is there a good way to authenticate the POST data is from the correct form and not being forged in some way.
Any help would be good.