|
Flash template mail form activation
Hello,
I am a new group member. I have a flash template that I customized and I am catching the blues from trying to activate the mail
form. I have found PHP scripts and tried using them but something is not working correctly. (the script is not picking up the information from the variables that I set up in flash). Can someone assist me? I am a novice when it comes to code so please keep this in mind. Thanks in advance.
Comments
you`ll need to post some error messages or something for us to help you
with. Start with this, put:
ini_set(`display_errors`, 1);
error_reporting (E_ALL);
at the top of your page and post what comes out on your screen. With error
messages people can start to address the issues.
Thanks for the prompt response. This is the php script that I am
using:
<?php
$sendTo = "info@...";
$subject = "Info from Game Website.";
$ip = $_SERVER[`REMOTE_ADDR`];
$name = $_GET[`Name`];
$email = $_GET[`Email`];
$comments = $_GET[`Comments`];
$from = "Reply-To: " . $name . "<" . $email . ">/n";
$headers = `Content-type: text/html; charset=iso-8859-1`;
$comments ="rnnn" . "Sender`s ip address is " . nl2br($ip);
mail($sendTo, $subject, $comments, $from);
?>
<html>
<body bgcolor="#282E2C">
<div align="center" style="margintop:
60px;color:#FFFFFF;font-size:12px;font-family:Tahoma;fontweight:
bold">
Your message was sent. Thank you.
</div>
</body>
</html>
<script>resizeTo(300, 300)</script>
When a visitor hits the send button on my contact form, they recieve
the "your message was sent, thank you" screen, but the only
information I recieve in my inbox is the senders ip address. No name
or email address or the body of the message. Hope this helps
is your server setup to send mail?
If you are at a host then you should contact them to see if you have that
ability - though Im sure you do.
If you happen to be on Windows then you`ll definitely have to contact them about
your mail directives.
This is the std php mail example:
<?php
$to = `nobody@...`;
$subject = `the subject`;
$message = `hello`;
$headers = `From: webmaster@...` . "rn" .
`Reply-To: webmaster@...` . "rn" .
`X-Mailer: PHP/` . phpversion();
mail($to, $subject, $message, $headers);
?>
Try rearranging your code to fit this example.
This is the code I am using for the form:
on (release) {
_parent.getURL("contact.php","_blank","GET");
_parent.name="Name";
_parent.email="Email";
_parent.comments="Comments";
}
Ok, I believe I understand, You are referring to the code that I
assigned to the submit button in Flash, if I am not mistaken.
page.
The page where the user fills out the information and hits send.
I am a little confused, should I just replace the code I have with the code you supplied? Also, the header and reply to strings, will they pick up the variables that I assigned to the boxes in the contact form?
To = "info@...";
This is the std php mail example:
<?php
$to = `nobody@...`;
$subject = `the subject`;
$message = `hello`;
$headers = `From: webmaster@...` . "rn" .
`Reply-To: webmaster@...` . "rn" .
`X-Mailer: PHP/` . phpversion();
mail($to, $subject, $message, $headers);
?>
Try rearranging your code to fit this example.
you supplied? Also, the header and reply to strings, will they pick up the variables that I assigned to the boxes in the contact form?
try this:
$to = "info@...";
$subject = "Info from Game Website.";
$message = $_GET[`Comments`];
$message .= "rnnn" . "Sender`s ip address is " . nl2br($ip);
$headers = "Replay-To: " . $_GET[`name`] . "<" .$_GET[`Email`] ">rn";
mail($to, $subject, $message, $headers);
/home/a8936851/public_html/ContactForm.php on line 6
Is line 6 the headers line? I see I forgot a dot after email.
$headers = "Replay-To: " . $_GET[`name`] . "<" .$_GET[`Email`]. ">rn";
Try that?
Thanks for the prompt response. This is the php script that I am using:
<?php
$sendTo = "info@...";
$subject = "Info from Game Website.";
$ip = $_SERVER[`REMOTE_ADDR`];
$name = $_GET[`Name`];
$email = $_GET[`Email`];
$comments = $_GET[`Comments`];
$from = "Reply-To: " . $name . "<" . $email . ">/n";
$headers = `Content-type: text/html; charset=iso-8859-1`;
$comments ="rnnn" . "Sender`s ip address is " . nl2br($ip);
mail($sendTo, $subject, $comments, $from);
?>
<html>
<body bgcolor="#282E2C">
<div align="center" style="margintop:
60px;color:#FFFFFF;font-size:12px;font-family:Tahoma;fontweight:
bold">
Your message was sent. Thank you.
</div>
</body>
</html>
<script>resizeTo(300, 300)</script>
When a visitor hits the send button on my contact form, they recieve
the "your message was sent, thank you" screen, but the only
information I recieve in my inbox is the senders ip address. No name
or email address or the body of the message. Hope this helps
---------------------------------
Hello,
We post below the previous e-mail in this group.
Your problem is with the line -
$comments ="rnnn" . "Sender`s ip address is " . nl2br($ip);
Perhaps this should be -
$comments = "rnnn" . $comments . "rnSender`s ip address is " .
nl2br($ip);
There are also other issues -
You have this line that is not doing anything usefull -
$headers = `Content-type: text/html; charset=iso-8859-1`;
And this -
$comments ="rnnn" . "Sen....
Perhaps should be -
$comments ="rnrn" . "Sen....
Also you have no filter in the input leaving your script open to abuse.
The headers in an e-mail are separated from the body by a "rnrn" while
each header is separated by "rn"
As you are not filtering the From e-mail address and the From address ia a
part of the headers then someone can do this -
From: bounce@...rnCC:spam1@...;spam2@....
etc
Try this -
$comments = $_GET[`Comments`];
$comments = str_replace("rn", "n", $comments);
$comments = str_replace("n.", "n..", $comments); // for windows servers
And ... well some code woulld be easier -
<?php
$to = "info@...";
$subject = "Info from Game Website.";
$message = $_GET[`Comments`];
// don`t forget to stripslashes on older versions of php
$message = str_replace("rn", "n", $message);
// for MAC users
$message = str_replace("n.", "n..", $message);
// for windows servers
$ip = $_SERVER[`REMOTE_ADDR`];
$message .= "nn" . "Sender`s ip address is " . nl2br($ip) . "n";
$email = $_GET[`Email`];
$email_allow = "abcdefghijklmnopqrstuvwxyz";
$email_allow .= strtoupper($email_allow);
$email_allow .= "._@";
$email = substr($email, 0, strspn($email, $email_allow));
$name = $_GET[`Name`];
$name = str_replace("r", "", $name);
$name = str_replace("n", "", $name);
$name = str_replace("", "", $name);
$from = "From: " . $name . "<" . $email . ">";
$reply = "Reply-To: " . $name . "<" . $email . ">";
$headers = $from . "rn";
$headers .= $reply . "rn";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "rn";
// last "rn" above may not be nessesary
mail($to, $subject, $message, $headers);
?>
Just hand typed so may have bugs - I will test it for you if you tell me it
doesn`t work.
Tested script -
<?php
$to = "info@...";
$subject = "Info from Game Website.";
$message = $_GET[`Comments`];
// don`t forget to stripslashes on older versions of php
$message = str_replace("rn", "r", $message);
$message = str_replace("r", "n", $message);
$message = str_replace("n.", "n..", $message);
// for windows servers
$message .= "nnSender`s ip address is ";
$message .= $_SERVER[`REMOTE_ADDR`];
$message .= "n";
$message = nl2br($message);
$email = $_GET[`Email`];
$email_allow = "abcdefghijklmnopqrstuvwxyz";
$email_allow .= strtoupper($email_allow);
$email_allow .= "._-@";
$email = substr($email, 0, strspn($email, $email_allow));
$name = $_GET[`Name`];
$name = str_replace("r", "", $name);
$name = str_replace("n", "", $name);
$name = stripslashes($name);
$from = "From: " . $name . "<" . $email . ">";
$reply = "Reply-To: " . $name . "<" . $email . ">";
$headers = $from . "rn";
$headers .= $reply . "rn";
$headers .= "Content-type: text/html; charset=iso-8859-1" . "rn";
// last "rn" above may not be nessesary
mail($to, $subject, $message, $headers);
?>
|
|