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

    captcha asp aiuto per favore

    Ciao a tutti torno a scrivere su questo forum chiaramente perchè ho un problema.....

    sto risistemando un sito che ho fatto ed ho un problema con dello spam per i commenti.

    ho trovato questo captcha http://www.tipstricks.org/ che mi sembra ben fatto, integro fino ad un certo punto e poi mi blocco

    praticamente quando faccio l'inserimento con il pulsante submit, mi fa l'action del form e inserisce ma non controlla il captcha oppure se tolgo l'action del form controllo il captcha ma non fa l'inserimento come posso risolvere??

    vi inserisco il codice delle sue pagine incriminate.

    grazie a tutti

  2. #2
    <%@ language="VBScript" %>
    <% Option Explicit %>
    <%dim conn
    dim rs

    dim filepath
    dim provider
    dim ilfile
    dim file
    dim counter
    dim illine

    set conn = Server.CreateObject("ADODB.Connection")
    Set RS = Server.CreateObject("ADODB.Recordset")

    'Percorso fisico del file MDB
    filepath=server.mappath("mdb-database\db.mdb")
    provider="provider=microsoft.jet.oledb."

    'Selezione del Provider OLEDB indicato dall'utente
    provider=provider & "4.0"

    Conn=provider & ";data source=" & filepath
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="it">
    <head>
    <title>Katinka Travel</title>


    <script type="text/javascript">

    function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
    var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
    var int_windowTop = (screen.height - a_int_windowHeight) / 2;
    var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
    var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4) {
    obj_window.window.focus();
    }
    }
    </script>

    <script type="text/javascript" language="javascript">
    function RefreshImage(valImageId) {
    var objImage = document.getElementById(valImageId)
    if (objImage == undefined) {
    return;
    }
    var now = new Date();
    objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
    }
    </script>

    </head>
    <body>
    <form method="post" name="form1" id="form1" action="guestbook_sabrinapaolo.asp">
    <table align="center" cellpadding="0" cellspacing="0">
    <tr>

    <td class="top" colspan="4">
    </td>
    </tr>
    <tr>

    <td class="sx">
    </td>
    <td valign="top">

    <table class="contenitore" align="center" cellpadding="0" cellspacing="0">

    <tr>
    <td id="vuotosx">
    </td>
    <td id="bgmenu">


    </td>
    </tr>


    <tr>
    <td class="colsx" align="center" valign="top">

    </td>
    <td class="bgcorpo" valign="top">
    <table cellpadding="10" cellspacing="0" class="corponozze">

    <tr>
    <td>
    <table cellspacing="0" cellpadding="2" border="0">
    <tr>
    <td>
    <h3>
    Lascia un commento</h3>
    </td>
    </tr>
    <tr>
    <td>
    Il tuo nome
    </td>
    </tr>
    <tr>
    <td>
    <input type="text" name="nome" maxlength="60" size="20" />
    </td>
    </tr>
    <tr>
    <td>
    Inserisci il messaggio
    </td>
    </tr>
    <tr>
    <td>
    <textarea name="messaggio" rows="5" cols="60"></textarea>
    </td>
    </tr>
    <tr>
    <td>
    <%
    if Request.ServerVariables("REQUEST_METHOD") = "POST" and IsEmpty(Request.Form("btnRetry")) then
    Dim lblResult, lblColor
    if IsEmpty(Session("ASPCAPTCHA")) or Trim(Session("ASPCAPTCHA")) = "" then
    lblResult = "This test has expired."
    lblColor = "red"
    else
    Dim TestValue : TestValue = Trim(Request.Form("txtCaptcha"))
    '//Uppercase fix for turkish charset//
    TestValue = Replace(TestValue, "i", "I", 1, -1, 1)
    TestValue = Replace(TestValue, "I", "I", 1, -1, 1)
    TestValue = Replace(TestValue, "i", "I", 1, -1, 1)
    '////////////////////
    TestValue = UCase(TestValue)

    if StrComp(TestValue, Trim(Session("ASPCAPTCHA")), 1) = 0 then
    lblResult = "CAPTCHA PASSED"
    lblColor = "green"
    else
    lblResult = "CAPTCHA FAILED"
    lblColor = "red"
    end if
    '//IMPORTANT: You must remove session value for security after the CAPTCHA test//
    Session("ASPCAPTCHA") = vbNullString
    Session.Contents.Remove("ASPCAPTCHA")
    '////////////////////
    end if
    %>


    <span style="color: <%=lblColor%>; font-weight: bold;"><%=lblResult%></span></p>
    <input type="submit" name="btnRetry" id="btnRetry" value="Take another test" />
    <%else%>
    [img]captcha.asp[/img]Get a new challenge

    Write the characters in the image above

    <input type="text" name="txtCaptcha" id="txtCaptcha" value="" />


    <%end if%>
    </td>
    </tr>
    <tr>
    <td>
    <input type="submit" value="Firma il Guestbook"/>
    </td>
    </tr>
    <tr>
    <td>

    </td>
    </tr>
    <tr>
    <td>
    <h3>
    Elenco dei messaggi</h3>
    </td>
    </tr>
    </table>
    <%dim strsql
    strsql= "SELECT * FROM commenti_sabrinapaolo ORDER BY id DESC"
    rs.open strsql,conn,3,3
    If rs.EOF Then
    %>



    Non ci sono messaggi...</p>


    <%
    Else
    While rs.EOF = False
    %>
    <table cellspacing="0" cellpadding="3" border="0">
    <tr>
    <td>
    <%=rs("nome")%><%Response.Write rs("dataora")%>
    </td>
    </tr>
    <tr>
    <td>
    <%=rs("messaggio")%>
    </td>
    </tr>
    </table>
    <hr />
    <%
    rs.MoveNext
    Wend
    End If
    rs.Close
    %>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </td>

    <td class="dx">
    </td>
    </tr>

    <tr>
    <td colspan="3">

    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

  3. #3
    <%@ Language=VBScript %>
    <% Option Explicit %>
    <%dim conn
    dim rs

    dim filepath
    dim provider

    set conn = Server.CreateObject("ADODB.Connection")
    Set RS = Server.CreateObject("ADODB.Recordset")

    'Percorso fisico del file MDB
    filepath=server.mappath("mdb-database\db.mdb")
    provider="provider=microsoft.jet.oledb."

    'Selezione del Provider OLEDB indicato dall'utente
    provider=provider & "4.0"

    Conn=provider & ";data source=" & filepath
    %>
    <html>
    <head>
    <title>Katinka Travel</title>
    <link rel="stylesheet" href="style.css" type="text/css" />
    <link rel="stylesheet" href="style_testo_contorno.css" type="text/css" />
    <link rel="stylesheet" href="slider.css" type="text/css" />
    </head>
    <body>
    <%
    Dim nome, messaggio,strsql
    nome = Request.Form("nome")
    messaggio = Request.Form("messaggio")
    If nome = "" Or messaggio = "" Then
    %>
    <table cellpadding="0" cellspacing="5" border="0" align="center">
    <tr>
    <td align="center">
    [img]img/logo.png[/img]
    </td>
    </tr>
    <tr>
    <td>
    <h3>
    Attenzione: tutti i campo sono obbligatori!</h3>
    </td>
    </tr>
    <tr>
    <td align="center">
    Torna indietro
    </td>
    </tr>
    </table>
    <%
    Else
    strsql="insert into commenti_sabrinapaolo (nome,messaggio,dataora) values('" & replace(nome,"'","''") & "', '" & replace(messaggio,"'","''") & "', '" & now() & "')"
    rs.Open strsql,conn,3,3

    %>
    <table cellpadding="0" cellspacing="5" border="0" align="center">
    <tr>
    <td align="center">
    [img]img/logo.png[/img]
    </td>
    </tr>
    <tr>
    <td>
    <h3>
    Messaggio inserito con successo!
    </h3>
    </td>
    </tr>
    <tr>
    <td align="center">
    Torna indietro
    </td>
    </tr>
    </table>
    <%
    End If
    %>
    </body>
    </html>
    <%

    %>

  4. #4
    Magari a qualcuno interessa

    HO RISOLTOOOOOOOOO!!!!!

    come potete notare dal codice l'inserimento nel db lo fa nella pagina guestbook richiamata nell'action del form.

    ho risolto togliendo l'action del form e facendo inserire i dati nel db all'interno della pagina dove controlla il captcha, e così funziona.

    adesso la pagina è on line nella speranza che funzioni questo captcha e che non mi arrivi più spam.

    Ciao
    Mario

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.