Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Come inserire il Captcha

    Salve
    Sono uno dei tanti che ha un guestbook che ultimamente è afflitto dallo spam.

    A questo punto ho scelto come soluzione quella della immissione da parte di chi scrive, nel momento in cui inserisce il messaggio, di un codice numerico da copiare generato in automatico, il Captcha.

    Ho già cercato qui sul forum come fare, ma non so se per mia incapacità o cosa, non sono riuscito a trovare il modo in cui inserire il suddetto captcha in maniera pratica nel codice del mio guestbook.

    Il mio guestbook è raggiungibile a questo indirizzo:
    http://www.u2bad.com/community/guestbook/index.php

    Grazie mille in anticipo
    MrBoh

  2. #2
    Utente di HTML.it L'avatar di chris
    Registrato dal
    Sep 1999
    Messaggi
    1,568
    Provato a cercare una classe che generi il captcha su phpclasses.org?
    "Nei prossimi tre anni col mio governo vogliamo vincere anche il cancro, che colpisce ogni anno 250.000 italiani e riguarda quasi due milioni di nostri concittadini"

  3. #3
    si ho controllato e ce ne sono vari... ma non ho capito come inserirli nelle mie pagine php, in quali e dove...

    mrBoh

  4. #4
    Questo è il codice della mia pagina di "sign" del guestbook... come e dove devo inserire il codice Captcha?

    <?php

    include ($_SERVER['DOCUMENT_ROOT'] . '/config.inc.php');

    if ($trashnow == 'false') {
    header("Location: index.php");
    }

    $gb_user_ip = $REMOTE_ADDR;
    $gb_user_host = @getHostByAddr($REMOTE_ADDR);
    $gb_user_agent = $HTTP_USER_AGENT;
    $gb_user_lang = substr($HTTP_ACCEPT_LANGUAGE, 0, 2);
    if (!$gb_user_lang) {$gb_user_lang = 'en';}

    include('config.php');

    $conf_magicquotes = get_magic_quotes_gpc();
    if (!$gb_lang_installed) {$gb_langpath = 'lang/en.php';}
    if (eregi($gb_user_lang, $gb_lang_installed)) {
    @include('lang/' . $gb_user_lang . '.php');
    } else {
    @include($gb_langpath);
    }

    session_start();
    if (!$PHPSESSID) {
    session_register('gb_parole_try');
    } elseif (!$gb_parole_try) {
    session_register('gb_parole_try');
    }

    if (($gb_flood_ip == $gb_user_ip) && (abs(time() - $gb_flood_last) < ($gb_flood_min * 60))) {
    $gb_flooding = 'true';
    } else {
    $gb_flooding = NULL;
    }
    echo $testme;

    function format_entries($reval) {
    if ($reval) {
    global $gb_tags, $gb_entrymaxlength;
    $reval = trim($reval);
    $reval = strip_tags($reval, $gb_tags);
    if (strlen($reval) > $gb_entrymaxlength) {
    $reval = substr($reval, 0, $gb_entrymaxlength);
    $reval .= $m_maxchars;
    }
    $reval = str_replace(" ", " ", $reval);
    $reval = str_replace("\n ", "\n", $reval);
    }
    return $reval;
    }

    function format_wordlength($text) {
    global $gb_entrywordlength;
    $text_array = split (Chr(32), $text);
    for ($i=0; $i < sizeof($text_array); $i++) {
    if (strlen($text_array[$i]) > $gb_entrywordlength) {
    $text_array[$i] = substr($text_array[$i], 0, $gb_entrywordlength);
    }
    }
    $text = implode(Chr(32), $text_array);
    return $text;
    }

    function format_entrylength($entryval, $entrylength) {
    if (!$entrylength) {
    $entrylength == 40;
    }
    if (strlen($entryval) < $entrylength) {
    $entryval = substr($entryval, 0, $entrylength);
    }
    return $entryval;
    }

    if (strlen(format_entries($gb_entry_text)) < $gb_entryminlength) {
    $gb_entry_text = NULL;
    }
    if (($todo == 'add') && ($gb_flooding)) {
    $msg = "<p class=\"messagetext\">$m_signedalready
    </p>

    <a class=\"buttonview\" href=\"index.php\">Back</a>
    </p>";

    } elseif ($todo == 'add' && ($gb_entry_text)) {

    $gb_entry_date = date("Y-m-d H:i:s");

    if (!eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\\.)+[a-z]{2,4}$", $gb_email)) {
    $gb_email = NULL;
    }
    if ($gb_homepage == 'http://') {
    $gb_homepage = NULL;
    }
    if (!eregi("^http://[_a-z0-9-]+\\.[_a-z0-9-]+", $gb_homepage)) {
    $gb_homepage = NULL;
    }

    if (!$gb_fullname) {
    $gb_fullname = $gb_noname;
    }
    $gb_fullname = format_entries($gb_fullname);
    $gb_fullname = format_entrylength($gb_fullname, 20);
    $gb_sex = format_entries($gb_sex);
    $gb_sex = format_entrylength($gb_sex, 6);
    $gb_location = format_entries($gb_location);
    $gb_location = format_entrylength($gb_location, 20);
    $gb_url = format_entries($gb_url);
    $gb_url = format_entrylength($gb_url, 100);
    $gb_email = format_entries($gb_email);
    $gb_email = format_entrylength($gb_email, 50);
    $gb_entry_text = format_entries($gb_entry_text);
    $gb_entry_text = format_wordlength($gb_entry_text);
    $gb_comment_text = format_entries($gb_comment_text);
    $gb_comment_text = format_wordlength($gb_comment_text);
    $gb_mess_brand = format_entries($gb_mess_brand);
    $gb_mess_brand = format_entrylength($gb_mess_brand, 20);
    $gb_mess_nick = format_entries($gb_mess_nick);
    $gb_mess_nick = format_entrylength($gb_mess_nick, 15);
    $gb_user_pass = md5(session_id() . rand(1, 999) . time());
    setcookie("u2bad[name]", $gb_fullname,time()+1296000, "/community");
    setcookie("u2bad[email]", $gb_email,time()+1296000, "/community");
    setcookie("u2bad[location]", $gb_location,time()+1296000, "/community");




    $link = @mysql_connect ("$sql_host", "$sql_id", "$sql_pass")
    or die ($sql_error);
    @mysql_select_db("$sql_db");

    if ($conf_magicquotes == 0) {
    foreach($GLOBALS as $k=>$v) {
    if (substr_count($k, "gb_") > 0) {
    $GLOBALS[$k] = addslashes($v);
    }
    }
    }

    $insertstring = "INSERT INTO $sql_table(gb_fullname, gb_sex, gb_email, gb_homepage, gb_location, gb_entry_text, gb_entry_date, gb_mess_brand, gb_mess_nick, gb_user_ip, gb_user_host, gb_user_agent, gb_user_lang, gb_user_pass) VALUES " .
    "('$gb_fullname', '$gb_sex', '$gb_email', '$gb_homepage', '$gb_location', '$gb_entry_text', '$gb_entry_date', '$gb_mess_brand', '$gb_mess_nick', '$gb_user_ip', '$gb_user_host', '$gb_user_agent', '$gb_user_lang', '$gb_user_pass');";

    mysql_query($insertstring);
    mysql_close ($link);
    session_register('gb_flood_ip');
    session_register('gb_flood_last');
    $gb_flood_ip = $gb_user_ip;
    $gb_flood_last = time();
    $msg = "<p class=\"messagetext\">" . $gb_fullname . "

    " . $gb_entry_text . "</p>

    <a class=\"buttonview\" href=\"index.php\">$m_back</a>
    </p>";
    $msg = stripslashes($msg);
    $msg = nl2br($msg);

    if (($domain_emailnewentries == 'true') || ($domain_emailguest == 'true')) {
    if (!$gb_email) {
    $gb_emailfrom = $domain_emailadmin;
    } else {
    $gb_emailfrom = $gb_email;
    }
    $mailheaders = 'From: ' . $gb_fullname . ' <' . $gb_emailfrom . ">\n";
    $mailheaders .= 'Reply-To: ' . $gb_fullname . ' <' . $gb_emailfrom . ">\n";
    $gb_sendmail = $domain_title . $m_subject2 . $gb_fullname . "\n";
    $gb_sendmail .= "_________________________________________________ _\n\n";
    $gb_sendmail .= strip_tags(stripslashes($gb_entry_text));
    $gb_sendmail .= "\n\n_____________________________________________ _____\n";
    $gb_sendmail .= 'date: ' . date("Y-m-d H:i:s") . "\n";
    $gb_sendmail .= 'host: ' . $gb_user_host . "\n";
    $gb_sendmail .= 'agent: ' . $gb_user_agent . "\n";
    $gb_sendmail .= 'url: ' . $domain_url . '?uid=' . $gb_user_pass . "\n\n";
    if ($domain_emailnewentries == 'true') {
    @mail($domain_emailadmin, $m_subject1 . $domain_title, $gb_sendmail, $mailheaders);
    }
    if ($domain_emailguest == 'true' && $gb_email != '') {
    $mailheaders = "From: " . $domain_title . " <" . $gb_emailadmin . ">\n";
    $mailheaders .= "Reply-To: " . $domain_title . " <" . $gb_emailadmin . ">\n";
    @mail($gb_email, $m_subject1 . $domain_title, $gb_sendmail, $mailheaders);
    }
    }

    } elseif (($todo == 'add') && (!$gb_entry_text)) {
    $msg = "<p class=\"messagetext\">$m_notext</p>

    <a class=\"buttonview\" href=\"sign.php\">$m_back</a>
    </p>";
    }
    if (($todo == 'trash') && (!$gb_parole_try)) {
    $msg = "<p class=\"messagetext\">$m_trash " . $name . ".";
    $msg .= "
    $m_password

    ";
    $msg .= "<input type=\"hidden\" name=\"todo\" value=\"trash\">";
    $msg .= "<input type=\"hidden\" name=\"gb_parole_status\" value=\"true\">";
    $msg .= "<input type=\"hidden\" name=\"name\" value=\"$name\">";
    $msg .= "<input type=\"hidden\" name=\"id\" value=\"$id\">";
    $msg .= "<input type=\"password\" name=\"gb_parole_try\" maxlength=\"100\"></p>";
    $msg .= "

    <input class=\"buttonsend\" type=\"submit\" value=\"$m_continue\"></p>";
    }

    if (($todo == 'trash') && ($id) && ($gb_parole_try)) {
    if (($gb_parole_try == $gb_parole) || ($gb_parole_try == md5($gb_parole))) {
    if (!$trashnow) {
    $msg = "<p class=\"messagetext\">$m_confirmation
    ";
    $msg .= "<input class=\"radio\" type=\"radio\" name=\"trashnow\" value=\"false\" checked onFocus=\"if(this.blur)this.blur()\">$m_trashkeep $name
    ";
    $msg .= "<input class=\"radio\" type=\"radio\" name=\"trashnow\" value=\"true\" onFocus=\"if(this.blur)this.blur()\">$m_trashnow $name
    </p>

    ";
    $msg .= "<input type=\"hidden\" name=\"todo\" value=\"trash\">";
    $msg .= "<input type=\"hidden\" name=\"id\" value=\"$id\">";
    $msg .= "<input type=\"hidden\" name=\"name\" value=\"$name\">";
    $msg .= "<input class=\"buttonsend\" type=\"submit\" value=\"$m_continue\"></p>";
    } elseif ($trashnow == 'true') {
    $link = @mysql_connect ("$sql_host", "$sql_id", "$sql_pass")
    or die ($sql_error);
    @mysql_select_db("$sql_db");

    $killstring = "DELETE from $sql_table WHERE gb_number='$id';";
    @mysql_query($killstring);
    @mysql_close ($link);
    $msg = "<p class=\"messagetext\">" . $name . " $m_trashdone</p>

    <a class=\"buttonview\" href=\"index.php\">$m_back</a>
    </p>";

    }
    }
    }
    ?>


    grazie
    MrBoh

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.