-1

I have a simple HTML website www.some_website.com. On the index.html page, I am embedding an external php script called embedded_site.php from an external source.

I am using the <embed> tag to embed the php script into the website like so.

<body>
  <div style="width:100%; text-align:center;">  
      <embed type="text/html" src="https://myotherwebsite.com/embedded_site.php">
  </div>
</body>

How can the embedded_site.php detect which site is embedding it?

+---------------------------------+
|      www.some_website.com       |
|   +-------------------------+   |
|   | embedded_site.php       |   |
|   | detected: embedded by   |   |
|   | some_website.com!       |   |
|   +-------------------------+   |
|                                 |
+---------------------------------+ 

I have tried in embedded_site.php:

<?php echo($_SERVER['REMOTE_ADDR']);?> 

but that gives me the IP of the client, not the embedding site www.some_website.com.

Intended Purpose

If the embedded_site.php script is embedded on the wrong site, it needs to be able to detect that and disable itself.

Oscar Chambers
  • 899
  • 9
  • 25

1 Answers1

1

what about this:

$_SERVER['REQUEST_URI'] 

instead of

$_SERVER['REMOTE_ADDR']
Dato DT
  • 129
  • 1
  • 1
  • 9