Jacks formmail.php not working

Posted on 2013-06-05
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
Question by:phillystyle123
  • 5
  • 4
LVL 83

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=\"\">Jack's Formmail.php ".VERSION."/a></small>\n\n";

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.

Author Comment

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: (not that that makes a difference)
LVL 83

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?

Author Comment

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

LVL 83

Accepted Solution

Dave Baldwin earned 500 total points
ID: 39224273
The page that 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 '<?'.

Author Closing Comment

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!
LVL 83

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.

Author Comment

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

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)

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Keep getting 503 on Curl request 6 30
php call to a non-object 3 32
test if query has no results 2 19
configure dependency in POM for new database 3 15
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

911 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

20 Experts available now in Live!

Get 1:1 Help Now