Page 2 of 2

Posted: Sun Apr 09, 2006 11:50 am
by timvw
pooh14 wrote:hi,

my aim of the project is to verify the integrity of a webpage and if any aunthorized changes has been made to it, it would restore to the original content. besides all pages are encrypted and stored. thus for each request it needs to be decrypted.
Where are they stored? How are they retrieved? Imho it seems less obtrusive if you plugin that verification stuff at retrieval time... (Thinking about hashes of the encrypted or unencrypted content here).

Posted: Sun Apr 09, 2006 12:04 pm
by rubberjohn
so basically you want to set a high level condition on the server that directs all page requests through the authmodule without making any changes to the existing html??

i may be corrected but i dont think this can be done

did you try out feyd's suggestion??

Posted: Sun Apr 09, 2006 7:53 pm
by pooh14
hi guys,

but prepending the file and using $_SERVER in my script, i manage to solve the problem partially.

however, if i m going to call a particular page using include('pooh.php') instead of the normal hyperlink method, the $_SERVER does not hold the requested page, instead the page which contains the include statement.

how do i solve the problem?

thanks alot

Posted: Sun Apr 09, 2006 9:03 pm
by feyd
__FILE__

Posted: Tue Apr 11, 2006 10:23 am
by pooh14
Hi Feyd,

Thanks.

echo basename(__FILE__,".php") just prints the filename of the current file, not the module i called for.

assuming i have 3 scripts, page1, page2, page3


so in page1, i have include(page3)

assuming i have auto_prepand page2

in page2, i print out basename(__FILE__), i get page2.

what i would like it to find out is the requested page by page1, which is page3.

Posted: Tue Apr 11, 2006 11:56 am
by timvw
pooh14 wrote: so in page1, i have include(page3)
assuming i have auto_prepand page2
In this case the code in page2 is executed before the code in page1... Thus at that moment you don't have a crystal ball and can't know what's going to happen in page1 ;)

Well, the easiest work-around to me seems that you define a function on page1 that returns the page you'll include...

Code: Select all

function getPage() {
 // do whatever
 return 'page3';
}
This way you know what's going to be included in page1.

Posted: Tue Apr 11, 2006 12:04 pm
by pooh14
Hi,

Thank timvw. but i think you dont really understand my problem.

as i said earlier, my AuthenticationModue(auto-prepended file) is an extra module i did to check integrity of the pages...

this is my univeristy project.

however my main aim is when i merge this AuthenticationModule with existing web pages, I would not much changes done to the existing website (good design purpose). thus i would just like one main configuration change.

so all i need to know is the requested filename in my authenticationmodule, at the momend i dun have problem with normal href links....however i have problem when the file is requested using include statements.

thank you

Posted: Tue Apr 11, 2006 12:49 pm
by Benjamin
The easiest way to do this would be to configure Apache (httpd.conf) to include a header on every page request, which could be the .php file. As long as that file isn't sending out any data all the pages will still look the same and the php script will be executed.

Posted: Tue Apr 11, 2006 12:53 pm
by pooh14
Hi agtlewis,

Thanks for reply.

I am sorry, but I really have no idea what you were trying to explain :oops:

Hope you can explain in more detail and sorry for troubling you

Posted: Tue Apr 11, 2006 12:55 pm
by Benjamin
Nevermind, what I am talking about only works for directory listings.
HeaderName names the file which, if it exists in the directory, is prepended to the start of server generated directory listings. Like ReadmeName, the server tries to include it as an HTML document if possible or in plain text if not

Posted: Tue Apr 11, 2006 1:39 pm
by pooh14
guys,

I just realize, include is not really a request, thus auto_prepend wont really work for include statement

include is more like pasting the code in the same file right?????

Posted: Tue Apr 11, 2006 2:05 pm
by timvw
I find that you're doing very little research yourself for a university project. (http://www.php.net/include)