PDA

View Full Version : Apache header/footer insert


flick69
07-07-2002, 11:52 PM
Howdy,
I'm thinking of setting up free hosting. Just trying to suss the automatic insertion of headers and footers. Anyone got the suss on this or can point me to some info on it?

thanks
Flick

cyber_ninja
07-07-2002, 11:57 PM
im looking for the same thing,also im looking for something that will let me put an exit consel on a site that i host for someone.if i find anything ill let you know.

flick69
07-08-2002, 12:02 AM
Thanks cyber - I'll do the same :)

flick69
07-08-2002, 12:29 AM
I assume the OnUnload() isn't any good for you?

wd-
07-08-2002, 12:30 AM
are you asking about SSI?

cyber_ninja
07-08-2002, 12:32 AM
Originally posted by flick69
I assume the OnUnload() isn't any good for you?

if i do that the webmaster could just delete it,or put his user id there and take half of my money

flick69
07-08-2002, 12:33 AM
no - there's a way of getting customised headers and footers delivered at the server level..Im just trying to suss the directives to do it.

thanks anyway
Flick

flick69
07-08-2002, 12:34 AM
we're talking the same language :)

flick69
07-08-2002, 12:39 AM
<body onunload=exitconsole(); bgcolor=black>

Thats what I meant cyber

keyman
07-08-2002, 12:44 AM
There is probably an apache module that will do it on the fly. Tiger Shark webserver, used by fsn.net, is especially designed for the purpose.

However, most freehosts would have a robot which recurses through all user directories (on a cron) looking for HTML files that hadn't had headers/footers inserted. When it finds a html file, it finds the <BODY> and </BODY> and inserts code accordingly.
Note that is faster to do it this way than have the server insert it on the fly.

Some users have found ways around this, so the larger freehosts, like smutserver, have inserted their code right into the top, before the <HTML> and <BODY> tag. This works out great for those of us writing tgp scripts that validate these galleries <G>.

Danielle
07-08-2002, 12:46 AM
One way to do it is to compile a module like mod_layout into Apache.

mod_layout does auto header and footer insertion into all pages.

But it does not work with Apache 2.0 yet.

More info here:

http://software.tangent.org/

Another way is to use either grep or a custom cgi running on a cronjob to insert the headers, footers, consoles etc into pages.

Or install a community hosting package on the server. Tons of them can be found here:

http://www.cgi-resources.com/Programs_and_Scripts/Perl/Homepage_Communities/

Hope that helps.

Hugs,
Danielle

keyman
07-08-2002, 12:59 AM
Hi Danielle :)

flick69
07-08-2002, 01:06 AM
hadn't even thought of cron <shakes head>
Much simpler and less intensive server wise

Thanks guys :)

BIGTYMER
07-08-2002, 02:00 AM
Mod_Layout rocks! It will get the job done and then some.

BigTymer
___________
Light Speed Cash (http://www.lightspeedcash.com/link.php?s=LSC&r=kingpinz): Tawnee Stone is converting like crazy! 60/40 Partnership!

flick69
07-08-2002, 02:20 AM
mod_layout sounds like the go maybe? Does it check every single page before delivering? A cron job sounds far less intensive..assuming that its run - say - every hour?

Germes
07-08-2002, 02:37 AM
Just wrote simple headers/footers insertor for apache.
Have to write how to use it now. :)
Hope tomorrrow I'll put it on my site:
http://www.germesia.com/
Script will be free and you may edit it.
Later, I'll put version which will show unique headers/footers, I mean visitor with cookies will not see the same header/footer until he will see them all

AgentCash
07-08-2002, 03:13 AM
Apache::Sandwich

Germes
07-08-2002, 11:01 PM
Free headers/footers rotater is here:
http://www.germesia.com/freescripts/hfr/index.html

rowan
07-09-2002, 12:24 AM
Apache lets you set a handler for particular MIME types. In the past I've had a cgi-bin run for every .html file served, it does various things like cookie and other HTTP header manipulation, then sends the content of the static file out. It's completely seamless to the user. Running a CGI for every HTML page was pretty inefficient but it was a low volume server, and it worked nicely. You could probably set up a simple PHP script to do similar. Hints:

AddType application/x-httpd-php .php5678
Action text/html MYHANDLER.php5678

Note that I've used an arbitrary extension, the visitors will NEVER see this script filename as it's run internally. For obvious reasons your PHP extension shouldn't be .php, unless you want your freehost clients to be able to execute PHP scripts. (Bear in mind using an arbitrary extension may be security through obscurity)

Disadvantages: the script will need to manually read in the content to figure out where to place the header and/or footer. If you just want to put in a popup or similar javascript code, you could probably send it out at the very top then readfile() the content, without having to parse it. This will be significantly faster.

Advantages: the script only runs for text/html content, all other content will be served statically as per usual.

Cheers.

bestmaturelist
09-10-2002, 11:46 PM
:) thanks