I tried to include that code in phpmailer-fe.php...
but when I try to run it I get The website encountered an error while retrieving http://www.happydaysremovals.com/phpmailer-fenew.php. It may be down for maintenance or configured incorrectly.
<?php
error_reporting(0); //error_reporting(E_ALL);
function write_this(){
$sofa_3_seater = $_POST['sofa_3_seatercalc'];
$sofa_2_seater = $_POST['sofa_2_seatercalc'];
$armchair_large = $_POST['armchair_largecalc'];
$sofa_3_seater2 = 45
$sofa_2_seater2 = 31
$armchair_large2 = 22
$sofa_3_seaterresult = ($sofa_3_seater * $sofa_3_seater2);
$sofa_2_seaterresult = ($sofa_2_seater * $sofa_2_seater2);
$armchair_largeresult = ($armchair_large * $armchair_large2);
$total = ($sofa_3_seaterresult+$sofa_2_seaterresult+$armchair_largeresult)
echo $total;
}
/*~ phpmailer-fe.php
.---------------------------------------------------------------------------.
| Software: PHPMailer-FE (Form mailer Edition) |
| Version: 4.0.6 |
| Contact: codeworxtech@users.sourceforge.net |
| Info: http://phpmailer.sourceforge.net |
| ------------------------------------------------------------------------- |
| Author: Andy Prevost andy.prevost@worxteam.com (admin) |
| Copyright (c) 2002-2009, Andy Prevost. All Rights Reserved. |
| ------------------------------------------------------------------------- |
| License: Distributed under the Lesser General Public License (LGPL) |
| http://www.gnu.org/copyleft/lesser.html |
| This program is distributed in the hope that it will be useful - WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. |
| ------------------------------------------------------------------------- |
| We offer a number of paid services: |
| - Web Hosting on highly optimized fast and secure servers |
| - Technology Consulting |
| - Oursourcing (highly qualified programmers and graphic designers) |
'---------------------------------------------------------------------------'
Last updated: December 07 2009 00:45 EST
/**
* PHPMailer-FE - PHP Form To Email
*
* PHPMailer-FE is an HTML form to e-mail gateway that parses the results of
* any form and sends them to the specified recipient(s). This script has many
* formatting and operational options, most of which can be specified in each
* form. You don't need programming knowledge or multiple scripts for
* multiple forms. PHPMailer-FE also has security features to prevent users
* from including URLs in fields containing "nourl" or "comments" in the field name.
* PHPMailer-FE was written to be compatible with Formmail.pl and Formmail.php
*
* @package PHPMailer-FE
* @author Andy Prevost
* @copyright 2008-2009 Andy Prevost
*/
/* ****************************************************************
* Setting up PHPMailer-FE - REQUIRED FOR OPTIONAL SETTINGS
* ***************************************************************/
/**
* Defined Term, PHPMailer-FE Version number (for debugging mostly)
* @var static string
*
* NOTE: Required here, do not change
*
*/
define("VERSION", "4.0.6");
/**
* Defined Term, PHPMailer-FE base path (works with Linux and Windows)
* @var static string
*
* NOTE: Required here, do not change
*
*/
define("FEPATH", getcwd() . substr($_SERVER['PHP_SELF'],0,1) );
/**
* Ban List file name, fully qualified including directory
* ie. /home/public_html/account/banlog.php
* - can only be set in the script
* @var string
* NOTE: Required here, change only if filename altered
*/
$fileBanlist = FEPATH . 'banlog.php';
/**
* Use Ban List, protect from URLs in fields containing "nourl" or "comments" in name
* - can only be set in the script
* @var boolean
* NOTE: Required here, change as needed
*/
$useBanlist = false;
if (is_writable($fileBanlist)) {
$useBanlist = true;
}
/**
* Redirect URL if banned or hacked or failed Worx Turing test
* - can only be set in the script
* @var boolean
*/
$redirectOnBan = "http://" . $_SERVER['HTTP_HOST'];
/**
* REQUIRED: value determines if the javascript window close will be
* used when the default messages display after processing the form
* - useful for POPUP style forms
* default is "false"
* @var boolean
* NOTE: Required here, change as needed
*/
$useWindowClose = false;
/**
* Used as the charset for HTML emails
* default is "iso-8859-1"
* @var string
* NOTE: Required here, change as needed
*/
$htmlCharset = "iso-8859-1";
/**
* Attempts to prevent page refresh on PHPMailer-FE script page
* to stop duplicate emails sent for the same form submission
* default is true;
* @var bool
* NOTE: Required here, change as needed
*/
$stopRefresh = false; //true;
/**
* Cleans user submitted data of all known hacker and SQL injection attempts
* default is true;
* @var bool
* NOTE: Required here, change as needed
*/
$useSanitizer = true; //false;
/* ****************************************************************
* BLOCK ALL ATTEMPTS TO USE URL-BASED EMAIL HACKS (STOP SPAMMERS)
* AND BLOCK ALL ATTEMPTS TO PRESS THE RELOAD AFTER EXECUTION
* ***************************************************************/
if ($stopRefresh) {
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'GET' || isset($_SESSION['process_time'])) {
echo "Sorry, nothing to display ...<br />";
exit();
} elseif (isset($_SESSION['referer'])) {
if (getenv('HTTP_REFERER') != '' || isset($_POST['referer'])) {
if (isset($_POST['referer'])) {
if ($_SESSION['referer'] == $_POST["referer"]) {
echo "Sorry, nothing to display ...<br />";
exit();
}
} elseif ($_SESSION['referer'] == getenv('HTTP_REFERER')) {
echo "Sorry, nothing to display ...<br />";
exit();
}
}
} else {
$_SESSION['process_time'] = time();
if (getenv('HTTP_REFERER') != '' || isset($_POST['referer'])) {
if (isset($_POST['referer'])) {
$_SESSION['referer'] = $_POST["referer"];
} else {
$_SESSION['referer'] = getenv('HTTP_REFERER');
}
}
}
} else {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
echo "Sorry, nothing to display ...<br />";
exit();
}
}
/**
* Clean all user submitted data of hack and SQL injection attempts
*/
if ($useSanitizer) {
$getSanitizePath = $_SERVER['DOCUMENT_ROOT'] . str_replace('//','/',dirname($_SERVER['PHP_SELF']) . '/inc.sanitize.php');
if (file_exists($getSanitizePath)) {
require_once($getSanitizePath);
foreach ($_POST as $key => $value) {
$_POST[$key] = _sanitize($value);
}
}
}
/**
* 1. Convert all $_POST variables to a regular variable
* 2. Checks all $_POSTs for URL type input
* - will exit and not proceed if URL type input is found
* NOTE1: REQUIRED, PLEASE DO NOT CHANGE ... NEEDED TO SET VARIABLES PROPERLY
* NOTE2: Processing here because many of the settings can be altered by the form
* NOTE3: Processing here because External Config will also alter settings (after the form)
*/
foreach ($_POST as $key => $value) {
$key = strtolower($key);
$value = str_replace("\n","<br />",$value);
$hacked = false;
if (is_array($value)) {
$$key = $value;
} else {
$$key = trim(utf8_urldecode($value));
}
if ($useBanlist && is_writable($fileBanlist)) {
if (!stristr($key, 'url')) { // will only search if 'url' not found in $key
$hacked = FALSE;
$hacked = checkBannedInput($key,$value,$fileBanlist);
}
}
if ($hacked === TRUE) {
echo "Comments were not sent ...<br />";
echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"10; URL=" . $redirectOnBan . "\">";
if ($useWindowClose) {
echo '<script language="javascript" type="text/javascript">' . "\n";
echo 'setTimeout("self.close()", 5000 )' . "\n";
echo '</script>' . "\n";
}
exit();
}
}
/**
* include external configuration files
*/
$loadDefault = FEPATH . 'default.config.php';
if (file_exists($loadDefault)) {
include_once($loadDefault);
foreach ($_POST as $key => $value) {
$key = strtolower($key);
$value = str_replace("\n","<br />",$value);
if (is_array($value)) {
$$key = $value;
} else {
$$key = trim(utf8_urldecode($value));
}
}
}
if (getenv('HTTP_REFERER') != '' || isset($_POST['referer'])) {
if (isset($_POST['referer'])) {
$path_parts = pathinfo(trim($_POST["referer"]));
} else {
$path_parts = pathinfo(getenv('HTTP_REFERER'));
}
$filearr = explode('.',$path_parts["basename"]);
if (count($filearr) > 1) {
$loadFile = '';
for ($i=0;$i<count($filearr)-1;$i++) {
$loadFile .= $filearr[$i] . '.';
}
$loadFile .= 'config.php';
}
$loadFile = FEPATH . $loadFile;
if (file_exists($loadFile)) {
include_once($loadFile);
foreach ($_POST as $key => $value) {
if ($key!='fixedFromEmail' && $key!='fixedFromName') {
$key = strtolower($key);
}
$value = str_replace("\n","<br />",$value);
$$key = trim(utf8_urldecode($value));
}
}
}
$loadDefault = '';
$loadFile = '';
$imgProcessing = '';
if (file_exists('processing.gif')) {
$imgProcessing = '<img border="0" src="processing.gif" width="200" height="84"><br />';
}
//check connect through proxy or not
$proxydescription = "";
$remoteaddr = $_SERVER['REMOTE_ADDR'];
$http_via = getenv('HTTP_VIA');
$http_forwarded = getenv('HTTP_X_FORWARDED_FOR');
$remoteport = getenv('REMOTE_PORT');
//no proxy case or highly anonymous case
if($http_via == NULL && $http_forwarded == NULL) {
$remote = $remoteaddr;
$proxyip = $remoteaddr;
$hostname = gethostbyaddr($remoteaddr);
$proxyhostname = gethostbyaddr($remoteaddr);
$proxydescription = "No Proxy or a High Anonymity Proxy";
etc....
?>