<% Session.Abandon 'resetta tutte le variabili di sessione SESSION("MACROAMBITO") = "" Session("LivelloAccesso") = 0 Session("DemoDB") = "demo" username = request("username") Password = request("Password") IDCode = request("Password") IDUtente = request("IDUtente") 'response.write Password & "
" if password & "" <> "" then Password = sha256(Password) ' cripto la password 'response.write Password & "
" 'response.write request("action") Private Function Decrypt(ByVal encryptedstring) Dim x, i, tmp encryptedstring = StrReverse( encryptedstring ) For i = 1 To Len( encryptedstring ) x = Mid( encryptedstring, i, 1 ) tmp = tmp & Chr( Asc( x ) - 1 ) Next Decrypt = tmp End Function Private Function Encrypt(ByVal string) Dim x, i, tmp For i = 1 To Len( string ) x = Mid( string, i, 1 ) tmp = tmp & Chr( Asc( x ) + 1 ) Next tmp = StrReverse( tmp ) Encrypt = tmp End Function if request("action") = "retrievepwd" then x = RetrievePassword(username) 'x=N >> username non trovata - x=U >> username trovata ma Email non compilata - x=E >> email inviata x2 = split(x, "|") if x2(0)="N" then messaggio = "Attenzione, la username inserita NON è stata trovata fra gli utenti registrati, riprovare con una username diversa." elseif x2(0)="U" then messaggio = "Attenzione, per la username inserita NON è stata indicato l'indirizzo email di riferimento.
Contattare l'assistenza." else x = inviaEmail(x2(1), x2(2) , x2(3)) messaggio = "E' stata inviata una eMail all'indirizzo
" & username & "
contenente le istruzione per registrare una nuova password.

" end if end if if request("action") = "changepwd" then code = request("code") code = decrypt(code) code1 = split(code,"-") IDUtente = code1(1) Scadenza = code1(0) Scadenza = DateFormatDB(scadenza,"toScreen") if date() - cdate(scadenza) > 3 then messaggio = "Scaduto il termine per aggiornare la password, procedere con una nuova richiesta" response.write "
" & messaggio & "
" response.end end if 'response.write "http://" & Request.ServerVariables("SERVER_NAME") & "/" & Request.ServerVariables("URL") end if if request("action") = "savepwd" then Set rs = Server.CreateObject ("adodb.recordset") Qry="SELECT * FROM UTENTI WHERE IDUtente=" & IDUtente rs.Open Qry, dbc, adOpenKeyset, adLockPessimistic rs("Password") = Password rs("IDCode") = IDCode rs.update rs.close set rs = nothing messaggio = "Password variata!

" end if %>

<%=messaggio%>

<% if request("action") <> "retrievepwd" and request("action") <> "changepwd" and request("action") <> "savepwd" then %>
 RECUPERO PASSWORD

username:



Verrà inviata un'email per registrare una nuova password.
<%end if if request("action") = "changepwd" then 'if request("action") = "" then Set rs = Server.CreateObject ("adodb.recordset") SQL = "SELECT username, email, password, IdUtente FROM UTENTI WHERE IdUtente=" & IdUtente & "" rs.Open SQL, dbc, adOpenKeyset, adLockPessimistic, adCmdUnknown if not rs.eof then username = rs("username") end if rs.close set rs = nothing %>
 SALVA NUOVA PASSWORD

username:

Password:

Conferma password:



<%end if %>

<%=Session("msg")%>





















<% if request("action") = "savepwd" or request("action") = "retrievepwd" then %>












<%end if%>
Questo sito usa i cookies solo per facilitarne il suo utilizzo e migliorane la qualita' della navigazione tua e degli altri. Se vuoi saperne di piu' o negare il consenso a tutti o ad alcuni cookie clicca qui. Scorrendo questa pagina o cliccando qualunque suo elemento acconsenti all'uso dei cookie.

 
<% function RetrievePassword(username) Set rs = Server.CreateObject ("adodb.recordset") SQL = "SELECT email, password,IdUtente FROM UTENTI WHERE username='" & username & "'" rs.Open SQL, dbc, adOpenKeyset, adLockPessimistic, adCmdUnknown if rs.eof then Trovato = "N" ' non trovata username else Trovato = "U" ' trovata username ma email vuota ' if trim(rs("email"))<>"" then Trovato = "E" 'trovata email ' PasswordOk = rs("password") ' emailOk = rs("email") emailOk = username IDutenteOk = rs("IdUtente") ' end if end if rs.close set rs = nothing RetrievePassword = Trovato & "|" & PasswordOk & "|" & emailOk & "|" & IDutenteOk end function function InviaEmail(MyPwdm, MyEmail,MyIdUtente) ' if len(EMAILUtente)<5 then EMAILUtente="support@siav.net" ' end if dt = date() '-4 oggi = DateFormatDB(dt,"toDB") & "-" & MyIdUtente link = encrypt(oggi) TestoRichiesta = "I 100 LUOGHI DI INDUSTRIA 4.0 IN VENETO - Recupero password di accesso" & "

" TestoRichiesta = TestoRichiesta & "Gentile utente, la password associata alla username " & request("username") & " potrà essere cambiata cliccando il link sottostante:" & "

" TestoRichiesta = TestoRichiesta & "il link sarà attivo per 3 giorni.

" TestoRichiesta = TestoRichiesta & "http://" & Request.ServerVariables("SERVER_NAME") & "/" & Request.ServerVariables("URL") & "?action=changepwd" & "&code=" & link TestoRichiesta = TestoRichiesta & "

Grazie.

" TestoRichiesta = replace(TestoRichiesta, chr(13) & chr(10), "
") 'response.write "|"&len(EMAILUtente)&"|": response.end Set myMail=CreateObject("CDO.Message") myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Name or IP of Remote SMTP Server myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "192.168.200.103" myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/urlgetlatestversion") = True myMail.Configuration.Fields.Update myMail.Subject="I 100 LUOGHI DI INDUSTRIA 4.0 IN VENETO - Invio password di accesso" myMail.From=EMAILUtente '"area.formazione@siav.net" ' myMail.To="support@siav.net" ' myMail.To="claudio.beltrame@siav.net" myMail.To=MyEmail testomail = TestoRichiesta myMail.HTMLBody = TestoRichiesta myMail.Send ' response.write "" end function %>