Solved

Jacks formmail.php not working

Posted on 2013-06-05
9
602 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

733 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