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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pooh14
Forum Newbie
Posts: 23
Joined: Tue Apr 04, 2006 12:20 am

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

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
pooh14
Forum Newbie
Posts: 23
Joined: Tue Apr 04, 2006 12:20 am

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the prepended script can do anything a normal script can do.
pooh14
Forum Newbie
Posts: 23
Joined: Tue Apr 04, 2006 12:20 am

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

look at your $_SERVER variables.
Post Reply