mattblog
New Member
- Messages
- 463
- Reaction score
- 13
- Points
- 0
I made a script to send a email to myself for link exchange. I tried it but it doesnt send the email. can anyone check if i did anything wrong. This was coded in html and refers to an action from a php script.
Html
PHP Action Script
Can anyone check for me?
Html
Code:
<form name="LinkExchange_ContactForm" method="post" action="send_form_email.php">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Request a Link Exchange - Techsavy Technology Forums</title>
<!-- Mr Bot, Don't Write These Down Please! -->
<meta name="robots" content="noindex" />
<!-- Okay, Thanks Bot for Listening -->
<body style="background-image: url('../../../under_maintenance/bg.gif'); background-repeat: repeat-x">
</head>
<!-- BACKGROUND END -->
<!-- LOGO AND INFORMATION BEGINS-->
<!-- DO NOT DELETE FOLLOWING TAGS, THEY FORMAT THE INFORMATION BELOW THE HEADER -->
<br /><br /><br />
<!-- LOGO -->
<img alt="" src="../../../under_maintenance/logo.png" align="topleft/" />
<br /><br /><br />
<!-- START_FORM -->
<center>
<form name="contactform" method="post" action="http://www.techsavy.cz.cc/forms/linkexchange/send_form_email.php">
<table width="700px">
<tr>
<td valign="center">
<label for="first_name"><h5><font color="#747170">First Name*</font></h5></label>
</td>
<td valign="center">
<input type="text" name="first_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="center">
<label for="email"><h5><font color="#747170">Email Address*</font></h5></label>
</td>
<td valign="center">
<input type="text" name="email" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="center"">
<label for="website"><h5><font color="#747170">Website*</font></h5></label>
</td>
<td valign="center">
<input type="text" name="website" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="center"">
<label for="website"><h5><font color="#747170">Your Website Topic*</font></h5></label>
</td>
<td valign="center">
<input type="text" name="website_topic" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="center"">
<label for="website"><h5><font color="#747170">Where will my Link be located on your site? *</font></h5></label>
</td>
<td valign="center">
<input type="text" name="link_place" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="center"">
<label for="website"><h5><font color="#747170">Title of Your Website*</font></h5></label>
</td>
<td valign="center">
<input type="text" name="your_link_title" maxlength="80" size="30">
</td>
</tr>
<td valign="center"">
<label for="website"><h5><font color="#747170">Will My Link be On Every Page of Your Website?*</font></h5></label>
</td>
<td valign="center">
<input type="checkbox" name="link_every_page" maxlength="100" size="100">
</td>
</tr>
<td valign="center">
<label for="comments"><h5><font color="#747170">Comments</font></h5></label>
</td>
<td valign="center">
<textarea name="comments" maxlength="1000" cols="25" rows="6"></textarea>
</td>
</tr>
<td>
<td colspan="2" style="text-align:center">
<input type="submit" value="Submit">
</td>
</tr>
</table>
</center>
<!-- END_FORM -->
</form>
</body>
</html>
PHP Action Script
Code:
<?php
if(isset($_POST['email'])) {
$email_to = "hidden for privacy";
$email_subject = "Link Exchange Request";
function died($error) {
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form your submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['email']) ||
!isset($_POST['website']) ||
!isset($_POST['website_topic']) ||
!isset($_POST['link_place']) ||
!isset($_POST['your_link_title']) ||
!isset($_POST['link_every_page']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form your submitted.');
}
$first_name = $_POST['first_name']; // required
$email_from = $_POST['email']; // required
$website = $_POST['website']; // required
$website_topic = $_POST['website_topic']; // required
$link_place = $_POST['link_place']; // required
$your_link_title = $_POST['your_link_title']; // required
$link_every_page = $_POST['link_every_page']; // required
$comments = $_POST['comments']; // not required
$error_message = "";
$email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
if(!eregi($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$error_message = "";
$website_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
if(!eregi($email_exp,$email_from)) {
$error_message .= 'The Website you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z .'-]+$";
if(!eregi($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Website: ".clean_string($website)."\n";
$email_message .= "Website Topic: ".clean_string($website_topic)."\n";
$email_message .= "Link Location: ".clean_string($link_place)."\n";
$email_message .= "Their Link Title: ".clean_string($your_link_title)."\n";
$email_message .= "Is The Link on Every Page?: ".clean_string($link_every_page)."\n";
$email_message .= "Comments ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
Thank you for Submitting your Link Exchange Request. Your Request is Currently Being Processed and You will Receive a Reply Soon!
<br />
<a href="http://www.techsavy.cz.cc/">Click Here to Go Back to the Techsavy Homepage</a>
<?
}
?>
Can anyone check for me?