Need help on adding banners to customer site

flavesta

Member
Sep 19, 2003
5
0
151
Hello,
I am trying to set up a site that gives out free sites (like Netfirms.com or tripod does) but on a smaller level (all content related free sites aloud) But I want to put my banner on top of their site automatically without having them have to copy / paste the html into their pages.

Is it possible to do this using an Apache Handler? Mime types?

I really do not know where to start. Any help will be greatly appreciated.

Thanks,
Patrick Flaven
 
Last edited by a moderator:

PWSowner

Well-Known Member
Nov 10, 2001
2,940
4
343
ON, Canada
Here is what I found somewhere when I was looking for the same thing. Don't remember where though.

ok, the easiest thing to do is put a .htaccess file in either your root directory or in each folder with this...


PHP:

php_value auto_append_file /home/username/public_html/ad.php

AddType application/x-httpd-php htm

AddType application/x-httpd-php html


then create your ad.php file.
This will make all files with .htm and .html act as if they are .php files.
At the bottom of each page it will include your ad.php file

Just remember that it will add it to your root files (your own files) if you put it under your public_html folder rather than their folders, BUT if it is in their folders and they know how to find it, they could delete it.

change append to prepend to put your file at the top. You can do both which will put your file at the top AND the bottom.
 

flavesta

Member
Sep 19, 2003
5
0
151
Thanks for the help! I probably never would have found that out searching by myself... (I'm basically a newbie) I've never use a .htaccess file before so I'm not too familiar but im sure I can find some more info somewhere

Thanks again
Pat
 
Last edited by a moderator:

flavesta

Member
Sep 19, 2003
5
0
151
When making the .htaccess file I put this code in the file

PHP:

php_value auto_append_file /home/myusername/public_html/ad.php

AddType application/x-httpd-php htm

AddType application/x-httpd-php html

Then I made the ad.php file through dreamweaver using html code for a banner and it doesn't work, it gets an internal server error. Am I putting the code in correctly, is there something missing here... I have tried many variations and it still will not work?
 

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,758
313
363
Chesapeake, VA
cPanel Access Level
DataCenter Provider
I just ran a test on this and it worked great. Great tip.

As to why you are getting an internal server error, I am not sure. I used exactly what you put in your message in my .htaccess file.

Do you have open_basedire in effect? If so, you are definately going to have problems doing it this way, but it should not return an internal server error, it should give you php warnings/errors.
 

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,758
313
363
Chesapeake, VA
cPanel Access Level
DataCenter Provider
Oh, wait, did you put PHP: in your .htaccess file? If you did, that is what is causing it to choke. this should be the content of your .htaccess file:

php_value auto_append_file /home/username/public_html/ad.php

AddType application/x-httpd-php htm

AddType application/x-httpd-php html
 

flavesta

Member
Sep 19, 2003
5
0
151
That was what it was... I removed the PHP from the top and it works great! Finally it all works!! I've tried other forums but I couldn't find any help there, just want to say thanks for the help squirrel and GotHosting!
 

icanectc

Well-Known Member
Mar 10, 2003
344
0
166
If we are using phpsuexec how would we go about getting this to work? With PHPSUEXEC it just produces an internal server error.
 

PWSowner

Well-Known Member
Nov 10, 2001
2,940
4
343
ON, Canada
Is it possible to add code to the .htaccess file so that the .htaccess file can be in the root (public_html) directory but only add to files in subdirectories? Or is there a line of code that can tell it not to touch specific files?
 

mike_r

Well-Known Member
Nov 26, 2002
45
0
156
Well, This doesnt works for CGI and SHTML, how to make it work for them.. any idea ???
 

R[email protected]

Well-Known Member
Mar 5, 2002
487
0
316
Los Angeles California
It will not work if some smart a** used a php exit() at the end of the file. But I doubt anyone will figure it out....

Good job squirrel.
You never fail to amaze me with how much you know about servers.
 

[email protected]

Well-Known Member
Mar 5, 2002
487
0
316
Los Angeles California
One note.

The page will display an error msg if the ad.php is not present. Is it possible to suppress the errors?
 

[email protected]

Well-Known Member
Mar 5, 2002
487
0
316
Los Angeles California
oh yeah to disable deletion of the htaccess file simply do a chattr _i .htaccess

This way it cannot be deleted by anyone including you.
To delete it, do a
chattr -i .htaccess
then delete it normally.

Now anyone knows how to suppress errors for htaccess files?
 

luckyphil

Registered
Apr 27, 2004
1
0
151
Hi,

Just wondered if anyone is using this with cerberus helpdesk installed on the same domain without any problems? It causes an email error with piped emails to the helpdesk. If they are, would they be kind enough to share the fix?

Thanks

Phil
 

advisor

Member
Feb 23, 2003
24
0
151
Use an apache module called mod_layout

mod_layout is an Apache module that provides both a Footer and Header directive to automagically include output from other URIs at the beginning and ending of a Web page. It can be used to wrap documents for a standard look and feel for a site (or to insert banners on any given document in a site). Currently known to support mod_perl, PHP and Apache JServ. Should support just about any type of handler.
tangent.org/index.pl?lastnode_id=478&node_id=362

Good luck!
 
Last edited by a moderator: