Solved

Jacks formmail.php not working

Posted on 2013-06-05
9
597 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamic Dropdowns 15 32
Undefined Variable: loop_limit, Undefined Variable: number 3 17
Combining Queries 7 27
Add a loading gif while php runs server side 15 25
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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…
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…

790 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