Hello, I have a form that is being used in another site and saving in my database, through a php action that is on my server. But I would just like to save the data if the form comes from the domain of this site. How can I do it?
Hello, I have a form that is being used in another site and saving in my database, through a php action that is on my server. But I would just like to save the data if the form comes from the domain of this site. How can I do it?
You can check the sender domain like this:
$_SERVER["HTTP_REFERER"]; // http://www.exemplo....
But I have to warn that this is an editable parameter in the request, it can be 'forged':
if($_SERVER["HTTP_REFERER"] != 'url autorizado') {
echo 'URL inválido';
die();
}