6

When I use $_SERVER['HTTP_ORIGIN'].

echo $_SERVER['HTTP_ORIGIN'] ;

Return Notice: Undefined index: HTTP_ORIGIN in D:\xampp\htdocs\safe\test.php on line 12

What is Wrong?!

Praveen Kumar Purushothaman
  • 160,666
  • 24
  • 190
  • 242

1 Answers1

8

The HTTP_ORIGIN is neither sent by all browsers nor it is secure to trust. You should really use:

echo $_SERVER['HTTP_REFERER'];

The issue happens to you because that particular browser hasn't set the origin. You don't trust HTTP_REFERER as well. It is as insecure as the former.

Praveen Kumar Purushothaman
  • 160,666
  • 24
  • 190
  • 242