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

    Strano comportamento recupera password

    Ciao a tutti sto provando a creare un form per il recupero password di un utente registrato in database access. Ci sono 2 listati (recupera_password2.asp e inc_viewuser2.asp).

    Nella pagina recupera_password2.asp è inclusa l' altra ed è presente anche il form dove l' utente inserisce l' username e l' email.

    All' utilizzo le opzioni che si dovrebbero prospettare sono la conferma di invio password oppure l' avviso di username / email errati.

    Provando in locale succede questo:
    1) Scrivendo username e email corretti (del primo record del database) i dati vengono trovati ma si ritorna al form di inserimento degli stessi e non il messaggio di conferma invio email

    2) Scrivendo username e email corretti (del secondo o altri records del database) i dati non vengono trovati e si ritorna al form di inserimento degli stessi con l' avviso di username / email errati.

    Ciao a tutti e grazie in anticipo

    qui sotto metto il codice:

    recupera_password2.asp (PAGINA COL FORM)



    <%
    If Request.QueryString("step") = "2" Then
    Response.Redirect("recupera_password2.asp?step=3&u serMember_id=" & getuserMember_id(Request.Form("M_name"), Request.Form("M_Email")))
    ElseIf Request.QueryString("step") = "3" AND Request.QueryString("Member_id") <> "" Then
    MailOrder = "info@miosito.it" 'Indirizzo mittente ordini
    strSender = MailOrder
    strFromName = pageTitle & " Case in Sardegna"
    strFromEmail = adminEmail
    strRecipientsEmail = rs_viewuser("M_Email")
    strRecipientsName = rs_viewuser("M_Name")
    strSubject = pageTitle & " Password Reminder"
    strMessage = "Recupero password" & vbCrLf & _
    strRecipientsName & ", Le informazioni da lei richieste:" & vbCrLf & vbCrLf & _
    "Username: " & rs_viewuser("M_Name") & vbCrLf & _
    "Password: " & rs_viewuser("M_Password") & vbCrLf & vbCrLf & _
    "Grazie per averci scelto," & vbCrLf & pageTitle & ""
    Dim objMessage, iConf, Flds

    Set objMessage = CreateObject("CDO.Message")
    objMessage.From = strSender
    'objMessage.Sender = strSender
    objMessage.TextBody = strMessage
    objMessage.To = strRecipientsEmail
    objMessage.Subject = strSubject
    objMessage.Send
    Set iConf = CreateObject("CDO.Configuration")
    'Impostazione delle configurazioni per l'invio remoto
    Set Flds = iConf.Fields
    Set .Configuration = iConf
    Flds("http://schemas.microsoft.com/cdo/configuration/urlgetlatestversion") = True
    If Err <> 0 Then
    Err_Msg = Err_Msg & "[*]Impossibile spedire l'email. Errore: " & Err.Description & ""
    End if
    On Error Resume Next
    Set objNewMail = Nothing
    set Flds = Nothing
    set iConf = Nothing
    On Error Goto 0
    mailSent = True
    ElseIf Request.QueryString("step") = "3" AND Request.QueryString("userMember_id") = "" Then
    mailSent = False
    emptyValue = True
    Else
    mailSent = False
    End If
    %>

    <title><%=pageTitle%> - Recupera Password</title>
    <% If mailSent = False Then %>
    <% If emptyValue = True Then %>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <body bgcolor="#DFDFDF"><p align="center">Combinazione Username/Email non valida</p>
    <% End If %>
    <form name="pwForm" method="post" action="recupera_password2.asp?step=2">
    <table width="412" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
    <td height="35" colspan="2" align="center"><font size="5">Inserisci
    username e email</font>
    </td>
    </tr>
    <tr>
    <td colspan="2" height="4"></td>
    </tr>
    <tr>
    <td width="30%">Username</td>
    <td width="70%"><input name="M_name" type="text" id="M_Name" size="35"></td>
    </tr>
    <tr>
    <td colspan="2" height="4"></td>
    </tr>
    <tr>
    <td width="30%">Email</td>
    <td width="70%"><input name="M_Email" type="text" id="M_Email" size="35"></td>
    </tr>
    <tr>
    <td colspan="2" height="4"></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input type="submit" name="Submit" value="Submit">
    <input name="Reset" type="reset" id="Reset" value="Reset"></td>
    </tr>
    </table>
    </form>
    <% Else %>
    <p align="center">Username e Password ti sono state spedite per email.</p>
    <% End If %>

    inc_viewuser2.asp (PAGINA CHE E' INCLUSA NELL' ALTRA)
    <%
    Function rs_viewuser(desField)

    If Request.QueryString("userMember_id") <> "" Then
    viewuserSQL = "SELECT * FROM Members WHERE Member_id='" & Request.QueryString("userMember_id") & "'"
    Else
    viewuserSQL = "SELECT * FROM Members WHERE Member_id='" & str_users_Member_id & "'"
    End If


    Set RS = Server.CreateObject ("ADODB.RecordSet")


    RS.Open viewuserSQL,cString
    retField = RS(desField)
    RS.Close
    Set RS = Nothing

    rs_viewuser = retField
    End Function

    Function getuserMember_id(M_Name, M_Email)


    viewuserSQL = "SELECT * FROM Members WHERE M_Name='" & M_Name & "' AND M_Email='" & M_Email & "'"


    Set RS = Server.CreateObject ("ADODB.RecordSet")


    RS.Open viewuserSQL,cString
    If RS.EOF Then
    retMember_id = ""
    Else
    retMember_id = RS("Member_id")
    End If
    RS.Close
    Set RS = Nothing

    getuserMember_id = retMember_id
    End Function
    %>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,563
    Io non ho capito granché... :rollo:

    Roby

  3. #3
    Ciao
    Nel codice o nell' introduzione che ho fatto?

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,563
    Nell'introduzione.
    E' chiaro quello che ottieni mentre non ho capito cosa dovrebbe in realtà accadere...
    Fai degli esempi chiari.

    Roby

  5. #5
    ho inserito nel database un pò di valori per poi controllare il funzionamento della pagina di recupero password, succede che quando inserisco l' username (M_Name) e l' email (M_Email) corrispondenti al primo record li trova (Almeno penso) visto che nella barra degli indirizzi del browser mi indica ID=1:
    (http://localhost/sito-21-09-07(2)/forum/recupera_password2.asp?step=3&userMember_id=2)
    però non esce il messaggio di conferma e ricompare il form di richiesta da compilare

    mentre se inserisco i dati del secondo record vengo rimandato al form di inserimento dati per la richiesta password ed il messaggio che i dati che ho inserito sono errati
    (http://localhost/sito-21-09-07(2)/forum/recupera_password2.asp?step=3&userMember_id=)

  6. #6
    Ciao, nel frattempo ho ricontrollato il database, mi stava sorgendo il dubbio che non tutti i record avessero un Member_id associato ed invece lo hanno tutti, non riesco a capire dove stà l' errore. Dovrei scrivere diversamente i recordset?

  7. #7
    up

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.