Jump to content

PHP form + captcha


roediej

Recommended Posts

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.

Link to comment
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.