Jump to content

nathgregory

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nathgregory's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi. I've solved it now, butthanks anyway!
  2. What I've done now, is send the values as hidden input fields in the html form: <input type="hidden" name="sofa_3_seater2" value="45"> <input type="hidden" name="sofa_2_seater" value="30"> <input type="hidden" name="armchair_large" value="15"> Can anyone help me with a script to put in phpmailer-fe.php that will do the calculations, give a new variable called $total?
  3. I have tried changing it any inserting this function at the beginning of phpmailer-fe.php function write_this(){ $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) } Basically... $sofa_3_seater and $sofa_2_seater and $armchair_large are posted to phpmailer-fe.php script from the html form. In this function I am trying to declare new variables and give them a number ie $sofa_3_seater2 = 45; I then want the script to multiply them together, to work out cubic footage. Once all added together it should give $total, which phpmailer-fe.php should then email in its html email.
  4. 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.... ?>
  5. Thanks. I will give that a try. Does that mean that $total will be sent to phpmailer-fe when the form is submitted. At present, my form action line is: <form action="http://www.happydaysremovals.com/phpmailer-fe.php" method="post"> I take it that $total will just be another variable, posted to the phpmailer-fe, and can be included in my html .tpl file? Also, I don't think I can run PHP inside my HTML. Would I be able to use a php include file or something. If so, would it need to be run before the phpmailer-fe. Thanks for your help, I really appreciate it.
  6. Hi, I have an itinerary form at http://www.happydaysremovals.com/estimate.html Customers fill this in, and it uses phpmailer-fe to email the results to myself. I use a HTML .tpl file so I can make the output email look as I want. All that is fine, but I would like a volume calculator. Next to each item on the form, the customer enters the amount of that item, usually 1 or 2. If it was say a setee, I want to define that a setee = 30 cubic feet, for example. Then I want the calculator to calculate the total cubic footage for all the variables, and include it in the html email. I know with javascript this can be done, but I was hoping for a PHP result and for it to somehow work in with phpmailer-fe, for example: </style> <script language="JavaScript"> function write_this() { var setteelarge; var setteemedium; var setteesmall; var setteelarge2; var setteemedium2; var setteesmall2; var setteelargeresult; var setteemediumresult; var setteesmallresult; var total; setteelarge = document.form1.LargeSettee.value; setteemedium = document.form1.MediumSettee.value; setteesmall = document.form1.SmallSettee.value; setteelarge2 = 45 setteemedium2 = 31 setteesmall2 = 22 setteelargeresult = (setteelarge * setteelarge2); setteemediumresult = (setteemedium * setteemedium2); setteesmallresult = (setteesmall * setteesmall2); total = (setteelargeresult+setteemediumresult+setteesmallresult) document.form1.Total_Cubic_Feet.value = total } </script> Basically, I want to be able to include the cubic feet total value to also be emailed to me in the HTML email, but preferably all in PHP. At the moment, I get everyones itinerary, but want to be automatically be able to work out the cubic footage. Thanks
  7. Hi, I have an itinerary form at http://www.happydaysremovals.com/estimate.html Customers fill this in, and it uses phpmailer-fe to email the results to myself. I use a HTML .tpl file so I can make the output email look as I want. All that is fine, but I would like a volume calculator. Next to each item on the form, the customer enters the amount of that item, usually 1 or 2. If it was say a setee, I want to define that a setee = 30 cubic feet, for example. Then I want the calculator to calculate the total cubic footage for all the variables, and include it in the html email. I know with javascript this can be done, but I was hoping for a PHP result and for it to somehow work in with phpmailer-fe, for example: </style> <script language="JavaScript"> function write_this() { var setteelarge; var setteemedium; var setteesmall; var setteelarge2; var setteemedium2; var setteesmall2; var setteelargeresult; var setteemediumresult; var setteesmallresult; var total; setteelarge = document.form1.LargeSettee.value; setteemedium = document.form1.MediumSettee.value; setteesmall = document.form1.SmallSettee.value; setteelarge2 = 45 setteemedium2 = 31 setteesmall2 = 22 setteelargeresult = (setteelarge * setteelarge2); setteemediumresult = (setteemedium * setteemedium2); setteesmallresult = (setteesmall * setteesmall2); total = (setteelargeresult+setteemediumresult+setteesmallresult) document.form1.Total_Cubic_Feet.value = total } </script> Basically, I want to be able to include the cubic feet total value to also be emailed to me in the HTML email, but preferably all in PHP. At the moment, I get everyones itinerary, but want to be automatically be able to work out the cubic footage. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.