PDA

View Full Version : Contact.php


Johzen
06-17-2011, 04:27 AM
I didn't know that I also had a Contact.php

<?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
$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
$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. :)

edbr
06-17-2011, 06:25 AM
its all important

Johzen
06-17-2011, 06:38 AM
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.

edbr
06-17-2011, 06:58 AM
$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

Johzen
06-17-2011, 10:39 AM
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
06-19-2011, 07:31 AM
BUMP

Do I still need contact.asp?

edbr
06-20-2011, 03:27 AM
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

Johzen
06-20-2011, 04:47 AM
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
06-20-2011, 04:55 AM
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

edbr
06-20-2011, 05:20 AM
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

Johzen
06-28-2011, 09:51 AM
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

I've got this configuration :

<?xml version="1.0" encoding="utf-8"?>
<!--
Please read this information to learn how to set up the contact form integrated
into the template.

This readme file explains in details the meaning of the settings that can be
done in the fcContactFormConfiguration.xml configuration file.

It is recommended for you to use an XML editor to make changes to this file
because it’s less possible to make an error in the markup which can cause to
a not working contact form.
-->
<contactFormConfiguration>

<!--
An e-mail address which will be used to receive messages from your contact form.
You can specify several e-mail addresses separating them with a comma.
For example: first_email@domain.com, second_email@domain.com, third@domain.com
-->
<emailTo>I already putted my e-mail here</emailTo>

<!--
A server script type which will process sending e-mails. It depends on your
hosting and in the current version of the contact form it is allowed to use
two types: php (Apache, PHP Hosting); asp (IIS web server, ASP).
-->I have contact.php, which I think what this thing is referring, if not my domain uses .php only so that leaves everything to php
<serverProcessorType>php</serverProcessorType>

<!--
A name of the script file which process sending e-mails on your server (without
extension). The name contact is used by default.
-->I'm not sure if I have to put in here contact.php or contact, without the .php
<serverProcessorFileName>contact.php</serverProcessorFileName>

<!--
Set whether to validate only required fields (true/false). The default value is
true which means the not required fields of your contact form will not be validated.
For example if the e-mail field of your form is set as not required (imagine it)
the form will be processed even if the user types in an incorrect e-mail address.
-->
<validateRequiredOnly>false</validateRequiredOnly>

<!--
Set whether to submit the form when the Enter key is pressed even if the focus is
not on the Submit button (true/false).
-->
<submitFormOnEnter>false</submitFormOnEnter>

<!--
Text showing to the user when the form is submitted without any errors.
-->
<messageSentText>Thank you for your message.</messageSentText>

<!--
Text showing in case the form is not submitted because of a server error.
-->
<messageSentFailedText>Failed to send your message.</messageSentFailedText>

<!--
Text your visitor will see while waiting till the processing is over.
-->
<formProcessingText>processing...</formProcessingText>

<!--
Your SMTP server (for ASP only).
-->
<smtpServer>localhost</smtpServer>

<!--
Your SMTP port (for ASP only).
-->
<smtpPort>25</smtpPort>

<!--
Set whether to send the message as a plain text (true) or as HTML (false).
-->
<plainText>true</plainText>

<!--
ID of the input field (in the structure XML file) to use for the “from: ”
or email to use instead (for example: mailfrom@domainname.com).
-->
<emailFromSource>2</emailFromSource>

<!--
Subject of the e-mails that will be sent through this contact form or ID of
the input field (in the structure XML file) to use for the “subject: ” label
in your e-mail client.
-->
<subjectSource>Contact Form from your site</subjectSource>

<!--
Validation error messages that are showing to the user when the form fails to
validate. The form supports different types of validators. You can change the
text of the error messages the validators produce here.

You can use the {LABEL} keyword in these messages. It will replace it with the
label value of the field where an error occurs.
-->
<validationErrorMessages>

<!--
A required field is not filled in.
-->
<message type="fieldIsRequired">{LABEL} is required.</message>

<!--
The specified e-mail address is incorrect.
-->
<message type="emailNotValid">{LABEL} - is not valid email address.</message>

<!--
The specified number of characters in a field is less than a required minimum.
-->
<message type="minCharsLimitError">{LABEL} - The specified number of characters in a field is less than a required minimum.</message>

<!--
The specified string does not match with the regular expression.
-->
<message type="reqExpError">{LABEL} - The specified string does not match with the regular expression.</message>

<!--
The specified number is greater than an acceptable biggest number for this field.
-->
<message type="biggerThanMaxError">{LABEL} - The specified number is greater than an acceptable biggest number for this field.</message>

<!--
The specified number is lower than an acceptable lowest number for this field.
-->
<message type="lowerThanMinError">{LABEL} - The specified number is lower than an acceptable lowest number for this field.</message>

<!--
The data is not a number.
-->
<message type="notANumberError">{LABEL} - The data is not a number.</message>

<!--
The specified number must not be negative.
-->
<message type="negativeError">{LABEL} - The specified number must not be negative.</message>

<!--
The minimum number of variants is not selected
-->
<message type="minRequirementError">{LABEL} - The minimum number of variants is not selected</message>

<!--
The number of variants selected exceeds the maximum
-->
<message type="maxRequirementError">{LABEL} - The number of variants selected exceeds the maximum</message>

<!--
The fields that should be equal do not match
-->
<message type="shouldBeEqualError">{LABEL} - values do not match</message>
<!--
The date has wrong format.
-->
<message type="dateIsNotValidError">{LABEL} - date has wrong format</message>
</validationErrorMessages>

</contactFormConfiguration>










& Just for reference here is the structure that the configuration is referring to :

<?xml version="1.0" encoding="utf-8"?>
<contactFormStructure>

<formItems>

<item id="1" label="Name" required="true">

</item>
<item id="2" label="E-mail" required="true">

<validator>EmailValidator</validator>
</item>
<item id="3" label="Message" required="true">

</item>
</formItems>

</contactFormStructure>

I'm sorry if I'm causing you much trouble, but I really don't know what to do.
Thanks in advanced & Sorry for the inconvenience that was done.

Johzen
07-03-2011, 11:51 AM
My contact form is working although the only problem now is that it only accepts the e-mail of the domain

It only accepts, for example

johzen@dreamweaverclub.com (if my domain is dreamweaverclub.com) or johzen@yahoo.com (if my domain is yahoo.com)

help?

anyways, do any of you brilliant people know how to put a Like Box of Facebook with Dreamweaver?

Johzen
07-04-2011, 05:09 AM
Does anybody know how I can pop up an error message in my website?

edbr
07-04-2011, 05:33 AM
what error?

Johzen
07-04-2011, 05:52 AM
not really error message, more like message box.

do you know how I can put an fb box in my website?

edbr
07-04-2011, 06:06 AM
have a look here https://github.com/facebook/php-sdk/

Johzen
07-05-2011, 04:23 AM
have a look here https://github.com/facebook/php-sdk/

hey dud thx for the link

do you know what could be wrong with my configuration, it only recieves mail@domainname.com example earlier

edbr
07-07-2011, 02:25 AM
you mean it only sends to that domain? if so what do you want it to do?

Johzen
07-25-2014, 09:09 AM
Hey guys,

Can someone teach me how to delete this thread?

Thanks in advanced!