Results 1 to 8 of 8

Thread: PHP includes in formmail-generated pages

  1. #1
    Join Date
    Apr 2012
    Posts
    4

    Default PHP includes in formmail-generated pages

    Hi, I'm using FormMail v8.33 and fmbadhandler v1.22.

    I use a PHP include statement to put my mail address in the sidebar of web pages. This works normally on the "contact us" page which calls FormMail, but on all pages called directly by FormMail or fmbadhandler (good_template, bad_template and ATTACK_DETECTION_URL), the PHP include command is not executed. There is no error message generated by the server, but if I view the source code of the affected pages in my browser, the PHP include statement is visible - it has not been executed by the server. This does not happen when I preview these pages in my web development software before uploading them to the server.

    Has anybody else experienced this? Is there a workaround (other than putting the contents of the include file directly into each affected page)?

  2. #2
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: PHP includes in formmail-generated pages

    u need ur PHP good_template etc. to be executed by the server

    if u use TEMPLATEDIR in FormMail it just reads the files and sends them to the browser

    so, to get them to be exceuted first before formmail sends them to the browser, set TEMPLATEURL instead (u must clear out the TEMPLATEDIR value otherwise TEMPLATEURL is ignored)

  3. #3
    Join Date
    Apr 2012
    Posts
    4

    Default Re: PHP includes in formmail-generated pages

    Thanks crabtree,

    I've tried setting TEMPLATEURL and clearing TEMPLATEDIR as suggested, but when FormMail or fmbadhandler attempt to call pages I get the following error message:

    Cannot open template http://www.mysite.com/fmtemplates/contact_error.php?USER_AGENT=Mozilla%2F5.0+%28compatible%3B+MSIE+9.0%3B+Windows+NT+6.1%3B+WOW64%3B+Trident%2F5.0%29&sessid=gbcf79hr87568rme53v4isueb3&:
    fopen(
    http://www.mysite.com/fmtemplates/contact_error.php?USER_AGENT=Mozilla%2F5.0+%28compatible%3B+MSIE+9.0%3B+Windows+NT+6.1%3B+WOW64%3B+Trident%2F5.0%29&sessid=gbcf79hr87568rme53v4isueb3&):
    failed to open stream: Connection refused

    There is no .htaccess file in directory /fmtemplates which could restrict access. If I cut and paste the url into my browser, it opens correctly.

    I have downloaded and run the testurlopen.php script found on this forum, which confirms that fopen of URLs is not blocked by the server. I queried the server side file permissions with my web hosting company, who suggest the problem is with the FormMail and/or fmbadhandler scripts.

    Any suggestions?

  4. #4
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: PHP includes in formmail-generated pages

    so, this is the problem with TEMPLATEURL - some servers won't let PHP scripts open URLs

    u should show ur host the testurlopen.php script and ask them why it doesn't work.

    if they refuse to fix ur server to allow scripts to open URLs, then u will need to find a better host.

    remember, ur trying to open a URL to ur own server - it's not like ur trying to open URLs all around the internet

    there's no good reason for them to block this operation.

  5. #5
    Join Date
    Apr 2012
    Posts
    4

    Default Re: PHP includes in formmail-generated pages

    Crabtree,testurlopen.php confirms the server DOES let PHP files open URLs. This suggests the problem is with FormMail and fmbadhandler, not the server.Any further suggestions welcome!

  6. #6
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: PHP includes in formmail-generated pages

    which URL does it open?

    if it's to an external site (not yours), then change the URL to be a URL on ur site

    if it doesn't open that, then u have the common but ridiculous server problem that a script on ur site can open every URL on the internet except ur own URLs

  7. #7
    Join Date
    Apr 2012
    Posts
    4

    Default Re: PHP includes in formmail-generated pages

    Crabtree,

    You are correct - the problem is that my server will allow any external URL to be opened, but blocks any URL on my own website. I have contacted my hosting company to see if there is a workaround - if not, I will just have to replace the php include commands in the affected files.

    This will also be why I couldn't get the return link to work when using fmbadhandler. In the end I followed the workaround suggested in another thread on this forum, and replaced the return link with a javascript back button. Not ideal, but it will work in at least some browsers, incuding IE9, provided the user has javascript enabled.

    Thanks for all your help.

  8. #8
    Join Date
    Jan 2008
    Posts
    29

    Default Re: PHP includes in formmail-generated pages

    Hi guys,

    I'm having the same broblem with the good and bad templates. That is, on both of these templates the sidebar include is not being allowed to display any content.
    please see...

    http://www.gwizreport.com/mail/contact.php

    Please click on "submit' without entering any information, and you'll see the error page open without any sidebar content.

    I tried using the template url instead of the template directory, but that only creates a browser message that the (correct) path to the error page cannot be opened at all.

    I tried getting GoDaddy to fix what's causing the error from their side, but they simply said that the error is not on their side, but with the script; any suggestions?

    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 20
    Last Post: 07-Aug-2010, 08:55 PM
  2. Return Link generated by fmbadhandler.php doesn't work
    By davidjeanneret in forum Community Support
    Replies: 5
    Last Post: 19-Jun-2009, 03:02 PM
  3. Can I use PHP includes in bad_template?
    By artlab in forum Community Support
    Replies: 1
    Last Post: 02-May-2006, 10:40 PM
  4. dynamic php generated html email not working
    By scrypton in forum FormMail Subscription Support
    Replies: 6
    Last Post: 03-Dec-2005, 11:11 PM
  5. php includes not showing up in good/bad templates
    By snodart in forum FormMail Subscription Support
    Replies: 2
    Last Post: 02-Apr-2005, 09:12 AM

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
  •