General Community > Scripting Help

PHP on a HTML page to call a script hosted outside of site root

<< < (2/3) > >>

Aaron10:
Block direct access to the page that includes the script.

Arantor:
I'm not sure I understand what you mean. Forget all the other stuff about putting it inside or outside the root, that's mostly confusing the issue.

You have a page that has some content on it. You're trying to protect that page's contents?

Aaron10:
Basically, yes, even though its probably impossible to protect it 100%, I want to make it as difficult as possible for people to access it, however I want to be able to call it on a page through a script (object or something).

Arantor:
If you want people to be able to access it, it can't be protected, by definition.

If it is visible to users it can be copied, which is what I'm assuming you're trying to do. It's not even that hard to play follow the links to find content.

Aaron10:
I've googled and it seems to be possible using php include or require function to bring it from outside the site root (which isn't accessible through a HTTP request). The only way I've managed to do this so far is to have a separate php file that does this, and link to it from my html file

index.html:

<object data="/fetch.php" width="500" height="300"></object>

fetch.php:

<?php
include('/home/user/folder/script.html');
?>

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version