HTML.it è il sito italiano del web publishing

reCAPTCHA e ASP JScript



scegli un altro forum
    Indietro   Ricarica   Avanti Invia una risposta

Autore
Discussione     
kemin
Utente di HTML.it



Registrato il: Jan 2005

Provenienza:

Messaggi: 35


ICQ:

MSN:

Skype:


reCAPTCHA e ASP JScript
Salve, qualcuno mi sa dire come posso convertire il codice del reCaptcha mostrato in questa pagina https://developers.google.com/recaptcha/docs/asp in JScript? Devo adattarlo su una pagina di un sito scritto in ASP JScript.

Grazie in anticipo.

Allego il codice:
codice:
<%
  recaptcha_challenge_field  = Request("recaptcha_challenge_field")
  recaptcha_response_field   = Request("recaptcha_response_field")
  recaptcha_public_key       = "your_public_key" ' your public key
  recaptcha_private_key      = "your_private_key" ' your private key

  ' returns the HTML for the widget
  function recaptcha_challenge_writer()

  recaptcha_challenge_writer = _
  "<script type=""text/javascript"">" & _
  "var RecaptchaOptions = {" & _
  "   theme : 'red'," & _
  "   tabindex : 0" & _
  "};" & _
  "</script>" & _
  "<script type=""text/javascript"" src=""http://www.google.com/recaptcha/api/challenge?k=" & recaptcha_public_key & """></script>" & _
  "<noscript>" & _
    "<iframe src=""http://www.google.com/recaptcha/api/noscript?k=" & recaptcha_public_key & """ frameborder=""1""></iframe><>" & _
      "<textarea name=""recaptcha_challenge_field"" rows=""3"" cols=""40""></textarea>" & _
      "<input type=""hidden"" name=""recaptcha_response_field""value=""manual_challenge"">" & _
  "</noscript>"

  end function

  ' returns "" if correct, otherwise it returns the error response
  function recaptcha_confirm(rechallenge,reresponse)

  Dim VarString
  VarString = _
          "privatekey=" & recaptcha_private_key & _
          "&remoteip=" & Request.ServerVariables("REMOTE_ADDR") & _
          "&challenge=" & rechallenge & _
          "&response=" & reresponse

  Dim objXmlHttp
  Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
  objXmlHttp.open "POST", "http://www.google.com/recaptcha/api/verify", False
  objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  objXmlHttp.send VarString

  Dim ResponseString
  ResponseString = split(objXmlHttp.responseText, vblf)
  Set objXmlHttp = Nothing

  if ResponseString(0) = "true" then
    'They answered correctly
     recaptcha_confirm = ""
  else
    'They answered incorrectly
     recaptcha_confirm = ResponseString(1)
  end if

  end function

  server_response = ""
  newCaptcha = True
  if (recaptcha_challenge_field <> "" or recaptcha_response_field <> "") then
    server_response = recaptcha_confirm(recaptcha_challenge_field, recaptcha_response_field)
    newCaptcha = False
  end if

  %>

Segnala ad un moderatore | IP: Collegato | Permalink

kemin è offline Old Post 13-06-2012 22:09
Clicca qui per vedere il profilo dell'utente kemin Clicca qui per inviare all'utente kemin un messaggio privato Visualizza ulteriori messaggi scritti dall'utente kemin Aggiungi l'utente kemin alla tua lista degli utenti amici Modifica / Cancella il messaggio Rispondi quotando   Torna su
kemin
Utente di HTML.it



Registrato il: Jan 2005

Provenienza:

Messaggi: 35


ICQ :

MSN :

Skype :


nessuno può aiutarmi?

Segnala ad un moderatore | IP: Collegato | Permalink

kemin è offline Old Post 27-06-2012 13:35
Clicca qui per vedere il profilo dell'utente kemin Clicca qui per inviare all'utente kemin un messaggio privato Visualizza ulteriori messaggi scritti dall'utente kemin Aggiungi l'utente kemin alla tua lista degli utenti amici Modifica / Cancella il messaggio Rispondi quotando   Torna su
Tutte le ore sono con fuso orario CET. Ora sono le 17:18.     

    Ultima discussione   Prossima discussione Invia una risposta
Versione per la stampa | Invia il thread via email | Ricevi aggiornamenti sul thread | Scarica il thread
 

Cerchi un argomento specifico e hai fretta? Usa il motore di ricerca