Solved

Jacks formmail.php not working

Posted on 2013-06-05
9
590 Views
Last Modified: 2013-12-25
I'm on a Unix server, running PHP Version 5.2.17. register globals is off. Anyone have any idea why this would suddenly stop working?

here's a bit of the error:

The form was not submitted for the following reasons:

Please use your browser's back button to return to the form and try again. The form was not submitted because of the following reasons:


\n"; echo "This form is powered by Jack's Formmail.php ".VERSION."/a>\n\n"; exit; } // function to check the banlist // suggested by a whole lot of people.. Thanks function check_banlist($banlist, $email) { if (count($banlist)) { $allow = true; foreach($banlist as $banned) { $temp = explode("@", $banned); if ($temp[0] == "*") { $temp2 = explode("@", $email); if (trim(strtolower($temp2[1])) == trim(strtolower($temp[1]))) $allow = false; } else { if (trim(strtolower($email)) == trim(strtolower($banned))) $allow = false; } } } if (!$allow) { print_error("You are using from a banned email address."); } } // function to check the referer for security reasons. // contributed by some one who's name got lost.. Thanks // goes out to him any way. function check_referer($referers) { if (count($referers)) { $found = false; $temp = explode("/",getenv("HTTP_REFERER")); $referer = $temp[2]; if ($referer=="") {$referer = $_SERVER['HTTP_REFERER']; list($remove,$stuff)=split('//',$referer,2); list($home,$stuff)=split('/',$stuff,2); $referer = $home; } for ($x=0; $x < count($referers); $x++) { if (eregi ($referers[$x], $referer)) { $found = true; } } if ($referer =="") $found = false; if (!$found){ print_error("You are coming from an unauthorized domain."); error_log("[FormMail.php] Illegal Referer. (".getenv("HTTP_REFERER").")", 0); } return $found; } else { return true; // not a good idea, if empty, it will allow it. } } if ($referers) check_referer($referers); if ($banlist) check_banlist($banlist, $email); // This function takes the sorts, excludes certain keys and // makes a pretty content string. function parse_form($array, $sort = "") { // build reservedformmail.php
0
Comment
Question by:phillystyle123
  • 5
  • 4
9 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39223822
The PHP formatting is breaking down at these lines:
   echo "<br><br>\n";
   echo "<small>This form is powered by <a href=\"http://www.dtheatre.com/scripts/\">Jack's Formmail.php ".VERSION."/a></small>\n\n";
   exit;

Open in new window


Did you post the copy from your web site or a copy you had on your computer?  I ask because I don't see anything wrong with the code you posted.
0
 

Author Comment

by:phillystyle123
ID: 39224154
the code i posted is from from my site- it looks like a lot of other formmail.php scripts on this server aren't working either.

in this example,i'm using it with this form:

somersetorthopedic.com/forms/satisfact.htm (not that that makes a difference)
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39224170
Your server is for some reason not running PHP at all.  I take that back, it is running the PHP for the other forms.  Any chance your host just did an upgrade and turned 'short_open_tags' off?  http://www.php.net/manual/en/ini.core.php#ini.short-open-tag
0
 

Author Comment

by:phillystyle123
ID: 39224180
short_open_tag is indeed off but I tried the script with <?php and no love - not the same error, but the page didn't go anywhere -just stuck on formmail.php

would theformmail script work if i added "php" to the open tags if short_open_tag is turned off?

i did just use the same script on my linux server and it worked perfectly so the host (verio) must've done something
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39224273
The page that somersetorthopedic.com/forms/satisfact.htm posts to still has 'short_open_tags' and if you look at the 'View Source' (after submitting), you can see the entire PHP file.  That's why I think that the PHP on that server has been changed to turn 'short_open_tags' off.  If that is the case, you must replace all opening PHP tags with '<?php' in place of '<?'.
0
 

Author Closing Comment

by:phillystyle123
ID: 39224324
was the short tags (i'd missed one!) and deprecated http_post_vars -updated both and the script works -thanks for the help!
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39224389
You're welcome and good for you.  I didn't notice the 'http_post_vars', I had to change them on another site that got upgraded.
0
 

Author Comment

by:phillystyle123
ID: 39226893
interesting point though -those deprecated vars worked on my linux server that's running php 5.3
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39227025
This is why they can be a problem.
$HTTP_POST_VARS contains the same initial information, but is not a superglobal. (Note that $HTTP_POST_VARS and $_POST are different variables and that PHP handles them as such)

http://www.php.net/manual/en/reserved.variables.post.php
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now