...

View Full Version : Contact form



jackBauer750
11-11-2010, 12:21 PM
was wondering if anyone could please help me to add a captcha to this form please?


<?php

//Change contact info here

$webMaster = "you@yourmail.com";

//END INFO

if (!defined('MODULE_FILE')) {
header('Location: ../../index.php');
die();
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
$pagetitle = "- $module_name";
get_lang($module_name);

include("header.php");
OpenTable();

function Main(){
global $module_name, $db, $prefix, $webMaster;

echo"<center><form method='post' action='modules.php?name=$module_name&op=sendmail'>
<font size='24' class='title'><b>Contact</b></font><hr><br>

<table border='0' cellspacing='10' cellpadding='0'>

<tr><td align='right'><b>Name:</b></td>
<td align='left'><input type='text' name='urname' size='35'></td></tr>

<tr><td align='right'><b>E-mail:</b></td>
<td align='left'><input type='text' name='uremail' size='35'></td></tr>

<tr><td align='right'><b>Subject:</b></td>
<td align='left'><input type='text' name='ursubject' size='35'></td></tr>

<tr><td align='right' valign='top'><b>Message:</b></td>
<td align='left'><textarea cols='70' name='urmessage' rows='15'></textarea></td></tr>

<tr><td align='right'></td>
<td align='left'><input type='submit' name='submit' value='Send Message'></td></tr>
</table></form></center>";

}

function SendMail(){
global $webMaster;
if($_POST['urmessage'] !="" && $_POST['ursubject'] !="" && $_POST['urname'] !="" && $_POST['uremail'] !=""){

$mail_body = "". $_POST['ursubject']."<br><hr><br>\n\r\n";
$mail_body .= "". $_POST['urmessage']."\n\r\n";

$to = $webMaster;
$emailSubject = 'Webmail';
$headers = "From: ". $_POST['urname'] . " <" . $_POST['uremail'] . ">\r\n";
$headers .= "Content-type: text/html\r\n";

mail($to, $emailSubject, $mail_body, $headers);

/* Success Message */
echo ("<center><img src=\"images/success.gif\"></center><br>");
echo ("<center><b>Your message has been successfully sent!</b><br><br>");
echo ("<center>Please allow 24hrs for a response<br>");
echo ("<meta http-equiv='refresh' content='5;URL=http://www.yoursite.com/index.php'><br>");
echo ("<center><b>[</b> You are being redirected <b>]</b>");
}else{
/* Error Message */
echo ("<center><img src=\"images/error.gif\"></center><br>");
echo ("<center><b>You must complete all fields!</b></center><br>");
echo ("<meta http-equiv='refresh' content='5;URL=modules.php?name=Contact'><br>");
echo ("<center><b>[</b> You are being redirected <b>]</b>");
}
}


switch ($op) {

default:
Main();
break;

case "sendmail":
SendMail();
break;

}

CloseTable();
include("footer.php");
?>


most appreciated

MattF
11-11-2010, 01:27 PM
http://www.phpcaptcha.org/

Keleth
11-11-2010, 04:36 PM
Or my personal favorite

http://www.google.com/recaptcha

phpdeveloper
11-11-2010, 05:03 PM
Please look at below URL it is help full to you

http://www.cyberciti.biz/faq/php-captcha-class-simple-php-captcha-example/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum