Buongiorno a tutti,
devo implementare in un form il controllo CAPTCHA per questi maledetti spamm.
Purtroppo però non riesco ad implementare il codice. Vi posto il codice:
Codice PHP:
<?
if ($ok=='invia') {
$query="INSERT INTO `text`( `user`, `email`, `testo`, `id_categ` ) VALUES ( '$user', '$email', '$testo', '$categ' ) ";
//echo $query;
if (mysql_query($query)){
header("location:ok.php");
}else{
header("location:ko.php");
}
}
?>
<? if ((isset($cat)) AND (!isset($ok))) { ?>
<form name="form1" method="post" action="inssms.php">
<font size="2" face="Arial, Helvetica, sans-serif">Nick*:
<input name="user" type="text" id="user" size="10" maxlength="10">
Email:
<input name="email" type="text" id="email" size="20" maxlength="30">
Messaggio*:
<input name="testo" type="text" id="testo" size="40" maxlength="255">
Categoria*
<select name="categ" >
<? $query1="SELECT * FROM `categ` ORDER BY id DESC";
$rez1=mysql_query($query1);
while ($row1=mysql_fetch_array($rez1))
{
echo "<option value=\"$row1[categ]\"";
if ($cat==$row1[categ]) {
echo " selected ";
};
echo ">$row1[categ]</option>";
};
?>
</select>
<input name="ok" type="submit" id="ok" value="invia">
<input name="cancella" type="reset" id="cancella" value="cancella">
</font> </p>
</form>
<? } ?>
Mentre il codice chaptcha da inserire è il seguente:
<?php
require_once('recaptchalib.php');
$publickey = "your_public_key"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
L'ho inserito all'interno dei tag <form></form> ma nulla. se compilo i moduli e non considero il codice captcha e clicco invia le informazioni vengono inserite ugualmente.
Come mai?
grazie mille