1

I want to check using php if the current page is called by an iframe and not directly in the browser.

It's a page that gets some $_POST parameters while the sending form's target is an iframe, so the page will display in an iframe.

I want to check that using PHP, How?

Thanks.

medk
  • 9,233
  • 18
  • 57
  • 79

2 Answers2

3

You can't. PHP runs serverside. It is for all intents and purposes the same thing as the webserver -- it sees HTTP requests and returns responses. An iframe is a clientside mechanism implemented by the browser that simply allows you to display 2 or more html pages (the response payload).

gview
  • 14,876
  • 3
  • 46
  • 51
2

You can use the SERVER HTTP_REFERER

$_SERVER['HTTP_REFERER'];
Book Of Zeus
  • 49,509
  • 18
  • 174
  • 171
  • 1
    recommendation: if you submit the iframe window you should save the referrer in the form as a hidden field. This will pass the original referrer (the one who called the iframe at first). – Book Of Zeus Aug 26 '11 at 03:37