[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Solution for Inserting file on the FLY



How could we add this footer to ALL html/shtml pages and not just directory
indexes?

> From: Webmaster <webmaster@xxxxxxxxx>
> Reply-To: cobalt-users@xxxxxxxxxxxxxxx
> Date: Sat, 11 Dec 1999 06:17:08 +0000
> To: cobalt-users@xxxxxxxxxxxxxxx
> Subject: [cobalt-users] Solution for Inserting file on the FLY
> 
> At 07:04 11/12/99 +0900, you wrote:
>>> One of my customer want to add a Disclaimer info to
>>> his members page automatically as a Server level.
>>> 
>>> i.e. Without modifying every single page of his customers.
>>> But end of their pages, this particular info should be added.
>>> Specially to the first page of each customer -
>>> say www.customer.com/~hiscustomerA/index.html
>>> (It is a charity web site.)
> 
> 
> Thanks for Kris Dahl and Douglas MacDougall, who responded my mail.
> Now I have found my own solution for it.
> Check out http://test.luxmi.net/test1/ for on line demo.
> The solution follows end of this mail, may be useful to someone.
> 
> Best regards,
> Babu P. Yogarajah
> 
> Webmaster <mailto:webmaster@xxxxxxxxx>
> Luxmi Internet Services,
> BGP Tecno Limited, 1 Waddon Court Road, Croydon CRO 4AN, U.K.
> Tel.:+44 (0)8707 390 390  Fax.:+44 (0)8707 391 391
> 
> =================
> Step 1
> Create an .htaccess with at least the following contents and place it
> under the web's root directory (i.e. www.your_customer.com/.htaccess
> (you may omit Includes if you don't want SSI calls)
> 
> File: .htaccess
> 
> Options ExecCgi Indexes Includes
> DirectoryIndex /cgibin/index.cgi
> 
> Step 2
> Modify the following index.cgi and disclaimer.html (or footer.html)
> according to your needs and place it under /cgibin/
> (i.e www.your_customer.com/cgibin/index.cgi and
> www.your_customer.com/cgibin/disclaimer.html
> 
> File: disclaimer.html (sample file)
> 
> <HR><CENTER><TT>Disclaimer info, this is coming from
> /cgibin/disclaimer.html</TT></CENTER>
> 
> 
> File : index.cgi 
> 
> #!/usr/bin/perl
> #
> # index.cgi file for Inserting file on the FLY
> # By Babu P. Yogarajah <Babu.P@xxxxxxxxxxxxx>
> # v 0.1 <041299>
> #
> $request_uri = "$ENV{REQUEST_URI}";
> $disclaimer = "disclaimer.html";
> $index_file = "";
> $localpath = "/PATH/TO/ROOT/OF/THE/WEB"; #<- change this according to your
> need#
> #             # e.g. /home/sites/site27/web
> #
> #
> print "Content-type: text/html\n\n";
> 
> if ($request_uri)
> {
> if    (-e $localpath . $request_uri . "index.html" ) { $index_file =
> $localpath . $request_uri . "index.html";}
> elsif (-e $localpath . $request_uri . "index.shtml" ) { $index_file =
> $localpath . $request_uri . "index.shtml";}
> }
> else
> {
> if    (-e "$localpath/index.html" ) { $index_file = "$localpath/index.html";}
> elsif (-e "$localpath/index.shtml" ) { $index_file =
> "$localpath/index.shtml";}
> }
> 
> 
> if ($index_file)
> {
> open(INDEX, "< $index_file");
> while(<INDEX>)
> {
> print $_;
> }
> close(INDEX);
> 
> open(DISC, "< $disclaimer");
> while(<DISC>)
> {
> print $_;
> }
> close(DISC);
> 
> exit;
> }
> else 
> {
> print "<H1>Directory Index Forbidden<\/H1>\n";
> exit;
> }
> 
> 
> Step 3
> Test with any of your index.html or index.shtml files.
> Also with empty directory then you should get
> a error message like - Directory Index Forbidden -
> 
> 
> FINAL NOTE: Feel free to use the above scripts and
> don't blame me for any error in out come.
> But any help needed write to me.
> Also any one who developed further please let me know.
> 
> 
> _______________________________________________
> cobalt-users mailing list
> cobalt-users@xxxxxxxxxxxxxxx
> http://list.cobalt.com/mailman/listinfo/cobalt-users
>