Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 22
  1. #1

    problema con messaggio output

    ho un problema con uno script semplicissimo di una newsletter..
    praticamente si tratta della conferma di registrazione..
    m'iscrivo, mi arriva la mail clicco sul link della mail e mi manda alla pagina di conferma..
    qui dovrebbe scrivere "Registrazione effettuata" e invece mi dice sempre che devo prima registrarmi! sto diventando scemo perché lo script mi sembra corretto e non capisco perché continui a fare così. Se qualcuno riuscisse a darmi una mano, questo è il sorgente:

    <%@ Language = VBScript %>

    <%
    Email = request.queryString("email")

    'Redirect if the user doesn't belong here
    if len(Email) = 0 then
    response.redirect("http://"&DomainName)
    else

    'Open database
    set con = server.createObject("ADODB.Connection")
    con.open(strServerConnection)

    'Check whether their email is in the database
    sqlString = "Select Email from Newsletter"
    set rs = con.execute(sqlString)

    while not rs.eof

    if trim(rs("Email")) = Email then
    blnFound = true
    end if
    rs.moveNext
    wend

    if blnFound then
    'Set Status value to 1 (true)
    sqlString = "Update Newsletter Set Status = 1 Where Email = '"&Email&"'"
    con.execute(sqlString)

    output = "L'iscrizione è stata confermata." & Email

    else

    output = "Bisogna prima registrarsi."


    end if

    end if
    %>
    fe..feu!!!

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Non c'è bisogno di scorrere tutto il db per sapere se c'è l'email.


    codice:
    'Check whether their email is in the database
    sqlString = "Select Email from Newsletter Where Email = '"&Email&"'"
    set rs = con.execute(sqlString)
    blnFound = false
    if not rs.eof
    blnFound = true
    end if
    Set rs = nothing

    Roby

  3. #3
    non va..
    anzi mi da proprio errore.. probabilmente l'ho riscritta male, ma non credo.. cmq il problema non è con il database perché lo status lo aggiorna quindi l'update del database lo fa, solo che poi manda sempre lo stesso messaggio.. :master:
    fe..feu!!!

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    if not rs.eof then

  5. #5
    ora funziona come prima.. dà sempre lo stesso messaggio..
    fe..feu!!!

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Se il db lo aggiorna correttamente sbagli quando stampi la variabile "output".

    Roby

  7. #7
    sì ma dove? come?
    ho una pagina per rimuovere le email dal database che funziona praticamente allo stesso modo e scritto praticamente allo stesso modo... quello va.
    fe..feu!!!

  8. #8
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Da qualche parte stamperai qualle variabile no?

    Roby

  9. #9
    ora è scritta così.. tutta la pagina.. ma non va.. vuole scrivere per forza il messaggio di errore..

    <%@ Language = VBScript %>

    <%
    Email = request.queryString("email")


    if len(Email) = 0 then
    response.redirect("http://xxxxxx)

    else


    set con = server.createObject("ADODB.Connection")
    con.open(strServerConnection)

    sqlString = "Select Email from Newsletter Where Email = '"&Email&"'"
    set rs = con.execute(sqlString)
    blnFound = false
    if not rs.eof then
    blnFound = true
    end if
    Set rs = nothing

    if blnFound = true then

    sqlString = "Update Newsletter Set Status = 1 Where Email = '"&Email&"'"
    con.execute(sqlString)

    conferma = "L'iscrizione è stata confermata."
    end if

    if blnFound = false then

    rifiuto = "Bisogna prima registrarsi."


    end if

    end if
    %>
    <html>
    <head>
    <title>Newsletter Conferma</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    </head>

    <body>
    <table width="60%" border="1" cellspacing="1" cellpadding="1" align="center" bordercolor="#999999">
    <tr>
    <td>
    <p align="center">
    <font face="verdana,arial,helvetica sans serif" size="2">
    <%=conferma%>
    <%=rifiuto%>




    torna alla home page
    </font></p></td>
    </tr>
    </table>

    </body>
    </html>
    fe..feu!!!

  10. #10
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Riporti a 0 lo status prima di effettuare le prove?
    Se aggiorna il db non può mostrarti il messaggio sbagliato.

    Roby

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.