3
Hello, I have a form that is being used on 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?
3
Hello, I have a form that is being used on 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?
0
You can check the sender domain like this:
$_SERVER["HTTP_REFERER"]; // http://www.exemplo....
But I have to warn you that this is an editable parameter in the request, one can 'fake':
if($_SERVER["HTTP_REFERER"] != 'url autorizado') {
echo 'URL inválido';
die();
}
Browser other questions tagged php mysql
You are not signed in. Login or sign up in order to post.
Thanks for the answer. In the case of HTTP_REFERER it picks up the whole url, right? Is there a way to do a domain verification of the site? Because the form will appear on other pages too
– cpbox
Ah, I did it using parse_url to check the domain. Vlw again for the answer!
– cpbox
You’re welcome @cpbox .
– Miguel