Code:
- <html>
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>MattsOldCars.com - Talk To Matt</title>
- <link rel="stylesheet" href="../common/mattsoldcars.css" type="text/css">
- </head>
-
- <body style="margin:0px;">
- <?php
-
- require_once('recaptchalib.php');
- $publickey = "xxx";
- $privatekey = "yyy";
- $errors = array("","","","","");
- $numErrors = -1;
-
- if($_POST["action"] == "Send Email") {
- if($_POST["name"] == "") {
- $numErrors += 1;
- $errors[$numErrors] = "Please enter your name.";
- }
- if($_POST["email"] == "") {
- $numErrors += 1;
- $errors[$numErrors] = "Please enter your email address.";
- }
- if($_POST["subject"] == "") {
- $numErrors += 1;
- $errors[$numErrors] = "Please enter a subject.";
- }
- if($_POST["message"] == "") {
- $numErrors += 1;
- $errors[$numErrors] = "Please enter a message.";
- }
- $resp = recaptcha_check_answer ($privatekey,
- $_SERVER["REMOTE_ADDR"],
- $_POST["recaptcha_challenge_field"],
- $_POST["recaptcha_response_field"]);
-
- if (!$resp->is_valid) {
- $numErrors += 1;
- $errors[$numErrors] = "Sorry, you don't appear to be human.";
- }
-
- if ($numErrors < 0) {
- $subject = "[Contact Form]" . $_POST["subject"];
- $from = "From: " . $_POST["name"] . " <" . $_POST["email"] . ">\r\n";
-
- // split message body into shorter lines
- $long_lines = split("\n", $_POST["message"]);
- $split_text = "";
- $width = 78;
- foreach ($long_lines as $oneline) {
- $split_text = $split_text . wordwrap($oneline, $width, "\n") . "\n";
- }
- // $split_text will have one more newline at the end than what you
- // started with, so let's clean it up
- $split_text = substr($split_text, 0, -1);
-
- mail("you@yourdomain.tld", $subject, $split_text, $from);
- }
-
- }
-
- ?>
-
- <table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td colspan="3" class="titlebar"><h1 class="sitetitle">Matt's Old Cars.com</h1>
- <h2 class="sitetagline">Fiddling with Rambler's since 1995</h2>
- </td>
- </tr>
- <tr>
- <td class="navbar" width="23%"><?php include("../navigation.txt"); ?>
- <p>Send me an e-mail:<br>
- <?php include("../common/emailaddr.txt"); ?><br>
- </td>
- <td width="2%"></td>
- <td class="contents"><span class="sectiontitle">Talk To Matt</span>
- <?php
- if ($numErrors > -1 ) {
- echo "<p><span class=\"warning\">Please correct the following:</span></p>";
- echo "<ul>";
- for ($x=0; $x <= $numErrors; $x++) {
- echo "<li class=\"warning\">" . $errors[$x] . "</li>";
- }
- echo "</ul>";
- }
-
- if($_POST["action"] != "Send Email" || $numErrors >= 0) {
- ?>
- <p>Due to
- the large amount of spam I get, I'm no longer publishing an email address
- on this web site. Please use the form below to send me an email. All of the
- items on this form are required.<br>
- <form method="POST" enctype="multipart/form-data">
- <table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
- <tr>
- <td valign="top">Your Name:</td>
- <td><input type="text" name="name" size="35" tabindex="1" value="<?php echo $_POST["name"]; ?>"><span class="example"> example:
- Alan Smithy</span></td>
- </tr>
- <tr>
- <td valign="top">Your Email Address:</td>
- <td><input type="text" name="email" size="35" tabindex="2" value="<?php echo $_POST["email"]; ?>"><span class="example"> example:
- alan.smithy@example.com</span></td>
- </tr>
- <tr>
- <td valign="top">Subject:</td>
- <td><input type="text" name="subject" size="62" tabindex="3" value="<?php echo $_POST["subject"]; ?>"></td>
- </tr>
- <tr>
- <td valign="top">Your Message:</td>
- <td><textarea rows="14" name="message" cols="55" tabindex="4"><?php echo $_POST["message"]; ?></textarea></td>
- </tr>
- <tr>
- <td valign="top">Verify that you're a human:</td>
- <td><?php echo recaptcha_get_html($publickey); ?></td>
- </tr>
- </table>
- <p><input type="submit" value="Send Email" name="action" tabindex="100"></p>
- </form>
- <?php
- } else {
- ?>
- <p>Your message has been sent!</p>
- <?php
- }
- ?>
- <p><br>
- <p align="right" class="tiny">Last Updated
- <!--webbot bot="Timestamp" s-type="EDITED" s-format="%m/%d/%y %I:%M:%S %p" startspan -->02/03/08 02:50:17 PM<!--webbot bot="Timestamp" i-checksum="27495" endspan --> </td>
- </tr>
- </table>
-
- </body>
- </html>
|
|