including a file on on-rev

Alex Tweedly alex at tweedly.net
Tue Nov 3 18:00:27 EST 2009


J. Landman Gay wrote:
> Claudi Cornaz wrote:
>
>> I need to change the include statement to:
>> include "../lib/cc_PageStats.irev"
>> but this doesn't work.
>
> I have many pages at my on-rev site like that and it works fine. The 
> "../" does mean "up one folder" and I often use it.
>
This works for me too.   But it does have the HUGE disadvantage that the 
source file must know where it is in the folder tree so it can have the 
correct number of "../"s). It would be better to have a form that would 
work from anywhere in the tree ... which leads us on to ...
>> Even better would be, preferably a one liner, so I can include the 
>> file from whatever dir the requested page is,
>> without worring about the number of levels
>> (I have been trying with a 'hard coded adress like 
>> "http://claudi.on-rev.com/lib/cc_Pagestats"
>
> This works too. 
Indeed this works, and makes the include statement be independent of the 
source file location.
BUT -
(a)  isn't it a lot of extra work ?
Instead of opening a local file, the interpreter must open an http 
connection to the server and read the file over that.

(b) isn't it a (minor) security issue ?

I think I'd normally protect my include folder with a .htaccess file, so 
that random users can't access my include files, they can only access 
the web pages I want them to access. But that would (I think, haven't 
tested it) prevent this form of include being used.

-- Alex.




More information about the use-livecode mailing list