PHP contact form XHTML strict
#41
Posted 06 October 2009 - 11:54 AM
#42
Posted 06 October 2009 - 01:20 PM
I've just had a look at your contact.php and it still says mail_form_v2.php in the form:
<form action="mail_form_v2.php" method="post">
This needs changing to:
<form action="contact.php" method="post">
#43
Posted 06 October 2009 - 01:26 PM
#44
Posted 06 October 2009 - 03:02 PM
#45
Posted 12 October 2009 - 05:42 PM
#46
Posted 13 October 2009 - 09:15 AM
I need more details - what mail provider are you using?
#48
Posted 13 October 2009 - 03:54 PM
I ask because it's easy to whitelist certain incoming mail through some providers.
If you're having these mails sent to an account hosted through your domain, is SpamAssassin enabled on the account?
#49
Posted 13 October 2009 - 06:46 PM
#50
Posted 30 October 2009 - 02:37 AM
Eskymo, on 25 November 2008 - 06:14 PM, said:
Thanks
E
Hi there,
I had exactly the same problem you had with spam about a year ago and I didnt want to use captcha to stop spam so I came up with the following (Im sure others have done this before) I have never had any spam since
Add the following to your CSS file:
.botcatch {
visibility:hidden;
}
Add a text field to your contact form and assign it the class you made
<input name="fieldname" type="text" value="" class="botcatch" />
then in your PHP code do the following
<?php
// If the Send button is pressed
if ($_POST['submit']) {
// If a bot is attempting to send spam
if ($_POST['fieldname'] !="") {
//Boot it out of the server
die();
} else {
//Enter mail code here
}
} else {}
?>
This works for me
Let me know what you think.
Thanks,
Chris
#52
Posted 11 November 2009 - 09:41 PM
Just dump in an XHTML strict header, validate it and change a few html elements and you have a XHTML strict form.. don't waste your money on dire scripts
Ideally you'd implement a CAPTCHA but i'm not going to spend much more time on it.
<?php
// If the Send button is pressed
$submit = (isset($_POST['submit'])) ? $_POST['submit'] : FALSE;
$name = (isset($_POST['name'])) ? $_POST['name'] : FALSE;
$email = (isset($_POST['email'])) ? $_POST['email'] : FALSE;
$sum1 = (isset($_POST['sum1'])) ? $_POST['sum1'] : FALSE;
$sum2 = (isset($_POST['sum2'])) ? $_POST['sum2'] : FALSE;
$answer = (isset($_POST['answer'])) ? $_POST['answer'] : FALSE;
$errors = array();
$success = FALSE;
if ($submit)
{
if (($sum1+$sum2) == $answer)
{
// mail here.
$success = TRUE;
}
else
{
$errors[] = 'Answer incorrect.';
}
}
// Some randoms
$number1 = rand(1,20);
$number2 = rand(1,20);
?>
<html>
<head>
<title> My Contact form</title>
<style type="text/css">
label { display:block; }
</style>
</head>
<body>
<?php if(count($errors) != 0): ?>
<ul class="errors">
<?php foreach($errors as $e): ?>
<li><?php echo $e; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if($success): ?>
<div class="success">Thanks! We'll get back to you shortly.</div>
<?php endif; ?>
<form action="" method="post">
<label for="name">Your name: </label>
<input type="text" name="name" id="name" value="<?php echo (($name) ? $name : ''); ?>" /><br />
<label for="email">Your email: </label>
<input type="text" name="email" id="email" value="<?php echo (($email) ? $email : ''); ?>" /><br />
<p><strong>You're human right?</strong></p>
<p>Please answer this question: What is <?php echo $number1; ?> PLUS <?php echo $number2; ?> <input type="text" name="answer" value="" style="width:40px;" /></p>
<input type="hidden" name="sum1" value="<?php echo $number1 ?>" />
<input type="hidden" name="sum2" value="<?php echo $number2; ?>" />
<input type="submit" name="submit" value="contact me..." />
</form>
</body>
</html>
#53
Posted 05 December 2009 - 11:42 PM
Anyone know what I am doing wrong? I have amended the php part of it with my email address and website address so am unsure what to do and would really appreciate some help
Thanks
#54
Posted 23 February 2010 - 10:05 AM
http://www.anthonypa...rs/booking.html
I too would like to know what exactally I need to add to the script to replace :
<p>Your mail was successfully sent.</p>
with a thank you page of my own creation?
cheers,
t.c.
#55
Posted 21 March 2010 - 05:15 PM
Replace
echo '<p>Your mail was successfully sent.</p>';
with:
header('location: filepath of success page');
#56
Posted 14 April 2010 - 11:53 AM
- XHTML 1.0 Strict
- No tables
- Simple CSS styling with 2 included layout options
- User defined fields in the settings code (selects, text inputs, message and checkboxes)
- Mark certain fields as required
- Verification of required fields (server side)
- Verification for email header & html input injection
- Validation of email address (server side)
- Google AdWords Conversions tracking option
- Optional robot question
- Various settings for customization
The demo is located here and the script can be downloaded from the RuubikCMS forum topic.
Help



















