[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 05-03-2007, 08:40 AM   #1 (permalink)
Account Suspended
 
Join Date: Oct 2005
Location: India
Posts: 636
15.35 NP$ (Donate)

blackwizard is a jewel in the roughblackwizard is a jewel in the roughblackwizard is a jewel in the rough


Order Form

Hello,

Look At the Following Code Below ::

PHP Code:
<?php
// ------- three variables you MUST change below  -------------------------------------------------------
$valid_ref1="http://www.your-domain.com";// change "Your--domain" to your domain
$valid_ref2="http://www.your-domain.com";// change "Your--domain" to your domain
$replyemail="your email@your domain.com";//change to your email address
// ------------------------------------------------------------

//clean input in case of header injection attempts!
function clean_input_4email($value, $check_all_patterns = true)
{
$patterns[0] = '/content-type:/';
$patterns[1] = '/to:/';
$patterns[2] = '/cc:/';
$patterns[3] = '/bcc:/';
if (
$check_all_patterns)
{
  
$patterns[4] = '/\r/';
  
$patterns[5] = '/\n/';
  
$patterns[6] = '/%0a/';
  
$patterns[7] = '/%0d/';
}
return
preg_replace($patterns, "", strtolower($value));
}

$name = clean_input_4email($_POST["name"]);
$email = clean_input_4email($_POST["email"]);
$thesubject = clean_input_4email($_POST["thesubject"]);
$thetitle = clean_input_4email($_POST["thetitle"]);
$thekeywords = clean_input_4email($_POST["thekeywords"]);
$themessage = clean_input_4email($_POST["themessage"], false);

$error_msg='ERROR - not sent. Try again.';

$success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
                   <p align="center"><strong>Your request has been successfully sent to us<br>
                   </strong> and we will reply as soon as possible.</p>
                   <p align="center">A copy of your query has been sent to you.</p>
                   <p align="center">Thank you.</p>'
;

$replymessage = "Hi $name

Thank you for your email.

We will endeavour to responsed to your submission request shortly.

Please DO NOT reply to this email.

Below is a copy of the request you submitted:
--------------------------------------------------
$thesubject
$thetitle
$themessage
--------------------------------------------------

Thank you"
;

// email variable not set - load $valid_ref1 page
if (!isset($_POST['email']))
{
echo
"<script language=\"JavaScript\"><!--\n ";
echo
"top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}

$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if(
$ref_page==$valid_ref1) $valid_referrer=1;
elseif(
$ref_page==$valid_ref2) $valid_referrer=1;
if(!
$valid_referrer)
{
echo
"<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n";
echo
"top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$themessage = "name: $name \nQuery: $themessage";
mail("$replyemail",
     
"$thesubject",
     
"$themessage",
    
"$thetitle",
//     "$thekeywords",    
     
"From: $email\nReply-To: $email");
mail("$email",
     
"Receipt: $thesubject",
     
"$replymessage",
     
"From: $replyemail\nReply-To: $replyemail");
echo
$success_sent_msg;

?>
In the above code, I am having a few problems.

1. When I submit the form using this PHP, the reply Email address does not get any Email regarding the Order details, But a copy of Order has been sent to The Applicant.
Code:
$replyemail="your email@your domain.com";//change to your email address
The Email Address, that was specified in the above area, did not get Details of the order, But the Applicant(of the order) got a receipt of his order.

2. On Clicking Submit Button, In Contact Form, I want the Details Sent to Admin Email($replyemail) and simultaneously, redirected to Paypal Payment Page.

I would be greatful to anyone who helps me and provides me the corrected PHP code, with corrections I mentioned.

Thanks
blackwizard is offline  
Old 05-03-2007, 02:15 PM   #2 (permalink)
Eating Pie
 
iNod's Avatar
 
Join Date: Nov 2004
Location: Canada
Posts: 2,289
126.05 NP$ (Donate)

iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of

Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
For starters headers should be in the format of

PHP Code:
$headers = 'From: webmaster@example.com' . "\r\n" .
    
'Reply-To: webmaster@example.com';
Notice the \r\n not just \n

The paypal part, just create a button and select Email link and than use header("location: $paypallink"); to redirect.

- Steve
__________________
I feel old.
iNod is offline  
Old 05-03-2007, 10:00 PM   #3 (permalink)
Account Suspended
 
Join Date: Oct 2005
Location: India
Posts: 636
15.35 NP$ (Donate)

blackwizard is a jewel in the roughblackwizard is a jewel in the roughblackwizard is a jewel in the rough


Ill try it out, Steve. Thanks. Will let you know, when they work.
blackwizard is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 02:33 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85