# \[PHP\] POST Referer checker

**URL:** <https://forum.kirupa.com/t/php-post-referer-checker/178972>\
**Category:** Uncategorized\
**Created:** [February 15, 2006, 8:05pm UTC](https://forum.kirupa.com/t/php-post-referer-checker/178972 "2006-02-15T20:05:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chunk](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@chunk](https://forum.kirupa.com/u/chunk)\
**Post date:** [February 15, 2006, 8:05pm UTC](https://forum.kirupa.com/t/php-post-referer-checker/178972/1 "2006-02-15T20:05:48Z")

</div>

Hi, I have a PHP script hat excutes data given in from a form… but I also need to make sure it only processes the data from the domain the file is located in, so someone else cannot upload a form and stick action pointing at my file… this is what I have come up with:

```php

if ($_SERVER['REQUEST_METHOD']=="POST"; && (!strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'];)) die("Bad request.");

```

It all seems correct to me, it should work…

Can anyone shed any light ?
