%
%>
<%
'Inicia a atualização
if request.querystring("acao") = "atualiza" then
strEmail=request.form("novoemail")
strEmaila=request.form("email")
strSenhaa=request.form("senhaatual")
strSenha=request.form("senhanova")
'Chama o e-mail e a senha
Set dados = abredb.Execute("SELECT * FROM clientes WHERE email='"&Cripto(strEmail,true)&"';")
if dados.EOF then
strEmail = strEmail
else
strEmail = "sim@."
end if
dados.close
set dados = nothing
if strEmail = "" then
strEmail = strEmaila
else
'Valida o e-mail
if instr(strEmail, "@") = 0 Or instr(strEmail, ".") = 0 then
abredb.close
set abredb = nothing
response.redirect "email_senha.asp?erro2=- " & strLg152
end if
if strEmail = "sim@." then
abredb.close
set abredb = nothing
response.redirect "email_senha.asp?erro2=- " & strLg162
end if
end if
'Chama a senha
set rsAsk = abredb.Execute("select senha FROM clientes WHERE email='"&Cripto(strEmaila,true)&"';")
if strSenhaa = "" OR strSenha = "" then
strSenha = Cripto(rsAsk("senha"),false)
strSenhaa = Cripto(rsAsk("senha"),false)
end if
if Cripto(rsAsk("senha"),false) <> strSenhaa then
rsAsk.close
set rsAsk = nothing
Conn.close
set Conn = nothing
response.redirect "email_senha.asp?erro=- " & strLg163
else
set rsQuery = abredb.Execute("update clientes set email='"&Cripto(strEmail,true)&"', senha='"&Cripto(strSenha,true)&"' WHERE email='"&Cripto(strEmaila,true)&"';")
abredb.execute("update compras set clienteid='"& Cripto(strEmail,true) &"' where clienteid='"&Cripto(strEmaila,true)&"'")
end if
rsAsk.close
set rsAsk = nothing
'Loga novamente se o usuario tiver mudado o email
checkPass = "select email,senha from clientes where email='"&Cripto(strEmail,true)&"';"
set passSet = abredb.Execute(checkPass)
real_password = Cripto(trim(passSet("senha")),false)
'Application.lock
session("usuario") = strEmail
'Application.unlock
session.timeout = 60
response.cookies(""&nomeloja&"")("usuario")= strEmail
response.cookies(""&nomeloja&"").expires = "01/01/"&year(now) + 1
passSet.close
set passSet = nothing
%>
<%
response.end
else
'Chama os dados do usuario
Set dados = abredb.Execute("SELECT email,senha FROM clientes WHERE email='"&Cripto(session("usuario"),true)&"';")
if dados.EOF OR dados.EOF then
dados.close
set dados = nothing
abredb.close
set abredb = nothing
response.redirect "default.asp"
else
strEmail = Cripto(dados("email"),false)
strSenha = Cripto(dados("senha"),false)
end if
%>
<%end if%>