protect post from other domain

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
srdva59
Forum Commoner
Posts: 77
Joined: Sun Feb 15, 2009 10:58 am

protect post from other domain

Post by srdva59 »

hi,
i have a php file that perform a query with the data that he receive
form post information.
what i need to do is detect from where the data is coming is is same domain
or not and block when is not from the same domain.
thanks a lot for your help :)
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: protect post from other domain

Post by AbraCadaver »

You could check $_SERVER['HTTP_REFERRER'], but it would probably be better to implement a one-time token. Check here: http://shiflett.org/articles/cross-site ... -forgeries
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply