Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12

Discussione: aiuto con captcha

  1. #1

    aiuto con captcha

    Salve a tutti come faccio ad implementare il captcha di questo sito http://www.u229.no/stuff/Captcha/
    in questo file sign del mio guestbook
    ve lo includo

    codice:
    <%
    '--------------------------------
    'This is the main script which will
    'show all the signed entry
    '--------------------------------
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    Conn.ConnectionString = "Data Source=" & Path 
    Conn.Open
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open "SELECT * from guest", Conn, 1,3
    
    if not len(trim(LogoImage))>0 then logo="" else logo="[img]" & LogoImage & "[/img]"
    if not len(trim(BackImage))>0 then back="" else back="background='" & BackImage & "'"	
    
    Rs.Close
    Conn.Close 
    set Rs=nothing
    set Conn=nothing
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>- .:: Benvenuti nel sito web  ::.</title>
    <meta http-equiv="Content-Language" content="it">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <link rel="stylesheet" type="text/css" href="style.css">
    </head>
     ho levato tutto il superfluo...		
    
    	<td>
    			<p align="center">Lasciate un messaggio nel nostro guestbook</td>
    		</tr>
    		<tr>
    			<td>
    			</td>
    		</tr>
    		<tr>
    			<td>
    			<form method="POST" action="add.asp">
      <p align="center"></p>
      <div align="center">
        <center>
        <table border="0" width="428" bgcolor="#ECD0AA" style="border-style: ridge" cellspacing="1">
          <tr>
            <td width="17%" nowrap><font size="1">Nome</font></td>
            <td width="81%"><font size="1" face="Verdana,Arial,sans-serif">
    		<input type="text" name="txtname" size="47"></font></td>
          </tr>
          <tr>
            <td width="17%" nowrap><font size="1">Email </font> </td>
            <td width="81%"><font size="1" face="Verdana,Arial,sans-serif">
    		<input type="text" name="txtemail" size="47"></font></td>
          </tr>
          <tr>
            <td width="17%" nowrap><font size="1">URL</font></td>
            <td width="81%"><font face="Verdana" size="1">
    		<input type="text" name="txturl" size="47" value="http://"></font></td>
          </tr>
          <tr>
            <td width="17%" nowrap valign="top"><font size="1">Commento</font></td>
            <td width="81%">
    		<font size="1" face="Verdana,Arial,sans-serif">
    		<textarea name="txtnote" cols="40" rows="6" wrap="VIRTUAL"></textarea></font></td>
          </tr>
        </table>
        </center>
      </div>
      <p align="center"><input type="submit" value="Firma il guestbook" name="B1"><input type="reset" value="Cancella" name="B2"></p>
    </form>
    ora vi includo il file include

    codice:
     <%
    'This script holds the necessary information such as path of the database, images, etc.
    
    'Path of the database
    Path=server.mappath("/mdb-database/dbsec/guest.mdb")
    
    'Images used by guest book
    'Divider image
    const DivImage="divider.jpg"
    'Background image
    const BackImage="back.jpg"
    'Logo/Banner image
    const LogoImage="logo.jpg"
    
    'If you dont want to use the image, assign the variable with empty string
    'e.g
    'BackImage="" if u dont want to use the background image
    
    'For View.asp
    const RsPage=7 'records per page
    
    %>
    di seguito vi includo il file add
    codice:
    <%
    
    '------------------------------
    'This script just add new entry
    '------------------------------
    name=Request.Form ("txtname")
    email=Request.Form ("txtemail")
    url=Request.Form ("txturl")
    note=Request.Form ("txtnote")
    
    if len(name)<1 then 
    	Response.Write "Inserite il nome"
    	Response.End
    end if
    
    if len(note)<1 then 
    	Response.Write "Inserite il Commento"
    	Response.End
    end if
    
    
    if trim(url)="http://" then url=""
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    Conn.ConnectionString = "Data Source=" & Path 
    Conn.Open
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open "SELECT * from guest", Conn, 1,3
    
    rs.AddNew 
    rs("name")=name
    rs("email")=email
    rs("url")=url
    rs("note")=note
    rs.Update
    
    Rs.Close
    Conn.Close 
    set rs=nothing
    set conn=nothing
    
    Response.Redirect "view.asp"
    %>
    grazie a tutti! sono una frana in asp!!

  2. #2
    Inserisci questo all'inizio della pagina add.asp

    codice:
    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Web Wiz CAPTCHA Demo</title>
    <style type="text/css">
    <!--
    .title {font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; }
    .header {font-family: Arial, Helvetica, sans-serif; font-size: 18px; font-weight: bold; }
    .text {font-size: 12px; font-family: Arial, Helvetica, sans-serif;}
    .small {font-size: 10px}
    body { background-color: #CCCCCC; }
    -->
    </style>
    
                  
                
    
    
      <%
    
    'Above we include the file that checks to see if the security code is correct
    
    'The variable 'blnCAPTCHAcodeCorrect' will be set to true if the security code is entered correctly
    
    If blnCAPTCHAcodeCorrect Then 
    %>
    e chiaramente devi aggiungere un END IF come ultima riga della stessa pagina.

    Nella pagina sign.asp invece devi semplicemente inserire due include nel punto in cui vuoi che appaia captcha (per esempio prima del pulsante di invio)




    </p>
    </center>
    </div>
    <p align="center"><input type="submit" value="Firma il guestbook" name="B1"><input type="reset" value="Cancella" name="B2"></p>
    </form>

    metti la cartella CAPTCHA dove sono collocati i due file add.asp e sign.asp

    Penso dovrebbe andare

  3. #3
    ok ho fatto le modifiche ma adesso il validatore e il pulsante firma il guestbook sono separati, come faccio a metterne uno unico che se ho inserito correttamente le tre lettere mi scrive il guestbook?

  4. #4
    Non capisco cosa intendi con: "... adesso il validatore e il pulsante firma il guestbook sono separati, come faccio a metterne uno unico che se ho inserito correttamente le tre lettere mi scrive il guestbook?"
    Quello che ti ho postato fa sì che se non immetti il codice o se lo immetti sbagliato non ti salva i dati nel db e di conseguenza non ti inserisce il messaggio nel guestbook. Che cos'altro vuoi fare?

  5. #5
    Prima di tutto ti ringrazio della tua pazienza... praticamante non funziona come dici tu anche se io inserisco la validazione giusta non firma il guestbook.. hai qualche link da consigliarmi? ora proverò a cambiare direttamante captcha inserendo quello con le immagini intanto se hai qualche link di aiuto me lo potresti postare? ciaooooo

  6. #6
    Non capisco! Ti assicuro che l'ho provato e funziona alla perfezione per la prova ho realizzato anche il db guest.mdb con la tabella guest e i campi:
    id (contatore chiave primaria)
    name (testo)
    email (testo)
    url (testo)
    note (memo).

    L'unica cosa che non ho fatto è il file view.asp, ma aprendo il database con access si vede benissimo che quando inserisco il codice il record viene aggiunto e quando il codice è errato o mancante non viene aggiunto alcun record al db.

    Ricordati che devi rispettare le maiuscole e minuscole che il codice di autenticazione ti propone.
    Assicurati anche che il validatore di CAPTCHA si trovi all'interno del modulo, lo stesso di dove si trova il pulsante di invio

  7. #7
    ok allora ho combinato un bel casino....
    ora ho implementato nel file sign.asp il controllo captcha con numeri e lettere.. fin qui ci riesco ma il mio problema è inserire la procedura di controllo all'interno del file infatti anche se ometto di scrivere il controllo captcha il guest viene scritto uguale!! ti posto tutti i file e ti prego se puoi controllamelo tu!!
    grazie angelo

    File add.asp
    codice:
                   
       
    
    <%
                If blnCAPTCHAcodeCorrect = True Then
                Response.Write(" CAPTCHA code is correct")
            ElseIf  blnCAPTCHAcodeCorrect = False Then
                Response.Write(" CAPTCHA code is NOT correct")
            End If
    %>
               
    
    <%
    
    '------------------------------
    'This script just add new entry
    '------------------------------
    name=Request.Form ("txtname")
    email=Request.Form ("txtemail")
    url=Request.Form ("txturl")
    note=Request.Form ("txtnote")
    
    if len(name)<1 then 
    	Response.Write "Inserite il nome"
    	Response.End
    end if
    
    if len(note)<1 then 
    	Response.Write "Inserite il Commento"
    	Response.End
    end if
    
    
    if trim(url)="http://" then url=""
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    Conn.ConnectionString = "Data Source=" & Path 
    Conn.Open
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open "SELECT * from guest", Conn, 1,3
    
    rs.AddNew 
    rs("name")=name
    rs("email")=email
    rs("url")=url
    rs("note")=note
    rs.Update
    
    Rs.Close
    Conn.Close 
    set rs=nothing
    set conn=nothing
    
    Response.Redirect "view.asp"
    %>
    file include.asp
    codice:
     <%
    'This script holds the necessary information such as path of the database, images, etc.
    
    'Path of the database
    Path=server.mappath("/mdb-database/dbsec/guest.mdb")
    
    'Images used by guest book
    'Divider image
    const DivImage="divider.jpg"
    'Background image
    const BackImage="back.jpg"
    'Logo/Banner image
    const LogoImage="logo.jpg"
    
    'If you dont want to use the image, assign the variable with empty string
    'e.g
    'BackImage="" if u dont want to use the background image
    
    'For View.asp
    const RsPage=7 'records per page
    
    %>
    file sign.asp
    codice:
     
    
    <%
    '--------------------------------
    'This is the main script which will
    'show all the signed entry
    '--------------------------------
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    Conn.ConnectionString = "Data Source=" & Path 
    Conn.Open
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open "SELECT * from guest", Conn, 1,3
    
    if not len(trim(LogoImage))>0 then logo="" else logo="[img]" & LogoImage & "[/img]"
    if not len(trim(BackImage))>0 then back="" else back="background='" & BackImage & "'"	
    
    Rs.Close
    Conn.Close 
    set Rs=nothing
    set Conn=nothing
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>- .:: Benvenuti nel sito web del PREMIO OLMO ::.</title>
    <meta http-equiv="Content-Language" content="it">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    
    <body>
    
    <div align="center">
      <center>
      <table class="tabella1" cellspacing="0" cellpadding="0" style="background-color: #FFFFAE">
            <tr>
              <td class="logo" colspan="3">
          [img]images/banner.jpg[/img]</td>
            </tr>
            <tr>
              <td class="tbx">
          </td>
              <td class="tbx1">
    			<p align="right">:: <a href="../index.htm">
    			Home </a> </td>
              <td class="tbx2">:: Contatti</td>
              </tr>
            <tr>
              <td valign="top" class="main">
          <table class="tabella2" cellspacing="0" cellpadding="0">
    		<tr>
    			<td class="menu"> :: la Fondazione</td>
    		</tr>
    		<tr>
    			<td class="menu">:: Antonio De Sisto</td>
    		</tr>
    		<tr>
    			<td class="menu">:: Premio Olmo</td>
    			</tr>
    		<tr>
    			<td class="menu">:: La Manifestazione</td>
    		</tr>
    		<tr>
    			<td class="menu">:: Vincitori</td>
    		</tr>
    		<tr>
    			<td class="menu">:: Dicono di noi...</td>
    		</tr>
    		<tr>
    			<td class="menu">:: Dove siamo</td>
    		</tr>
    		<tr>
    			<td class="menu">:: <a href="../comunicatistampa.htm">
    			Comunicazioni</a></td>
    		</tr>
    		<tr>
    			<td></td>
    </tr>
    		<tr>
    			<td></td>
    </tr>
    		<tr>
    			<td>
    			<p align="center">
    			[img]images/raviscanina-logo.gif[/img]</td>
    </tr>
    		<tr>
    			<td>
    			<p align="center">
    			</td>
    </tr>
    		<tr>
    			<td>
    			<p align="center">
    			<a href="http://validator.w3.org/check?uri=http://www.premioolmo.it/gb/sign.asp">
    			[img]images/valid-html401.gif[/img]</a></td>
    </tr>
    		<tr>
    			<td>
    			<p align="center">
    			</td>
    </tr>
    		<tr>
    			<td>
        <p align="center">
    	<a href="http://jigsaw.w3.org/css-validator/validator?uri=http://www.premioolmo.it/gb/sign.asp">
    	[img]images/vcss.gif[/img]</a></td>
    </tr>
    		</table>
    			</td>
              <td valign="top" class="main1" style="background-color: #FFFFAE">
          <table class="tabella3" cellspacing="0" cellpadding="0">
    		<tr>
    			<td>
    			<p align="center">Lasciate un messaggio nel nostro guestbook</td>
    		</tr>
    		<tr>
    			<td>
    			</td>
    		</tr>
    		<tr>
    			<td>
    			<form method="POST" action="add.asp">
      <p align="center"></p>
      <div align="center">
        <center>
        <table border="0" width="428" bgcolor="#ECD0AA" style="border-style: ridge" cellspacing="1">
          <tr>
            <td width="17%" nowrap><font size="1">Nome</font></td>
            <td width="81%"><font size="1" face="Verdana,Arial,sans-serif">
    		<input type="text" name="txtname" size="47"></font></td>
          </tr>
          <tr>
            <td width="17%" nowrap><font size="1">Email </font> </td>
            <td width="81%"><font size="1" face="Verdana,Arial,sans-serif">
    		<input type="text" name="txtemail" size="47"></font></td>
          </tr>
          <tr>
            <td width="17%" nowrap><font size="1">URL</font></td>
            <td width="81%"><font face="Verdana" size="1">
    		<input type="text" name="txturl" size="47" value="http://"></font></td>
          </tr>
          <tr>
            <td width="17%" nowrap valign="top"><font size="1">Commento</font></td>
            <td width="81%">
    		<font size="1" face="Verdana,Arial,sans-serif">
    		<textarea name="txtnote" cols="40" rows="6" wrap="VIRTUAL"></textarea></font></td>
          </tr>
        </table>
        </center>
      </div>
       
       
      <p align="center">  
      <input type="submit" value="Firma il guestbook" name="B1"><input type="reset" value="Cancella" name="B2"></p>
    </form>
    
    </td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		</table>
    			</td>
              <td  valign="top" class="main2">
          <table class="tabella4" cellspacing="0" cellpadding="0">
    		<tr>
    			<td></td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		<tr>
    			<td></td>
    		</tr>
    		</table>
    				</td>
            </tr>
            <tr>
              <td valign="middle" class="down1">
          </td>
              <td valign="middle" class="down2">
          <p align="center">Copyright © 2005 Fondazione A. De Sisto - Premio Olmo.</td>
              <td valign="middle" class="down">
          :: <font color="#000000">Webmaster</font></td>
            </tr>
            </table>
      </center>
    </div>
    </body>
    </html>
    file CAPTCHA_form_inc.asp
    codice:
     
    <script language="javaScript">
    function reloadCAPTCHA() {
    	document.getElementById('CAPTCHA').src='CAPTCHA_image.asp?'+Date();
    }
    
    </script>           
    <table width="100%" border="0" cellspacing="1" cellpadding="3">
     <tr>
      <td>[img]CAPTCHA_image.asp[/img]<% = strTxtLoadNewCode %></td>
     </tr>
     <tr>
      <td><input type="text" name="securityCode" id="securityCode" size="12" maxlength="12" autocomplete="off" /></td>
     </tr><%
    
    
    If blnCAPTCHAabout Then
    	Response.Write("<tr><td><span style=""font-size: 10px; font-family: Arial, Helvetica, sans-serif;"">Powered by Web Wiz CAPTCHA  version " & strCAPTCHAversion & "
    Copyright &copy;2006 Web Wiz Guide</span></td></tr>")
    End If 
        
          %>
    </table>
    File CAPTCHA_setup.asp

    codice:
    'Initialise variables
    Dim blnCAPTCHAabout
    
    
    
    '*****  Change this if to false if you do NOT want the CAPTCHA code to be case sensitive *****
    Const blnCAPTCHAcaseSensitive = true
    
    
    '*****  Change this if tyou wish to chnage the reload image text *****
    Const strTxtLoadNewCode = "Load New Code"
    
    
    '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
    Const strCAPTCHAversion = "2.01"
    blnCAPTCHAabout = blnLCode
    '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******    
    
    %>

  8. #8
    Pagina add.asp
    codice:
                  
                  
    
    
     <%
    
    'Above we include the file that checks to see if the security code is correct
    
    'The variable 'blnCAPTCHAcodeCorrect' will be set to true if the security code is entered correctly
    
    If blnCAPTCHAcodeCorrect Then   
    %>  
    
    <%
    
    '------------------------------
    'This script just add new entry
    '------------------------------
    name=Request.Form ("txtname")
    email=Request.Form ("txtemail")
    url=Request.Form ("txturl")
    note=Request.Form ("txtnote")
    
    if len(name)<1 then 
    	Response.Write "Inserite il nome"
    	Response.End
    end if
    
    if len(note)<1 then 
    	Response.Write "Inserite il Commento"
    	Response.End
    end if
    
    
    if trim(url)="http://" then url=""
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    Conn.ConnectionString = "Data Source=" & Path 
    Conn.Open
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open "SELECT * from guest", Conn, 1,3
    
    rs.AddNew 
    rs("name")=name
    rs("email")=email
    rs("url")=url
    rs("note")=note
    rs.Update
    
    Rs.Close
    Conn.Close 
    set rs=nothing
    set conn=nothing
    
    
    %>
    
    <%
    '***************************************************
    '*            Se il codice è esatto                *
    '***************************************************
    
    
    
    Response.Redirect "view.asp"
    %>
    </a> 
    <%
    '***************************************************
    '*                             Se il codice è errato                                *
    '***************************************************
    
    Else
    
    
    Response.Redirect "sign.asp"
    
    
    End If 
    %>
    Puoi mettere una pagina di avviso codice errato che chiamerai per esempio errato.asp
    Nella pagina puoi scrivere per esempio
    Response.Write ("Il Codice inserito è errato! ecc... ecc ...")
    dovrai in questo caso sostituire
    Response.Redirect "sign.asp"
    con
    Response.Redirect "errato.asp"


    Pagina sign.asp

    codice:
    <%
    '--------------------------------
    'This is the main script which will
    'show all the signed entry
    '--------------------------------
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    Conn.ConnectionString = "Data Source=" & Path 
    Conn.Open
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open "SELECT * from guest", Conn, 1,3
    
    if not len(trim(LogoImage))>0 then logo="" else logo="[img]" & LogoImage & "[/img]"
    if not len(trim(BackImage))>0 then back="" else back="background='" & BackImage & "'"	
    
    Rs.Close
    Conn.Close 
    set Rs=nothing
    set Conn=nothing
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>- .:: Benvenuti nel sito web  ::.</title>
    <meta http-equiv="Content-Language" content="it">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <link rel="stylesheet" type="text/css" href="style.css">
    </head>
     ho levato tutto il superfluo...		
    
    	<td>
    			<p align="center">Lasciate un messaggio nel nostro guestbook</td>
    		</tr>
    		<tr>
    			<td>
    			 </td>
    		</tr>
    		<tr>
    			<td>
    			<form method="POST" action="add.asp">
      <p align="center"></p>
      <div align="center">
        <center>
        <table border="0" width="428" bgcolor="#ECD0AA" style="border-style: ridge" cellspacing="1">
          <tr>
            <td width="17%" nowrap><font size="1">Nome</font></td>
            <td width="81%"><font size="1" face="Verdana,Arial,sans-serif">
    		<input type="text" name="txtname" size="47"></font></td>
          </tr>
          <tr>
            <td width="17%" nowrap><font size="1">Email </font> </td>
            <td width="81%"><font size="1" face="Verdana,Arial,sans-serif">
    		<input type="text" name="txtemail" size="47"></font></td>
          </tr>
          <tr>
            <td width="17%" nowrap><font size="1">URL</font></td>
            <td width="81%"><font face="Verdana" size="1">
    		<input type="text" name="txturl" size="47" value="http://"></font></td>
          </tr>
          <tr>
            <td width="17%" nowrap valign="top"><font size="1">Commento</font></td>
            <td width="81%">
    		<font size="1" face="Verdana,Arial,sans-serif">
    		<textarea name="txtnote" cols="40" rows="6" wrap="VIRTUAL"></textarea></font></td>
          </tr>
        </table>
        
    
    
        
         
        
        
        </p>
        </center>
      </div>
      <p align="center"><input type="submit" value="Firma il guestbook" name="B1"><input type="reset" value="Cancella" name="B2"></p>
    </form>
    Prova e fai sapere

  9. #9
    ok ora sia che è sbagliato sia che sia esatto non scrive sul db proprio nulla!!
    praticamente torna sempre alla pagina sign.asp
    non so proprio come fare, come posso postare un file zip di modo che me lo controlli per cortesia stò andando ai pazzi!!

  10. #10
    Originariamente inviato da artorius78
    ok ora sia che è sbagliato sia che sia esatto non scrive sul db proprio nulla!!
    praticamente torna sempre alla pagina sign.asp
    non so proprio come fare, come posso postare un file zip di modo che me lo controlli per cortesia stò andando ai pazzi!!
    Ti ho rinviato lo script con le stesse modifiche che ti avevo suggerito e funziona.

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.