Page 1 of 1

Help!! Need to modify the way php calls a script!!

Posted: Tue Apr 04, 2006 6:17 am
by pooh14
Hi Guys,

I am new to this forum and php :p

Let me explain a little on what i am doing.

I did a class in php called AuthenticationModule, which would check the integrity of the page and replace if there are some unauthorized changes.
to do that all i need to do now is

Code: Select all

$authenticatePage   = new AuthenticationModule('scripts/Football.html',1);
each time i want to authenticate the page. this will automatically restore and call the original page

My question is
How can i see php to do that for all my page i am calling, meaning links, forms.... Meaning i want to change the way php calls the scripts by doing that first.

somebody once told me that i could modify the php.exe file to do that line.

Thank you in advanced?

Posted: Tue Apr 04, 2006 10:15 am
by feyd
no need to modify php itself. Using an .htaccess file (or changing your php.ini), you can set the auto_prepend_file setting which will run that file before the requested script is run. I believe the requested script isn't even loaded into memory at that point, but I'm not absolutely sure.

Posted: Tue Apr 04, 2006 11:27 am
by pooh14
Hi, thanks for the reply.

However, how do i pass the parameter to it? meaning the filename i want .....

From what I understand, (sorry I am wrong, I am a newbie :oops: )
the auto_append and .httaccess, can only include a normal file, meaning include('test.php');

but in my case, i would like to create create an object is possible, and pass a parameter to it.

Code: Select all

$authenticatePage   = new AuthenticationModule('scripts/Football.html') [\code]

Is that possible?

Really appreciate your help

Posted: Tue Apr 04, 2006 11:35 am
by feyd
the prepended script can do anything a normal script can do.

Posted: Tue Apr 04, 2006 11:43 am
by pooh14
hi, i am sorry to ask so many times.

ok, you said I do not need to change my existing script.

assuming i am prepand a script which needs to accept a parameter.

how do i send it the parameter then?

the thing is i need send the filename everytime to the authentication module. so if i prepand the authentication module script using auto_prepand, is it possible to send a filename to it, and if yes, how?

sorry if it is a silly question

Posted: Tue Apr 04, 2006 11:51 am
by feyd
look at your $_SERVER variables.