Solved

Jacks formmail.php not working

Posted on 2013-06-05
9
596 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 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=\"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 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?  http://www.php.net/manual/en/ini.core.php#ini.short-open-tag
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

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 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.
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 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)

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

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
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…

770 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