Hi,

I need the following:

I have a php page that with an iframe. I want that the src of this iframe
receives the Referer directive not from my php page, but from one that is in
a form of a previous page. However every time I try it, it receives my php
page as the referer. How can I do this?

I tried header('Referer: blablabal.com'); but I think that IFRAME overlaps it.

This is not for hacking, spoofing ... but for a referer system that I am
building 🙂)

Marko

    I don't think there is any way to do that. You just don't have any real control over what the browser sends as a referer.

    The main page will have a referer from the previous page, but anything that the main page refers to (iframes, images, etc) will receive a referer URL of the main page. It is, after all, the main page that is referring to the iframe/image/whatever, not the page you came from before.

    You could have the main page be a .php that passes the original referer to the iframes via a parameter in the iframe's URL, but if the page in the iframe is checking HTTP_REFERER then that's not going to work. Also, it's not as trustworthy as a referer.

    Of course, this is assuming you receive a referer at all. Some browsers and/or proxy servers are configured to not send referers.

      By the way, using header("Referer: ...") won't work. HTTP_REFERER comes in the headers that the client (web browser) sends to the server; the PHP [man]header[/man] function is for sending headers from the server to the client.

        Write a Reply...