[Phpwm] Captcha Help

Matt McConnochie mattscouch at hotmail.co.uk
Wed Apr 18 12:52:31 BST 2007


Hi all - firstly thanks to those who pointed me in the correct direction for 
Captcha's. I think i am nearly there in incorporating this into our current 
form on our 'contact us' page.

The email addy on the form is a required field . I want the captcha to be 
required also but i seem to have a problem that the captcha can be bypassed. 
I have included most of the code below  so any thoughts / ammendements would 
be useful.

To summarize - i need a single click on the 'submit' to check the captcha 
and user entered email and if all is well with the form to post this so us. 
I think it could be something like the input types for the form.

Any help would be greatly appreciated

Mr Noob :)

----------------------------------------code used 
currently----------------------------------------

<div style="width: 400px; margin: auto; border: 1px inset gray; background: 
#eeeeee;">
    <?php if($valid == "false" && $send == "true") { ?>
	<div style="margin: 3px; color: red;">Unfortunately your message has not 
been sent as we were unable to verify your email address.  Please check that 
you have typed it correctly...</div>
    <?php } ?>
    <?php if($valid == "true") { ?>
	<div style="margin: 3px; color: red;">Thank you.  Your message has been 
sent...<br />We have sent you a copy for your records.</div>
    <?php } ?>
	<form method="post" action="contact.php">
      <div style="margin: 5px; padding: 2px; background: white; border: 1px 
inset gray;">
  		<div style="float: left; width: 150px; text-align: left; padding: 3px 
0px;">To: </div>
  		<div style="text-align: left; padding: 3px 0px;"><select name="to">
		  <option value="1" <?php if($to == "Sales") echo "seleceted" 
?>>Sales</option>
		  <option value="2" <?php if($to == "Support") echo "seleceted" 
?>>Support</option>
		  <option value="3" <?php if($to == "General enquiries") echo "seleceted" 
?>>General enquiries</option>
		</select></div>
  		<div style="float: left; width: 150px; text-align: left; padding: 3px 
0px;">
  		Name:<em style="font-size: 0.9em;"></em></div>
  		<div style="text-align: left; padding: 3px 0px;">
  		<input type="text" size="30" style="vertical-align: middle;" 
name="f_name"<?php if($ps_user_id > 100) { echo " value=\"$ps_name\"";} else 
{ echo " value=\"$f_name\""; } ?> /></div>
  		<div style="float: left; width: 150px; text-align: left; padding: 3px 
0px;">
  		E-Mail*:</div>
  		<div style="text-align: left; padding: 3px 0px;">
  		<input type="text" size="30" style="vertical-align: middle;" 
name="f_email"<?php if($ps_user_id > 100) {
  			$result = RunQry("SELECT email FROM users WHERE id = '$ps_user_id'");
			list($email) = mysql_fetch_row($result);
			echo " value=\"$email\""; } else { echo " value=\"$f_email\""; }?> />
		</div>
	  </div>
  	  <div class="formLine"><textarea name="msg" cols="45" rows="10"><?php 
echo $message; ?></textarea></div>
	  <?php if($ps_user_id == "100") { ?>
  	  <div class="formLine"><input name="permission" type="checkbox" 
value="1" /> Would you like to receive a copy of our newsletter?</div>
	  <?php } ?>
	  <div id="captcha">
	<p><img src="captcha.php" />
</p>
	  <form id="captchaform" action="<?php echo $PHP_SELF ?>" method="post">
		<p><label for="code">Enter Above Code: </label><input type="text" 
name="code" id="code" /></p>

  	  <div class="formLine" style="text-align: center;">
	  	<input type="hidden" name="keywords" value="<?php echo 
$_POST["keywords"]; ?>" />
		<input type="hidden" name="submit" value="<?php if($errore == 1){ ?>   <p 
class="errore">The code you inserted was not correct .<br /> <a href="<?php 
echo $PHP_SELF ?>">Click here to generate a new Captcha code and try 
again</a></p> <?php } ?>"/>
		<input type="hidden" name="send" value="true"/>
  		<input type="submit" name="submit" value="Send message..." />


	  </div>
    </form>
  </div>

</td>

_________________________________________________________________
MSN Hotmail is evolving - check out the new Windows Live Hotmail  
http://get.live.com/betas/mail_betas




More information about the Phpwm mailing list