logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 06-17-2011, 03:27 AM   #1
Johzen
 
Join Date: Jun 2011
Posts: 16
Default Contact.php

I didn't know that I also had a Contact.php

PHP Code:
<?php
//-----------------Getting data sent by flash---------------------
foreach ($_POST as $key => $value){
  if (
$key != 'mail_to' && $key != 'smtp_server' && $key != 'smtp_port' && $key != 'mail_from' && $key != 'mail_subject' && $key != 'plain_text'){
 
   
$mail_body .= '<b>'.str_replace('_',' ',$key).'</b>:<br/>';
 
   
$mail_body .= ''.stripslashes($value).'<br/>';
  }
}
//-----------------------------------------------------------------
 
$message '<html><body>'.$mail_body.'</body></html>'//  mail body
//------------if plain text is set to true removing html tags------
if ($_POST['plain_text']=='true') {
 
$message str_replace('<br/>',"\r\n"$message);
 
$message strip_tags($message);
//------------------------------------------------------------------
} else {
//----otherwise composing message headers---------------------------
 
$headers  'MIME-Version: 1.0' "\r\n";
 
 
$headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
//------------------------------------------------------------------
}
//------------setting conf data-------------------------------------
$to $_POST['mail_to'];
$from $_POST['mail_from'];
$subject $_POST['mail_subject'];
$smtp_server $_POST['smtp_server'];
$smtp_port $_POST['smtp_port'];
//------------------------------------------------------------------
//---------setting header info--------------------------------------
$headers .= 'To: '.$to"\r\n";
$headers .= 'From: Site visitor ' .$from"\r\n";
//------------------------------------------------------------------
 
if (mail($to$subject$message$headers)){ // sending mail
 
print('&mail=1');  //succes
} else {
 print(
'&mail=0');//failure
}
?>
I'm new to these kinds of stuff, please can someone explain to me a bit clear?

I also have these...

send_email.php
PHP Code:
<?php
$contact_name 
$_POST['name'];
$contact_email $_POST['email'];
$contact_subject $_POST['subject'];
$contact_message $_POST['message'];
if( 
$contact_name == true )
{
 
$sender $contact_email;
 
$receiver "modufit@yahoo.com";
 
$client_ip $_SERVER['REMOTE_ADDR'];
 
$email_body "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip";  
 
$extra "From: $sender\r\n" "Reply-To: $sender \r\n" "X-Mailer: PHP/" phpversion();
 if( 
mail$receiver"Flash Contact Form - $contact_subject"$email_body$extra ) ) 
 {
  echo 
"success=yes";
 }
 else
 {
  echo 
"success=no";
 }
}
?>
send_email_auto_response.php

PHP Code:
<?php
$contact_name 
$_POST['name'];
$contact_email $_POST['email'];
$contact_subject $_POST['subject'];
$contact_message $_POST['message'];
if( 
$contact_name == true )
{
 
$sender $contact_email;
 
$receiver "yourname@yourdomain.com";
 
$client_ip $_SERVER['REMOTE_ADDR'];
 
 
$email_body "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip \n\nFlash Contact Form provided by http://www.flashmo.com";
 
$email_body_auto_reply "Hello $contact_name, \nThis is the auto reply message. Thank you. \n\We will reply as soon as we recieve your message";
 
 
$extra "From: $sender\r\n" "Reply-To: $sender \r\n" "X-Mailer: PHP/" phpversion();
 
$extra_auto_reply "From: $receiver\r\n" "Reply-To: $receiver \r\n" "X-Mailer: PHP/" phpversion();
 
 
mail$sender"Auto Reply - Re: $contact_subject"$email_body_auto_reply$extra_auto_reply ); // auto reply mail to sender
 
if( mail$receiver"Flash Contact Form - $contact_subject"$email_body$extra ) )
 {
  echo 
"success=yes";
 }
 else
 {
  echo 
"success=no";
 }
}
?>
Please help me understand which is much more important and which is needless.
Johzen is offline   Reply With Quote
Old 06-17-2011, 05:25 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,203
Default

its all important
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 06-17-2011, 05:38 AM   #3
Johzen
 
Join Date: Jun 2011
Posts: 16
Default

I've read in some topics that I have to change some parts in order for the .php to work, to redirect the message to my e-mail.
Johzen is offline   Reply With Quote
Old 06-17-2011, 05:58 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,203
Default

$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_subject = $_POST['subject'];
$contact_message = $_POST['message'];
these must match the values sent by your form
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 06-17-2011, 09:39 AM   #5
Johzen
 
Join Date: Jun 2011
Posts: 16
Default

what do you mean by "your form", my form in which?

~contact.php
~send_email.php
~send_email_auto_response.php

Also in my .xml, I don't see any link linking to my contact form, is that what should really show up?


In my xml, contacts page :

<page name="contacts">
<image imageUrl="_pic6.jpg" link="asfunction:link"/>

<texts>
<pageText><![CDATA[
CONTACT FORM
]]></pageText>

<pageText><![CDATA[
NAME:
]]></pageText>

<pageText><![CDATA[
E-MAIL:
]]></pageText>

<pageText><![CDATA[
MESSAGE:
]]></pageText>

Should it really be like that? or should their be like a link? linking to the contact form?
Johzen is offline   Reply With Quote
Old 06-19-2011, 06:31 AM   #6
Johzen
 
Join Date: Jun 2011
Posts: 16
Default

BUMP

Do I still need contact.asp?
Johzen is offline   Reply With Quote
Old 06-20-2011, 02:27 AM   #7
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,203
Default

if you send mail from your site you need yto process it , you can use php asp or perl so its your choice plus what is relevant to your server
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 06-20-2011, 03:47 AM   #8
Johzen
 
Join Date: Jun 2011
Posts: 16
Default

Quote:
Originally Posted by edbr View Post
if you send mail from your site you need yto process it , you can use php asp or perl so its your choice plus what is relevant to your server
PHP is recommended by my server

So that means we stick with PHP

I'm not sure what to change in this form, I just copy pasted it from the tutorials, but since it was last yera ago, & I just started again, I'll have to look for that tut. again which I think is impossible.
Johzen is offline   Reply With Quote
Old 06-20-2011, 03:55 AM   #9
Johzen
 
Join Date: Jun 2011
Posts: 16
Default

In my Flash based form

I have

"Name"
"E-mail"
"Message"

On my flash, I'm not sure, but I think I putted a sprite linking to the contact.php.

Got a "FreshForm" sprite on my "Contact Us" page, that's the sprite that I thinkn might be linking to the contact.php.

It's really hard to remember everything from way back a year :\ I'm sorry if I'm causing you too much trouble, please forgive me but I think you're the only person who can help me.

Thanks in advance mr. awesome edbr ^^
Johzen
Johzen is offline   Reply With Quote
Old 06-20-2011, 04:20 AM   #10
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,203
Default

forms sen either as a post variable (usual) or a get so the mail handler script will receive thm , check what the method of your form is
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

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

Forum Jump


All times are GMT. The time now is 01:03 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com