-
Newbie Question
Hi Guys
I have a form that posts data to a php script in a seperate file (form.php) I need this form.php to be accesible only by the form that submits data to it and not accessible as a direct link.
I remeber from college there is some code to do what im asking but I just can't remeber.
Thanks in advance for any help guys.
-
Re: Newbie Question
You can put the file outside the document root and use the include statement to access it from the PHP script. If you want to POSt the data you will need to have public access to it.
-
Re: Newbie Question
You can get the page you came from via the headers right?
$_SERVER['HTTP_REFERER'];
But a browser may not always send the page it came from, and users can edit it as well and fake it.
I guess you could always try making some kind of hash as well and validate it in Form.php... depends how important it is.