security to email contact form, how???

Post May 11th, 2008, 7:06 am

Hey guys.

I need help adding a security code to my email contact page. I've had the conact us form active for 3-4 days now and ive been recieving 'junk' so I want to add the security code where uses type in the code in the contact form.

I'm not very experianced in coding and they person who normally does it wont be back for about another week or so, so if there is a simple way of implementing it on the site i would really appreciate it.

The current contact page can be seen at here and i just want to add the security code on there towards the bottom of the form, so if possible please send me the code or tell me where i can get it from.

thanks heaps in advanced.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 11th, 2008, 7:06 am

  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post May 11th, 2008, 3:32 pm

I'll give you the code I use... Sent you a PM
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.

Post May 12th, 2008, 4:44 am

please if any1 can help... not sure what ive done wrong but ive followed the instructions of this page http://www.white-hat-web-design.co.uk/a ... aptcha.php and i cant get it to work... if you look at the source code on http://www.swiftproductions.com.au/mailer2.htm (just a temp page to show you guys the code) this is the page it normally goes to http://www.swiftproductions.com.au/mailer.php after you click the submit button but as you can see it wont even ask for the security code... please help!!!

sorry forgot to mention that im talking about the contact us page on my site
  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post May 12th, 2008, 2:35 pm

I use that code for myself... how come does it not work for you?

Is PHP enabled on your hosting account? If so, is GD extension on on it?

Try this... (If it's all on the same page...)
PHP Code: [ Download ] [ Select ]
<?php
session_start();
 
// remember to set permissions for this script! If not, you
// may not get the email.....
 
$to = 'YOUR_EMAIL_ADDRESS'; //Your Email ADDRESS!!!!!!!!!!!!!!
$subj = 'Swiftproductions Contact Form';
$cr = "\n";
 
$name = $_POST['name'];
$company = $_POST['company'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$messagebox = $_POST['messagebox'];
$web = $_POST['web'];
$graphic = $_POST['graphic'];
$print = $_POST['print'];
$updates = $_POST['updates'];
$general = $_POST['general'];
$seo = $_POST['seo'];
 
 
if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
$body .= 'Name: ' . $name . $cr . 'Company: ' . $company . $cr . 'Telephone: ' . $telephone . $cr;
$body .= $body . 'email: ' . $email . $cr . 'Message Box: ' . $messagebox . $cr . $cr;
$body .= $body . 'Web: ' . $web . $cr . 'Graphic: ' . $graphic . $cr . 'Print: ' . $print . $cr;
$body .= $body . 'Updates: ' . $updates . $cr . 'General: ' . $general . $cr . 'seo: ' . $seo;
 
mail($to, $subj, $body);
unset($_SESSION['security_code']);
} else {
 die('<p>The security image was wrong... please go back and try again.</p>'."\n");
}
?>
 
<script type="text/javascript">
gradualFader.init() //activate gradual fader
</script>
  1. <?php
  2. session_start();
  3.  
  4. // remember to set permissions for this script! If not, you
  5. // may not get the email.....
  6.  
  7. $to = 'YOUR_EMAIL_ADDRESS'; //Your Email ADDRESS!!!!!!!!!!!!!!
  8. $subj = 'Swiftproductions Contact Form';
  9. $cr = "\n";
  10.  
  11. $name = $_POST['name'];
  12. $company = $_POST['company'];
  13. $telephone = $_POST['telephone'];
  14. $email = $_POST['email'];
  15. $messagebox = $_POST['messagebox'];
  16. $web = $_POST['web'];
  17. $graphic = $_POST['graphic'];
  18. $print = $_POST['print'];
  19. $updates = $_POST['updates'];
  20. $general = $_POST['general'];
  21. $seo = $_POST['seo'];
  22.  
  23.  
  24. if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
  25. $body .= 'Name: ' . $name . $cr . 'Company: ' . $company . $cr . 'Telephone: ' . $telephone . $cr;
  26. $body .= $body . 'email: ' . $email . $cr . 'Message Box: ' . $messagebox . $cr . $cr;
  27. $body .= $body . 'Web: ' . $web . $cr . 'Graphic: ' . $graphic . $cr . 'Print: ' . $print . $cr;
  28. $body .= $body . 'Updates: ' . $updates . $cr . 'General: ' . $general . $cr . 'seo: ' . $seo;
  29.  
  30. mail($to, $subj, $body);
  31. unset($_SESSION['security_code']);
  32. } else {
  33.  die('<p>The security image was wrong... please go back and try again.</p>'."\n");
  34. }
  35. ?>
  36.  
  37. <script type="text/javascript">
  38. gradualFader.init() //activate gradual fader
  39. </script>
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.

Post May 12th, 2008, 2:59 pm

what page do I put that on?? the mailer.php or the contact_us.htm - nad yes php is active
  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post May 12th, 2008, 3:07 pm

Try it on the mailer.php... don't really know the action of your form... what is the action of your form?

What I mean is...
Code: [ Download ] [ Select ]
<form action="mailer.php" method="post">

Is that how your <form...> thing looks like? If so, yes, put that code in the mailer.php
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.

Post May 13th, 2008, 5:40 am

hey bogey.

mate its still not working. have a look at this page http://www.swiftproductions.com.au/codes.htm and you can see all 3 source codes and see if ive done anything wrong. that page contains all source codes for contact_us.htm , mailer.php and capturesecurityimage.php.

thanks for your help mate. i really appreciate it
  • radnor
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Mar 06, 2006
  • Posts: 40
  • Status: Offline

Post May 13th, 2008, 8:20 am

What is the address that's getting spammed. When you list it, just list upto and including the at sign (eg. bob@).

I tested the form on your site some. But I included my name so you would see it was me.

Are you sure it is not BOTS harvesting addresses on your pages?
  • radnor
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Mar 06, 2006
  • Posts: 40
  • Status: Offline

Post May 13th, 2008, 8:40 am

PHP4 & 5 are available on his host.

Post May 13th, 2008, 8:59 am

what do you mean bots?? the address is danny@swiftproductions.com.au thats my email address. The emails that im recieving look like this,

Name: voethbhzyh
Company: your company:
Telephone: contact : (Field Mandatory)
email: bocbnf@elgjch.com
Message Box: Nj2JcY <a href=\"http://iiljftokiymz.com/\">iiljftokiymz</a>, vtwyfbuzpxlw, [link=http://jasnvmtxwwcv.com/]jasnvmtxwwcv[/link], http://cnirzpzzmddb.com/

Web:
Graphic:
Print:
Updates:
General:
seo:


I'm recieving heaps and heaps of them. Do you know what im doing that is wrong?
  • radnor
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Mar 06, 2006
  • Posts: 40
  • Status: Offline

Post May 13th, 2008, 10:16 am

What is the output of this?

[code]
<?php
phpinfo();
?>
  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post May 13th, 2008, 5:47 pm

radnor wrote:
What is the output of this?

Code: [ Download ] [ Select ]
<?php
phpinfo();
?>
  1. <?php
  2. phpinfo();
  3. ?>

If he is receiving those emails, than yes, PHP is enabled. If PHP was disabled, he would not be receiving any mails...

@CircleOfLinks

Did you try sending yourself test messages? Not saying that the script doesn't work... looks like it does and works correctly...

Check if you have monofont.ttf in the same directory that your CaptchaSecurityImages.php is located in.

Try the following...
PHP Code: [ Download ] [ Select ]
<?php
session_start();
if(isset($_POST['submit']))
{
// remember to set permissions for this script! If not, you
// may not get the email.....
 
$to = "danny@swiftproductions.com.au"; //Your Email ADDRESS!!!!!!!!!!!!!!
$subj = 'Swiftproductions Contact Form';
$cr = "\n";
 
$name = $_POST['name'];
$company = $_POST['company'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$messagebox = $_POST['messagebox'];
$web = $_POST['web'];
$graphic = $_POST['graphic'];
$print = $_POST['print'];
$updates = $_POST['updates'];
$general = $_POST['general'];
$seo = $_POST['seo'];
 
 
if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
$body .= 'Name: ' . $name . $cr . 'Company: ' . $company . $cr . 'Telephone: ' . $telephone . $cr;
$body .= $body . 'email: ' . $email . $cr . 'Message Box: ' . $messagebox . $cr . $cr;
$body .= $body . 'Web: ' . $web . $cr . 'Graphic: ' . $graphic . $cr . 'Print: ' . $print . $cr;
$body .= $body . 'Updates: ' . $updates . $cr . 'General: ' . $general . $cr . 'seo: ' . $seo;
 
mail($to, $subj, $body);
unset($_SESSION['security_code']);
} else {
die('<p>The security image was wrong... please go back and try again.</p>'."\n");
}
}
?>
<script type="text/javascript">
gradualFader.init() //activate gradual fader
</script>
  1. <?php
  2. session_start();
  3. if(isset($_POST['submit']))
  4. {
  5. // remember to set permissions for this script! If not, you
  6. // may not get the email.....
  7.  
  8. $to = "danny@swiftproductions.com.au"; //Your Email ADDRESS!!!!!!!!!!!!!!
  9. $subj = 'Swiftproductions Contact Form';
  10. $cr = "\n";
  11.  
  12. $name = $_POST['name'];
  13. $company = $_POST['company'];
  14. $telephone = $_POST['telephone'];
  15. $email = $_POST['email'];
  16. $messagebox = $_POST['messagebox'];
  17. $web = $_POST['web'];
  18. $graphic = $_POST['graphic'];
  19. $print = $_POST['print'];
  20. $updates = $_POST['updates'];
  21. $general = $_POST['general'];
  22. $seo = $_POST['seo'];
  23.  
  24.  
  25. if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
  26. $body .= 'Name: ' . $name . $cr . 'Company: ' . $company . $cr . 'Telephone: ' . $telephone . $cr;
  27. $body .= $body . 'email: ' . $email . $cr . 'Message Box: ' . $messagebox . $cr . $cr;
  28. $body .= $body . 'Web: ' . $web . $cr . 'Graphic: ' . $graphic . $cr . 'Print: ' . $print . $cr;
  29. $body .= $body . 'Updates: ' . $updates . $cr . 'General: ' . $general . $cr . 'seo: ' . $seo;
  30.  
  31. mail($to, $subj, $body);
  32. unset($_SESSION['security_code']);
  33. } else {
  34. die('<p>The security image was wrong... please go back and try again.</p>'."\n");
  35. }
  36. }
  37. ?>
  38. <script type="text/javascript">
  39. gradualFader.init() //activate gradual fader
  40. </script>

If that doesn't work try the following script... It's a bit different and one page (Except the captchasecurityimage.php) but it still does the same thing...
Code: [ Download ] [ Select ]
<?php
session_start();
?>
<!-- This page is mail.php //-->
<?php
if(empty($_POST['submit']))
{
?>
<form action="mail.php" method="post">
<div>
*Name: <input type="text" name="name" size="20" /><br />
Company: <input type="text" name="company" size="20" /><br />
*Telephone: <input type="text" name="telephone" size="20" /><br />
*E-Mail: <input type="text" name="email" size="20" /><br />
Send To: <select name="to">
<option value="">Select Option</option>
<option value="CustomerService">Customer Service</option>
<option value="CustomerSupport">Customer Support</option>
</select><br />
Subject: <input type="text" name="subject" size="20" /><br />
*Message:<br />
<textarea rows="10" cols="25" name="message"></textarea><br />
Choose an option:<br />
<input type="checkbox" name="WD" value="Web Design"> Web Design
<input type="checkbox" name="GD" value="Graphic Design"> Graphic Design
<input type="checkbox" name="WU" value="Web Updates"> Web Updates
<input type="checkbox" name="GE" value="General Enquiry"> General Enquiry<br />
<input type="checkbox" name="PW" value="Print Work"> Print Work
<input type="checkbox" name="H" value="Hosting"> Hosting
<input type="checkbox" name="SEO" value="SEO Work"> SEO Work<br />
Security Image:<br />
<img src="CaptchaSecurityImages.php?width=100&amp;height=40&amp;characters=5" alt="Security Code" />
<input id="sCode" name="security_code" type="text" size="33.5" /><br />
<input type="submit" name="submit" value="submit" class="submit" /> <input type="reset" name="reset" value="reset" class="submit" />
</div>
</form>
<p>* = Required Field</p>
<?php
} else {
    //Stripping the submitted information from HTML
    $_POST = array_map('strip_tags', $_POST);

    //Setting the values
    $name = $_POST['name'];
    $company = $_POST['company'];
    $telephone = $_POST['telephone'];
    $email = $_POST['email'];
    $to = $_POST['to'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $wd = $_POST['WD'];
    $gd = $_POST['GD'];
    $wu = $_POST['WU'];
    $ge = $_POST['GE'];
    $pw = $_POST['PW'];
    $h = $_POST['H'];
    $seo = $_POST['SEO'];

    //Setting the variables
    $adminEmail = "danny@swiftproductions.com.au"; //The default email (YOURS)
    $mMax = '5000'; //Max characters for the message
    $sMax = '25';     //Max characters for the subject
    $nMax = '30';     //Max characters for the name
    
    //Validating the fields...
    if(empty($name)) //Checking if the name is filled in
    {
     $error[] = "<li>You forgot to fill in your name</li>\n";
    } elseif(!preg_match('$[a-z]{3,'. $nMax .'}$', $name)) {
     $error[] = "<li>Your name is too long, has to be no longer than $nMax characters</li>\n";
    }

    if(empty($email)) //Checking if the email is filled in
    {
     $error[] = "<li>You forgot to fill in your email</li>\n";
    } elseif(!preg_match('/[_a-z0-9-]+(.[_a-z0-9-]+)*@[_a-z0-9-]+(.[_a-z0-9-]+)*(.[_a-z]{2,3})$/', $email)) {
     $error[] = "<li>Your E-Mail is of incorrect format... it has to be in <strong>yourname@domain.tld</strong> format</li>\n";
    }

    if(empty($telephone)) //Checking if the phone is filled in
    {
     $error[] = "<li>You didn't put in your phone number</li>\n";
    } elseif(!preg_match_all('$.*[[0-9]{1,2}+[-]+[0-9]{1,3}]*.$',$telephone,$matched)) {
     $error[] = "<li>Your phone is of incorrect format... it has to be in <strong>###-####</strong> format</li>\n";
    }

    if(!empty($to))
    {
     if($to == 'CustomerService')
     {
        $to = "sales@swiftproductions.com.au";
     } elseif($to = 'CustomerSupport') {
        $to = "support@swiftproductions.com.au";
     } else {
        $to = $adminEmail;
     }
    } else {
     $to = $adminEmail;
    }

    if(empty($subject))
    {
     $subject = "Web Site Mailer";
    }

    if(empty($message))
    {
     $error[] = "<li>You didn't put in a message</li>\n";
    } elseif(strlen($message) > $mMax) {
     $error[] = "<li>You message is too long, has to be no longer than $mMax characters</li>\n";
    }

    if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) )
    {
     unset($_SESSION['security_code']);
    } else {
     $error[] = "<li>The security image doesn't match with what you put in</li>\n";
    }

    //Finding out which of the checkboxes were filled in
    if(isset($wd))
    {
     $chose .= $wd ."<br />\n";
    }

    if(isset($gd))
    {
     $chose .= $gd ."<br />\n";
    }

    if(isset($wu))
    {
     $chose .= $wu ."<br />\n";
    }

    if(isset($ge))
    {
     $chose .= $ge ."<br />\n";
    }

    if(isset($pw))
    {
     $chose .= $pw ."<br />\n";
    }

    if(isset($h))
    {
     $chose .= $h ."<br />\n";
    }

    if(isset($seo))
    {
     $chose .= $seo ."<br />\n";
    }

    $message = nl2br($message);
    $cnt = count($error);
    if($cnt > '0')
    {
     echo "You made $cnt errors in the form";
     echo "<ol>\n";
     foreach($error as $value)
     {
        echo $value;
     }
     echo "</ol>\n";
     echo "<a href=\"mail.php\">Try Again</a>\n";
    } else {
     $body .= "<strong>Name:</strong> $name<br />\n";
     $body .= "<strong>Company:</strong> $company<br />\n";
     $body .= "<strong>Telephone:</strong> $telephone<br />\n";
     $body .= "<strong>E-Mail:</strong> $email<br />\n";
     $body .= "<strong>Message:</strong> $message<br />\n";
     $body .= "<br />\n";
     $body .= "$name chose the following options:<br />\n";
     $body .= "<strong>$chose</strong>";
     //Contact subject
     $subject2 = $subject;
    
     //Details
     $message2 = $message;

     //Mail of sender
     $mail_from = $eMail;

     //From
     $header = "From: $name <$email>";

     //Enter your email address
     $to = $adminEmail;

     $send_contact = mail($to,$subject,$body,$header);
     if($send_contact)
     {
        echo '<p>We have successfully recieved your email</p>'."\n";
        echo "You submitted:<br />\n <p>$body</p>";
     } else {
        echo '<p>An error occured with the transaction. The message has not being sent</p>'."\n";
     }
    }
}
?>
  1. <?php
  2. session_start();
  3. ?>
  4. <!-- This page is mail.php //-->
  5. <?php
  6. if(empty($_POST['submit']))
  7. {
  8. ?>
  9. <form action="mail.php" method="post">
  10. <div>
  11. *Name: <input type="text" name="name" size="20" /><br />
  12. Company: <input type="text" name="company" size="20" /><br />
  13. *Telephone: <input type="text" name="telephone" size="20" /><br />
  14. *E-Mail: <input type="text" name="email" size="20" /><br />
  15. Send To: <select name="to">
  16. <option value="">Select Option</option>
  17. <option value="CustomerService">Customer Service</option>
  18. <option value="CustomerSupport">Customer Support</option>
  19. </select><br />
  20. Subject: <input type="text" name="subject" size="20" /><br />
  21. *Message:<br />
  22. <textarea rows="10" cols="25" name="message"></textarea><br />
  23. Choose an option:<br />
  24. <input type="checkbox" name="WD" value="Web Design"> Web Design
  25. <input type="checkbox" name="GD" value="Graphic Design"> Graphic Design
  26. <input type="checkbox" name="WU" value="Web Updates"> Web Updates
  27. <input type="checkbox" name="GE" value="General Enquiry"> General Enquiry<br />
  28. <input type="checkbox" name="PW" value="Print Work"> Print Work
  29. <input type="checkbox" name="H" value="Hosting"> Hosting
  30. <input type="checkbox" name="SEO" value="SEO Work"> SEO Work<br />
  31. Security Image:<br />
  32. <img src="CaptchaSecurityImages.php?width=100&amp;height=40&amp;characters=5" alt="Security Code" />
  33. <input id="sCode" name="security_code" type="text" size="33.5" /><br />
  34. <input type="submit" name="submit" value="submit" class="submit" /> <input type="reset" name="reset" value="reset" class="submit" />
  35. </div>
  36. </form>
  37. <p>* = Required Field</p>
  38. <?php
  39. } else {
  40.     //Stripping the submitted information from HTML
  41.     $_POST = array_map('strip_tags', $_POST);
  42.     //Setting the values
  43.     $name = $_POST['name'];
  44.     $company = $_POST['company'];
  45.     $telephone = $_POST['telephone'];
  46.     $email = $_POST['email'];
  47.     $to = $_POST['to'];
  48.     $subject = $_POST['subject'];
  49.     $message = $_POST['message'];
  50.     $wd = $_POST['WD'];
  51.     $gd = $_POST['GD'];
  52.     $wu = $_POST['WU'];
  53.     $ge = $_POST['GE'];
  54.     $pw = $_POST['PW'];
  55.     $h = $_POST['H'];
  56.     $seo = $_POST['SEO'];
  57.     //Setting the variables
  58.     $adminEmail = "danny@swiftproductions.com.au"; //The default email (YOURS)
  59.     $mMax = '5000'; //Max characters for the message
  60.     $sMax = '25';     //Max characters for the subject
  61.     $nMax = '30';     //Max characters for the name
  62.     
  63.     //Validating the fields...
  64.     if(empty($name)) //Checking if the name is filled in
  65.     {
  66.      $error[] = "<li>You forgot to fill in your name</li>\n";
  67.     } elseif(!preg_match('$[a-z]{3,'. $nMax .'}$', $name)) {
  68.      $error[] = "<li>Your name is too long, has to be no longer than $nMax characters</li>\n";
  69.     }
  70.     if(empty($email)) //Checking if the email is filled in
  71.     {
  72.      $error[] = "<li>You forgot to fill in your email</li>\n";
  73.     } elseif(!preg_match('/[_a-z0-9-]+(.[_a-z0-9-]+)*@[_a-z0-9-]+(.[_a-z0-9-]+)*(.[_a-z]{2,3})$/', $email)) {
  74.      $error[] = "<li>Your E-Mail is of incorrect format... it has to be in <strong>yourname@domain.tld</strong> format</li>\n";
  75.     }
  76.     if(empty($telephone)) //Checking if the phone is filled in
  77.     {
  78.      $error[] = "<li>You didn't put in your phone number</li>\n";
  79.     } elseif(!preg_match_all('$.*[[0-9]{1,2}+[-]+[0-9]{1,3}]*.$',$telephone,$matched)) {
  80.      $error[] = "<li>Your phone is of incorrect format... it has to be in <strong>###-####</strong> format</li>\n";
  81.     }
  82.     if(!empty($to))
  83.     {
  84.      if($to == 'CustomerService')
  85.      {
  86.         $to = "sales@swiftproductions.com.au";
  87.      } elseif($to = 'CustomerSupport') {
  88.         $to = "support@swiftproductions.com.au";
  89.      } else {
  90.         $to = $adminEmail;
  91.      }
  92.     } else {
  93.      $to = $adminEmail;
  94.     }
  95.     if(empty($subject))
  96.     {
  97.      $subject = "Web Site Mailer";
  98.     }
  99.     if(empty($message))
  100.     {
  101.      $error[] = "<li>You didn't put in a message</li>\n";
  102.     } elseif(strlen($message) > $mMax) {
  103.      $error[] = "<li>You message is too long, has to be no longer than $mMax characters</li>\n";
  104.     }
  105.     if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) )
  106.     {
  107.      unset($_SESSION['security_code']);
  108.     } else {
  109.      $error[] = "<li>The security image doesn't match with what you put in</li>\n";
  110.     }
  111.     //Finding out which of the checkboxes were filled in
  112.     if(isset($wd))
  113.     {
  114.      $chose .= $wd ."<br />\n";
  115.     }
  116.     if(isset($gd))
  117.     {
  118.      $chose .= $gd ."<br />\n";
  119.     }
  120.     if(isset($wu))
  121.     {
  122.      $chose .= $wu ."<br />\n";
  123.     }
  124.     if(isset($ge))
  125.     {
  126.      $chose .= $ge ."<br />\n";
  127.     }
  128.     if(isset($pw))
  129.     {
  130.      $chose .= $pw ."<br />\n";
  131.     }
  132.     if(isset($h))
  133.     {
  134.      $chose .= $h ."<br />\n";
  135.     }
  136.     if(isset($seo))
  137.     {
  138.      $chose .= $seo ."<br />\n";
  139.     }
  140.     $message = nl2br($message);
  141.     $cnt = count($error);
  142.     if($cnt > '0')
  143.     {
  144.      echo "You made $cnt errors in the form";
  145.      echo "<ol>\n";
  146.      foreach($error as $value)
  147.      {
  148.         echo $value;
  149.      }
  150.      echo "</ol>\n";
  151.      echo "<a href=\"mail.php\">Try Again</a>\n";
  152.     } else {
  153.      $body .= "<strong>Name:</strong> $name<br />\n";
  154.      $body .= "<strong>Company:</strong> $company<br />\n";
  155.      $body .= "<strong>Telephone:</strong> $telephone<br />\n";
  156.      $body .= "<strong>E-Mail:</strong> $email<br />\n";
  157.      $body .= "<strong>Message:</strong> $message<br />\n";
  158.      $body .= "<br />\n";
  159.      $body .= "$name chose the following options:<br />\n";
  160.      $body .= "<strong>$chose</strong>";
  161.      //Contact subject
  162.      $subject2 = $subject;
  163.     
  164.      //Details
  165.      $message2 = $message;
  166.      //Mail of sender
  167.      $mail_from = $eMail;
  168.      //From
  169.      $header = "From: $name <$email>";
  170.      //Enter your email address
  171.      $to = $adminEmail;
  172.      $send_contact = mail($to,$subject,$body,$header);
  173.      if($send_contact)
  174.      {
  175.         echo '<p>We have successfully recieved your email</p>'."\n";
  176.         echo "You submitted:<br />\n <p>$body</p>";
  177.      } else {
  178.         echo '<p>An error occured with the transaction. The message has not being sent</p>'."\n";
  179.      }
  180.     }
  181. }
  182. ?>

Make sure that CaptchaSecurityImages.php and monofont.ttf are in the same directory as this file... (I named it mail.php at this example... if you want to change it just change the action at the form...

Hope that this helped you out...

[EDIT] If you copy/paste from here it may give you the line numbers at the beginning... to get the whole thing correctly, quote me and copy the code like that... (I think you know what I mean by that :) )

[EDIT 2] A function was added to the "thing". Also, it's a bit different from the one I sent to you VIA PM.
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.

Post May 13th, 2008, 9:36 pm

Thanks radnor and bogey, you guys have been very helpfull.

im only have one small problem. It works fine in I.E but as soon as you try it with FF it won't work. You can 'submit' the message without enterting a security code. Any one know why??
  • radnor
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Mar 06, 2006
  • Posts: 40
  • Status: Offline

Post May 14th, 2008, 4:21 am

Bogey,

If you use FF, could you test it too, please. you will see 3 required fields fill something in for them and hit send. I just tried it with vista and ff & ie and it works. WITHOUT the security code, it should clear the form and redisplay the contact us page.

Thanks,

Radnor

I dont know if is a cache issue COL is having
  • Bogey
  • Disturbed
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 7127
  • Loc: Ozzuland
  • Status: Offline

Post May 14th, 2008, 7:51 am

radnor wrote:
Bogey,

If you use FF, could you test it too, please. you will see 3 required fields fill something in for them and hit send. I just tried it with vista and ff & ie and it works. WITHOUT the security code, it should clear the form and redisplay the contact us page.

Thanks,

Radnor

I dont know if is a cache issue COL is having

You want me to test his form?
Learn PHP | I got 10 PHP tutorials! Check them out!
Dreamtale - Farewell
Just a note... I've giving up on web development and that stuff... Just lost all interest in it.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 14th, 2008, 7:51 am

Post Information

  • Total Posts in this topic: 26 posts
  • Users browsing this forum: No registered users and 157 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.