Bigbruin.com
Home :: Reviews & Articles ::
Forum :: Info :: :: Facebook :: Youtube :: RSS Feed
Search  :: Register :: Log in
View Single Post  Topic: Anyone know PHP? 
Author Message
Modulok
Rated XXX


PostPosted: Wed, 31 Jan 2007 16:51:56    Post Subject: Reply with quote

OK, I am stuck again with PHP Crazy
I'm updating a very old and horrible form for a website. I need the ability to have customers upload files so we can quote new jobs. I found a script from Here and bought the license to use the advanced script for commercial use.

I modified the script(s) and it emails the results from the form as planned. The problem is, like the last time, PHP errors after the form is submitted. Since they are not fatal the form does email and I get the correct result I need.

What I only need is for a redirect after the PHP script is finished so the user isn't stuck at an error page wondering if what they sent went through.

This page is the live form if you would like to try it you may, but please don't send large files to me...thanks for any help.

Here is the php file the form calls: email.php
Code:

<?php
// -------------------------------------------------------
// required fields should be loaded in a form and POSTed to email.php
// no changes are required in this module
// ------------------------------------------------------
session_start();$f_err = 0; $f_debug = 0; include "inc/econf.php"; include 'inc/efunc1.php'; include 'inc/efunc2.php'; $subject = ""; $header = ""; $template = ""; $message = ""; $name = ""; $footer = ""; $replyemail = ""; $cc = ""; $bcc = ""; $fmt = "text"; $url = ""; $include = ""; $attach = ""; $embed = ""; $mandatory = ""; $web = ""; $dom = "$ref[0]"; $error = "return_mail@$ref[0]"; $f_ch = "iso-8859-1"; if (isset($_POST)) $f_post = $_POST; else $f_post = $HTTP_POST_VARS; $f_r = getenv("HTTP_REFERER"); if ($f_r != "") {$f_x = 0; $f_y = 0; $f_r = strtolower($f_r); while($f_x < sizeof($ref)) {if(strstr($f_r,$ref[$f_x])) {$f_y = "1";}$f_x++;}if(!$f_y) {echo "X0100: Use of this script from $f_r is not permitted."; exit; }} $f_ml = ""; $f_c = 0; $f_ks[0] = ""; $f_vs[0] = ""; $f_n = 0; reset ($f_post); while (list ($f_k, $f_v) = each ($f_post)) {if ($f_k != 'aspam') $_SESSION[$f_k] = $f_v; if ($f_k == 'name') $name = $f_v; if ($f_k == 'web') $web = $f_v; if ($f_k == 'url') $url = $f_v; else if ($f_k == 'subject') $subject = $f_v; else if ($do && $f_k == 'destemail') $destemail = $f_v; else if ($f_k == 'dom') $dom = $f_v; else if ($f_k == 'replyemail') $replyemail = $f_v; else if ($f_k == 'attach') $attach = $f_v; else if ($f_k == 'embed') $embed = $f_v; else if ($f_k == 'fmt') $fmt = $f_v; else if ($f_k == 'cc') $cc = $f_v; else if ($f_k == 'bcc') $bcc = $f_v; else if ($f_k == 'header') $header = $f_v; else if ($f_k == 'template') $template = $f_v; else if ($f_k == 'include') $include = $f_v; else if ($f_k == 'message') $message = $f_v; else if ($f_k == 'footer') $footer = $f_v; else if ($f_k == 'mandatory') $mandatory = $f_v; else if ($f_k == 'f_ch') $f_ch = $f_v;else if ($f_k == 'metoo') $f_c = 1; else if ($f_k == 'ccsender') $f_c = 2;else if ($f_k == 'aspam') $aspam=$aspam; else {$f_ks[$f_n] = $f_k; $f_vs[$f_n] = $f_v; $f_n++;}} if ($f_c == 1) {if ($cc == "") $cc = $replyemail; else $cc .= ",$replyemail";} $f_tp = explode(",",$destemail); $destemail = "";  for ($f_x = 0; $f_x < sizeof($f_tp);$f_x++) {if(!strstr($f_tp[$f_x],"@")) {$f_tp[$f_x] .= "@".$dom;} if ($f_x > 0) $destemail .= ","; $destemail .= $f_tp[$f_x];} $f_e = false; if (errorStop($subject,$destemail,$replyemail,$cc,$bcc,$web)) $f_err = 1; else {if ($include != "") include $include; if ($f_ml != "0") {$f_h = create_mail_headers($fmt, $destemail, $replyemail, $cc, $bcc, $error, $f_ml, $mandatory); $f_msg = format_mail_content($fmt, $header, $template, $message, $footer, $replyemail, $name, $f_ks, $f_vs); $f_h .= create_mail_body($fmt, $f_msg, $message, $attach, $embed); $f_e = mail_send($destemail, $subject, $f_h, $f_q); if ($f_c == 2 && !$f_e) $f_e = mail_send($replyemail, 'CC: '.$subject, $f_h, $f_q);}} if(!$url) {$url = $f_r.'#thanks';} if ($f_e && !$f_err) header("location: $url"); else  {print "<p align=\"center\"><a href=\"#\" onclick=\"history.go(-1);return false;\">back</a>"; if (!$f_err) print " <a href=\"$url\">thanks</a></p>";}
?>


econf.php:
Code:
<?php
//$file = basename(__FILE__);if(eregi($file,$_SERVER['REQUEST_URI'])){die('This file cannot be accessed directly!');}

// place all valid servers in this array
// script will not send email when called from servers not listed
$ref = array("weiss-aug.com","www.weiss-aug.com");

// allow (1,2,3) or disallow (0) override of destination email address in form
// (-1) to only allow listed email addresses
// 2 = invalid if domain, mailserver, or mailbox is confirmed to not exist
// 3 = invalid even if mailserver refuses to verify if mailbox exists or not
$do = 0;

// verify (2,3) reply (sender) email address
// 0 = must be present and contain @
// 2 = invalid if domain, mailserver, or mailbox is confirmed to not exist
// 3 = invalid even if mailserver refuses to verify if mailbox exists or not
$ro = 0;

// destination email address - mandatory
// can be overridden by including destemail field in the form if override is allowed
$destemail = "mfiss@weiss-aug.com";

// list of valid destination addresses (if override = -1)
$val_email = array($destemail,'mfiss@weiss-aug.com');

// anti-spam check - enter any value to turn on anti-spam protection
// The aspam field in the form must then match this value unless this value
// is overridden by a corresponding session variable.
$aspam = '';

//set following to 1 if using qmail
$f_q = 0;

?>
View user's profile Send private message

Contact Us :: On Facebook :: On Youtube :: Newsletter :: RSS Feed :: FAQ :: Links :: Sponsors :: Privacy Policy
Copyright © 2000 - 2023 Bigbruin.com - All rights reserved