roediej Posted March 9, 2010 Share Posted March 9, 2010 Hello, On my Dutch webpage http://www.wirdumonline.nl i have right a php script called 'wist je dat'. It's like a guestbook/shoutbox. Since a couple of days ago i get alot of spam on it, so i decide to install captha on it (posting is now disable). But now the big question: how? i want to use the following captcha: http://captcha.fr/index.php?page=34. In the help they said that i have to put the following code in my .php file when he checks if everything is filled in. <?php if (chk_crypt($_POST['code'])) echo "Correct"; else echo "Bad "; ?> In my script you see that he checked if there is a name, or a massage. if not, he gives a warning that something is missing. How can i make this script work inclusive CAPTCHA? Here is a sample: http://wirdumonline.nl/captcha/ The code in verifier.php <?php $cryptinstall="./cryptographp.fct.php"; include $cryptinstall; ?> <html> <? mysql_connect("localhost","***", "***") or die("kan de MySQL server niet selecteren"); mysql_select_db("wirdum_wistjedat") or die("kan de database niet selecteren"); if(isset($_POST['submit']) && isset($_POST['bericht'])) { ; $ip = $_SERVER['REMOTE_ADDR']; $datum = date("d-m-Y"); $tijd = date("H:i:s"); $bericht = ($_POST['bericht']); $naam = $_POST['naam']; if($naam == "") { $error = "<font color='red' <br>Je bent je naam vergeten.</font>"; } elseif ($bericht == "") { $error = "<font color='red'<br>Je wist je dat berichtje mist</font>"; } else { $bericht = addslashes($bericht); $query = mysql_query("INSERT INTO wistjedat2 VALUES ('','$bericht', '$ip', '$tijd', '$datum', '$naam')") or die(mysql_error()); echo "<meta http-equiv='refresh' content='0; url=http://www.wirdumonline.nl/' /> " ; /* Stuur de browser naar de PHP website */ exit; /* Zorg dat de code hieronder niet wordt uitgevoerd */ } } ?> </html> The form <?php $cryptinstall="./cryptographp.fct.php"; include $cryptinstall; ?> <html> <div align="center"> <form action="verifier.php?<?PHP echo SID; ?>" method="post"> <strong> Naam..</strong><br> <input name="naam" type="text" class="input" value="" size="10" maxlength="5"> <strong> Wist je dat..</strong><br> <input name="bericht" type="text" class="input" value="" size="35" maxlength="50"> <table cellpadding=1> <tr><td align="center"><?php dsp_crypt(0,1); ?></td></tr> <tr><td align="center">Neem de code over:<br><input type="text" name="code"></td></tr> <tr><td align="center"><input type="submit" name="submit" value="Stuur"></td></tr> </table> </form> </div> </html> Hope you understand me thanks. Quote Link to comment https://forums.phpfreaks.com/topic/194599-php-form-captcha/ Share on other sites More sharing options...
bigleo Posted March 26, 2010 Share Posted March 26, 2010 did you solve this or can I still help Quote Link to comment https://forums.phpfreaks.com/topic/194599-php-form-captcha/#findComment-1032462 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.