:kj:
04-27-2003, 03:12 AM
I'm not a coder, i'm a designer, this will explain why I have no idea how this works.
I stumbled accross this free PHP form mail script - its cool except the limitation is... Once the form is submited, the results wont show the fields named "name" and "email"
here's the sample form: http://www.dagazsolutions.com/sabrix_new/partners_become_partner3.html
So i tried to remove variables and what not and I cant delete that portion of the script - or, more realistically, I dont know how
PLEASE HELP!
Here's the PHP script:
###########################################################
# CONFIGURE THE FOLLOWING VARIABLES #
###########################################################
// Recipient of message (This can be changed via the form itself)
$recipient = 'kelli@rgbdirect.com';
// Subject of message (This can be changed via the form itself)
$subject = 'Interested in becoming a Sabrix Partner';
// This is a list of domains that can run EZ FormMail. Do not include
// www, just the actual domain/ip address!
$referers = array('dagazsolutions.com', '', '');
// This is the page that users will be redirected to after the form is
// processed successfully.
$success_url = 'http://www.dagazsolutions.com/sabrix_new/partners_thankyou.html';
// Your site URL
$siteurl = 'http://www.dagazsoltions.com';
###########################################################
# DO NOT EDIT BELOW THIS LINE #
###########################################################
function Print_Footer() {
echo '<p><center>DagazSolutions.com <a href="http://www.dagazsolutions.com">http://www.dagazsolutions.com</a>!</center>';
}
function Check_Referer() {
global $referers;
$temp = explode('/', $_SERVER['HTTP_REFERER']);
$referer = $temp[2];
$found = false;
foreach ($referers as $domain) {
if (stristr($referer, $dagazsolutions.com)) { $found = true; }
}
return $found;
}
if ($_POST) {
if (Check_Referer() == false) {
echo '<font size="+1" color="#FF0000">Error: Invalid Referer</font><BR>';
echo 'You are accessing this script from an unauthorized domain!';
Print_Footer();
die();
}
$ctr = 0;
$isname = 0;
$isemail = 0;
foreach ($_POST as $key => $val) {
if ($key == 'name') { $isname = 1; }
if ($key == 'email') { $isemail = 1; }
if (substr($key, 0, 4) == 'req_' || $key == 'name' || $key == 'email') {
if ($val == '') {
if ($ctr == 0) {
echo '<font size="+1" color="#FF0000">Error: Missing Field(s)</font><BR>';
echo 'The following <i>required</i> field(s) were not filled out:<BR>';
}
echo '<BR>- <b>'.substr($key, 4).'</b>';
$ctr++;
}
}
}
if ($ctr > 0) {
echo '<p>Click <a href="javascript:history.go(-1)">here</a> to go back';
Print_Footer();
die();
}
else {
if ($isname == 0) {
echo '<font size="+1" color="#FF0000">Error: Missing Field</font><BR>';
echo 'No "name" field found.<p><a href="'.$siteurl.'">here</a> to return to the home page.';
Print_Footer();
die();
}
elseif ($isemail == 0) {
echo '<font size="+1" color="#FF0000">Error: Missing Field</font><BR>';
echo 'No "email" field found.<p><a href="'.$siteurl.'">here</a> to return to the home page.';
Print_Footer();
die();
}
}
if (!(preg_match("/^.{2,}?@.{2,}\./", $_POST['email']))) {
echo '<font size="+1" color="#FF0000">Error: Invalid E-mail</font><BR>';
echo 'The e-mail address you entered (<i>'.$_POST['email'].'</i>) is invalid.';
Print_Footer();
die();
}
$body = "Below is the result of your feedback form. It was submitted on:\n".date('l, F jS, Y').' at '.date('g:ia').".\n";
foreach ($_POST as $key => $val) {
if ($key == 'recipient') { $recipient = $val; }
elseif ($key == 'subject') { $subject = $val; }
else {
if ($key != 'name' && $key != 'email') {
$body .= "\n".str_replace('req_', '', $key).": $val";
}
}
}
$body .= "\n\n-------- Submission Details --------\n";
$body .= "Remote Address: ".getenv('REMOTE_ADDR')."\n";
$body .= "HTTP User Agent: ".getenv('HTTP_USER_AGENT')."\n\n";
$body .= "--------------------------------------------------\n";
$body .= "Powered by DagazSolutions.com. Available at http://www.DagazSolutions.com!";
$mailheaders = "From: ".$_POST['name']." <".$_POST['email'].">\n";
$mailheaders .= "Reply-To: ".$_POST['email'];
mail($recipient, $subject, $body, $mailheaders);
header("Location: $success_url");
}
else {
echo '<center>You have access this page from an invalid location. Please click <a href="'.$siteurl.'">here</a> to go to '.$siteurl.'.</center>';
}
Print_Footer();
?>
Here is the end result of the form once submitted - everything listed but "name" and "email"
Below is the result of your feedback form. It was submitted on:
Saturday, April 26th, 2003 at 9:59pm.
title: the big *****
company_name:
company_address:
company_address2:
Ccity:
Cpost_zip:
state:
Ccountry:
region: Americas
company_headquartered:
company_url:
company_num_emp:
company_foundedyear:
company_overview:
remLen3: 750
company_revdata:
remLen4: 250
partner_cat_desired:
remLen5: 250
Submit: Submit
-------- Submission Details --------
Remote Address: 12.240.155.68
HTTP User Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)
--------------------------------------------------
Powered by DagazSolutions.com. Available at http://www.DagazSolutions.com!
I stumbled accross this free PHP form mail script - its cool except the limitation is... Once the form is submited, the results wont show the fields named "name" and "email"
here's the sample form: http://www.dagazsolutions.com/sabrix_new/partners_become_partner3.html
So i tried to remove variables and what not and I cant delete that portion of the script - or, more realistically, I dont know how
PLEASE HELP!
Here's the PHP script:
###########################################################
# CONFIGURE THE FOLLOWING VARIABLES #
###########################################################
// Recipient of message (This can be changed via the form itself)
$recipient = 'kelli@rgbdirect.com';
// Subject of message (This can be changed via the form itself)
$subject = 'Interested in becoming a Sabrix Partner';
// This is a list of domains that can run EZ FormMail. Do not include
// www, just the actual domain/ip address!
$referers = array('dagazsolutions.com', '', '');
// This is the page that users will be redirected to after the form is
// processed successfully.
$success_url = 'http://www.dagazsolutions.com/sabrix_new/partners_thankyou.html';
// Your site URL
$siteurl = 'http://www.dagazsoltions.com';
###########################################################
# DO NOT EDIT BELOW THIS LINE #
###########################################################
function Print_Footer() {
echo '<p><center>DagazSolutions.com <a href="http://www.dagazsolutions.com">http://www.dagazsolutions.com</a>!</center>';
}
function Check_Referer() {
global $referers;
$temp = explode('/', $_SERVER['HTTP_REFERER']);
$referer = $temp[2];
$found = false;
foreach ($referers as $domain) {
if (stristr($referer, $dagazsolutions.com)) { $found = true; }
}
return $found;
}
if ($_POST) {
if (Check_Referer() == false) {
echo '<font size="+1" color="#FF0000">Error: Invalid Referer</font><BR>';
echo 'You are accessing this script from an unauthorized domain!';
Print_Footer();
die();
}
$ctr = 0;
$isname = 0;
$isemail = 0;
foreach ($_POST as $key => $val) {
if ($key == 'name') { $isname = 1; }
if ($key == 'email') { $isemail = 1; }
if (substr($key, 0, 4) == 'req_' || $key == 'name' || $key == 'email') {
if ($val == '') {
if ($ctr == 0) {
echo '<font size="+1" color="#FF0000">Error: Missing Field(s)</font><BR>';
echo 'The following <i>required</i> field(s) were not filled out:<BR>';
}
echo '<BR>- <b>'.substr($key, 4).'</b>';
$ctr++;
}
}
}
if ($ctr > 0) {
echo '<p>Click <a href="javascript:history.go(-1)">here</a> to go back';
Print_Footer();
die();
}
else {
if ($isname == 0) {
echo '<font size="+1" color="#FF0000">Error: Missing Field</font><BR>';
echo 'No "name" field found.<p><a href="'.$siteurl.'">here</a> to return to the home page.';
Print_Footer();
die();
}
elseif ($isemail == 0) {
echo '<font size="+1" color="#FF0000">Error: Missing Field</font><BR>';
echo 'No "email" field found.<p><a href="'.$siteurl.'">here</a> to return to the home page.';
Print_Footer();
die();
}
}
if (!(preg_match("/^.{2,}?@.{2,}\./", $_POST['email']))) {
echo '<font size="+1" color="#FF0000">Error: Invalid E-mail</font><BR>';
echo 'The e-mail address you entered (<i>'.$_POST['email'].'</i>) is invalid.';
Print_Footer();
die();
}
$body = "Below is the result of your feedback form. It was submitted on:\n".date('l, F jS, Y').' at '.date('g:ia').".\n";
foreach ($_POST as $key => $val) {
if ($key == 'recipient') { $recipient = $val; }
elseif ($key == 'subject') { $subject = $val; }
else {
if ($key != 'name' && $key != 'email') {
$body .= "\n".str_replace('req_', '', $key).": $val";
}
}
}
$body .= "\n\n-------- Submission Details --------\n";
$body .= "Remote Address: ".getenv('REMOTE_ADDR')."\n";
$body .= "HTTP User Agent: ".getenv('HTTP_USER_AGENT')."\n\n";
$body .= "--------------------------------------------------\n";
$body .= "Powered by DagazSolutions.com. Available at http://www.DagazSolutions.com!";
$mailheaders = "From: ".$_POST['name']." <".$_POST['email'].">\n";
$mailheaders .= "Reply-To: ".$_POST['email'];
mail($recipient, $subject, $body, $mailheaders);
header("Location: $success_url");
}
else {
echo '<center>You have access this page from an invalid location. Please click <a href="'.$siteurl.'">here</a> to go to '.$siteurl.'.</center>';
}
Print_Footer();
?>
Here is the end result of the form once submitted - everything listed but "name" and "email"
Below is the result of your feedback form. It was submitted on:
Saturday, April 26th, 2003 at 9:59pm.
title: the big *****
company_name:
company_address:
company_address2:
Ccity:
Cpost_zip:
state:
Ccountry:
region: Americas
company_headquartered:
company_url:
company_num_emp:
company_foundedyear:
company_overview:
remLen3: 750
company_revdata:
remLen4: 250
partner_cat_desired:
remLen5: 250
Submit: Submit
-------- Submission Details --------
Remote Address: 12.240.155.68
HTTP User Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)
--------------------------------------------------
Powered by DagazSolutions.com. Available at http://www.DagazSolutions.com!