Is it possible to check that the $_GET
or $_POST
values are submitted from specific page?
For example, there is an ajax
in page1
submitted value to page2.php?q=abc
, and the page2
only accept the q
when it is submitted from page1
.
If I directly browse to the page page2.php?q=abc
, the php
will not run unless I submitted the value from page1
.
Is it possible to do that?
Edit 1:
Because I can access the page2
and get the result. Don't mention about the session
, because I can validate the session
to match my needs and the values submitted to php is valid or not.
What I want is to check if the request is sent from specific page or not. If true, then accept the values and process it, else, redirect to homepage or something else.
Edit 2:
My question is, not only values submitted through Ajax, but also direct access, such as href="page2.php?q=abc"
. I guess token will be the best way to do that, and the query part will validate again.