SitePoint Sponsor

User Tag List

Results 1 to 25 of 25
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    England (London Essex)
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Placing A Header On All Pages

    Hello Eveyone,
    im starting a new free webhosting company - www.vensions.com
    i would like to know how i can place a header on all html pages of the server (for advertising).

    if this requires any custom coding i am willing to pay

    Thanks, LW.

  2. #2
    SitePoint Wizard Dean C's Avatar
    Join Date
    Mar 2003
    Location
    England, UK
    Posts
    2,906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey LW, this probably isn't the best place to ask this question. Seems as PHP is on most webservers nowadays and it's an easy task accomplished in PHP, it would be best asked there. I've reported your post to be moved so I shall expect it'll be there soon Good luck!

  3. #3
    SitePoint Member
    Join Date
    Jan 2005
    Location
    England (London Essex)
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dont think php will solve my problems, im giving away free hosting accounts with cpanel etc... i want to be able to create a header for all hosted accounts on the server. im shore its apache that needs to be modified to do this
    Last edited by LittleWebmaster; Apr 6, 2005 at 13:02.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Little,

    I've just completed going through the httpd.conf file looking for anything that would suggest an autp_prepend feature - to no avail.

    Ergo, I think that DeanC's reply is your best advice -- or just go straight to php.net and look in the php.ini for auto_prepend. Unfortunately, I've never tested this to determine whether it would apply to .html/.htm files as well as .php scripts - but the PHP gurus over there should know.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  5. #5
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    In your php.ini file:

    php_value auto_prepend_file '/home/dir/user/ads.php'
    Mike
    It's not who I am underneath, but what I do that defines me.

  6. #6
    SitePoint Member
    Join Date
    Jan 2005
    Location
    England (London Essex)
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks mike,
    one more small problem... i did a "locate php.ini" in ssh and i got this response.

    /var/cpanel/version/php.ini-2
    /usr/lib/php.ini
    /usr/local/lib/php.ini
    /usr/local/lib/php.ini.new
    /usr/local/cpanel/3rdparty/etc/php.ini
    /usr/local/cpanel/3rdparty/lib/php.ini
    /usr/src/buildapache/php-4.3.7/pear/tests/php.ini
    /usr/src/buildapache/php-4.3.7/php.ini-recommended
    /usr/src/buildapache/php-4.3.7/php.ini-dist
    /home/cpins/installd/buildapache/php-4.3.8/pear/tests/php.ini
    /home/cpins/installd/buildapache/php-4.3.8/php.ini-recommended
    /home/cpins/installd/buildapache/php-4.3.8/php.ini-dist
    /home/cpapachebuild/buildapache/php-4.3.10/pear/tests/php.ini
    /home/cpapachebuild/buildapache/php-4.3.10/php.ini-recommended
    /home/cpapachebuild/buildapache/php-4.3.10/php.ini-dist

    which one do i edit?

    Thanks, LW.

  7. #7
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Little,

    Which one does Apache point to in httpd.conf? Given that list, I'd say it was /usr/lib/php.ini 'cause it wouldn't be the PEAR or CPanel ones nor the others with more than .ini as the extension.

    Mike,

    Will that auto-prepend to html files, too, i.e., not just .php scripts? TIA.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  8. #8
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you using apache2 ?
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  9. #9
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    pippo,

    Quote Originally Posted by pippo
    are you using apache2 ?
    I've got my hosting ISP using Apache 1.x while my test server is 2.x. What's the difference and can either prepend/append a file to served pages (and how does this get differentiated from images, css, js, etc - AddType?)? Won't this interfer with sessions and cookies?

    THANKS!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  10. #10
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    David,
    with Apache2 you can take the advantage of filters: http://httpd.apache.org/docs-2.0/filter.html

    In pratice the filter will let you to modify the HTTP request or, more importantly, the HTTP response.

    In pratice the filter is the *last* step to be executed before the response, i.e. the page content is sent back.

    So in pratice the admin has only have to create a perl script, for example, that will parse the content of the page and then he can choose to insert into that html code what he wants, such as banner.

    In that way the end-user can't, usually I think, avoid the ad/banner.

    I never did it but the aim of the filter is that.



    p.s.
    I have an idea in the bag about filters and mod_rewrite but that's another story.
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  11. #11
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    pippo,

    No wonder you're the GURU here! That's way over my head but, with your help, I've now got a starting place! Many thanks!

    I'll look forward to your, er, article (or thread?).

    BTW, I really like that signature -- how appropriate!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  12. #12
    SitePoint Member
    Join Date
    Jan 2005
    Location
    England (London Essex)
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mike


    In your php.ini file:

    php_value auto_prepend_file '/home/dir/user/ads.php'
    i modified the php.ini file but that didn't work.

    ; automatically add files before or after any PHP document
    auto_prepend_file =
    auto_append_file =
    php_value auto_append_file '/home/vensions/www/ads.php'
    this is how how edited it, is this right?

    Thanks, LW.

  13. #13
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Little,

    What you told PHP to do was add '/home/vensions/www/ads.php' at the END of every page.

    Also, I'd expect that php.ini requires the command to be on a single line but it's hard to tell that's what you've done with these text forums.

    QUESTION: Are you PREpending to php pages or all pages? I'm not sure that auto_prepend_file will work with an html file unless you've told Apache to parse that as if it was php, too.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  14. #14
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Little,

    I'm just coming to grips with pippo's question about Apache 2.0 or later as the Include Element looks to be EXACTLY what you're after.

    It's getting too late for me to make any sense of it now but go have a read!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  15. #15
    SitePoint Member
    Join Date
    Jan 2005
    Location
    England (London Essex)
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn
    Little,

    I'm just coming to grips with pippo's question about Apache 2.0 or later as the Include Element looks to be EXACTLY what you're after.

    It's getting too late for me to make any sense of it now but go have a read!

    Regards,

    DK
    I'll take a look, thanks
    Last edited by LittleWebmaster; Apr 7, 2005 at 09:34.

  16. #16
    SitePoint Member
    Join Date
    Jan 2005
    Location
    England (London Essex)
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i attempted this but failed, can i pay someone to do this for me?

  17. #17
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I had my syntax wrong, I was going off memory...

    Code:
    ; automatically add files before or after any PHP document
    auto_prepend_file = '/home/vensions/www/ads.php' 
    ;auto_append_file =
    And now that I think about it, this may only affect .php pages, unless you specify .html to be parsed as php.

    Maybe pippo's idea would be better suited...

    Sorry I can't help much more than that.
    Mike
    It's not who I am underneath, but what I do that defines me.

  18. #18
    SitePoint Member
    Join Date
    Jan 2005
    Location
    England (London Essex)
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im too confused on pippo's idea... how can i make .html parse as php?

  19. #19
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Little,

    Quote Originally Posted by LittleWebmaster
    im too confused on pippo's idea... how can i make .html parse as php?
    I'm dashing out the door -- but go look for AddHandler as that's how to do that.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  20. #20
    SitePoint Member
    Join Date
    Jan 2005
    Location
    England (London Essex)
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i didn't find a addhandler in php.ini but im shore there is one in httpd.conf
    thanks for you help

  21. #21
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Little,

    Actually, you should put it in httpd.conf if you can, otherwise, .htaccess (root level) should do it for you.

    Glad to be of help -- but pippo was OUR guide! Don't forget Mike and Dean C's contributions. Aren't these forums great!?!



    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  22. #22
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just pretend to know what I'm doing, pippo and dk are the ones who know stuff here
    Mike
    It's not who I am underneath, but what I do that defines me.

  23. #23
    SitePoint Member
    Join Date
    Jan 2005
    Location
    England (London Essex)
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mike
    I just pretend to know what I'm doing, pippo and dk are the ones who know stuff here
    Nah, im the one thats knows everything... i was just testing you guys LOL.
    just kidding!, do you know how i can auto_prepend a file for just one account?

    P.S. Yes these forums are great. thank you for everyones help !

    Thanks, LW.

  24. #24
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There used to be an Apache module called mod_banner to do just such a thing, can't seem to find it anywhere on Google though. Pippos idea about using filters is the best way to go if you're using Apache v2, or for v1, then I'd pay someone to write an Apache module - It's going to be so much faster than having HTML pages parsed as PHP to get them to work.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  25. #25
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear LittleWebmaster,

    Your site (www.vensions.com) was working beautifully until today, April 22, 2005. Is your site closed indefinitely or having issues?

    I can't even contact you nor you respond back.

    Cheers.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •