General Community > Scripting Help
PHP on a HTML page to call a script hosted outside of site root
Aaron10:
Basically I have a HTML page/script which I have hosted outside of my site root to stop people accessing it directly, however I can't seem to call it to my HTML page within the root.
I've gotten it to half work by making a php page with this:
--- Code: ---<?php
include('/home/user/folder/1.html');
?>
--- End code ---
And on the html page within the site, I simply have:
--- Code: ---<object data="/test.php" width="500" height="300"></object>
--- End code ---
This brings the script from the html page hosted outside of the root exactly how I want, however if I simply navigate to test.php in the browser, I can see the script from there, so I need to call it directly from the html page within the site, something like
--- Code: ---<?php
require('/home/user/folder/1.html');
?>
--- End code ---
Which doesn't work so I'm obviously missing something. After a lot of Googling I'm totally lost on this, is there some other php script I can use (either require or include etc.) to bring the script from outside the site root to a html page?
Ricky.:
If you are trying to hide some output by a PHP script then it is not possible because whatever browser need to show a page.. can't be hidden.
From what I understand, you have HTML thing which you want to hide from people, but still want to show, technically its impossible, however you can wrap it in some Javascript (like ajax call)etc, that way will be harder to find but still not impossible to find directly.
Aaron10:
Making it as difficult as possible is better than nothing so yeah.
Being outside of the site root makes it near impossible to access directly, though I can't seem to call it either.
Aaron10:
I put this in the file to include
--- Code: ---<?php
if (!defined('ACCESS')) {
exit;
}
?>
--- End code ---
however the script afterwards seems to be ignored, when I put this in the file to allow:
--- Code: ---<?php
define('ACCESS',true);
?>
--- End code ---
Anything I'm missing?
Arantor:
Well, your second code defines ACCESS which means the first code will do nothing... I'm not entirely sure what you're asking.
Instead of focusing on how you're trying to do it, what exactly are you trying to do?
Navigation
[0] Message Index
[#] Next page
Go to full version