Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

marcelocardoso

Ver se esta lógica está correta

Recommended Posts

Pessoal!

 

Estou tentando adaptar um sisteminha de update de senha, mas fiz assim como apresentarei no codigo abaixo, está funcionando, mas está corretamente estruturado.

 

Se puderem me dar umas dicas, e se puderem me ajudar a melhorar agradeço.

Obrigado!

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<!--#include file="conn.asp" -->
<%
 IF IsEmpty(Request.Form) THEN
%>



<%
SET Verifica = CX.Execute("SELECT * FROM tableTest WHERE Id = '"& SESSION("ID") &"'")
%>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
	<td><form action="<%=REQUEST.SERVERVARIABLES("SCRIPT_NAME")%>" method="post" target="_self">
	  <table width="100%" height="113" border="0" cellpadding="1" cellspacing="0">
		<tr>
		  <td width="6%" height="47"> </td>
		  <td valign="middle"><div align="justify"> <span class="LinhaBranca">Para substituir seus dados de acesso<br />, troque-os abaixo.</span><br /></div></td>
		  <td width="7%"> </td>
		</tr>
		<tr>
		  <td> </td>
		  <td width="87%"><input name="campouser" type="text" class="BordaInputBranco" value="<%=LimpaHTML(Verifica("Login"))%>" size="39" maxlength="30" /></td>
		  <td> </td>
		</tr>
		<tr>
		  <td> </td>
		  <td><input name="campopass" type="text" class="BordaInputBranco" value="<%=LimpaHTML(Verifica("Senha"))%>" size="39" maxlength="10" /></td>
		  <td> </td>
		</tr>
		<tr>
		  <td> </td>
		  <td>
			<div align="left"><input type="submit" class="BordaInputBranco" value="Atualizar" /></div></td><td> </td>
		</tr>
	  </table>
	</form></td>
  </tr>
</table>


<%
ELSE
 IF Request.Form("campouser") = "" OR Request.Form("campopass") = "" THEN
	Response.Write "<table width=""100%"" border=""0"" cellspacing=""2"" cellpadding=""2"">"
	Response.Write "<tr>"
	Response.Write "<td>"
	Response.Write "<table width=""100%"" border=""0"" cellpadding=""2"" cellspacing=""1"">"
	Response.Write "<tr>"
	Response.Write "<td width=""9%"" height=""23""> </td>"
	Response.Write "<td width=""41%""> </td>"
	Response.Write "<td width=""43%""> </td>"
	Response.Write "<td width=""7%""> </td>"
	Response.Write "</tr>"
	Response.Write "<tr>"
	Response.Write "<td height=""63""> </td>"
	Response.Write "<td colspan=""2""><div align=""left"" class=""LinhaBranca""><b>Por Favor!</b><br><br />Preencha com seu login e sua<br> senha corretamente.<br />"
	Response.Write "<META HTTP-EQUIV=""REFRESH"" CONTENT=""3;URL=""java script:history.back();""""></td>"
	Response.Write "<td> </td>"
	Response.Write "</tr>"
	Response.Write "<tr>"
	Response.Write "<td> </td>"
	Response.Write "<td> </td>"
	Response.Write "<td> </td>"
	Response.Write "<td> </td>"
	Response.Write "</tr>"
	Response.Write "</table>"
	Response.Write "</td>"
	Response.Write "</tr>"
	Response.Write "</table>"
	Response.End
 END IF
%>



<%
		campo1 = LimpaHTML(Replace(Request.Form("campouser"),"'",""))
		campo2 = LimpaHTML(Replace(Request.Form("campopass"),"'",""))
  
 UPDATECODUSER = CX.Execute("UPDATE tableTest SET Login = '"& campo1 &"', Senha = '"& campo2 &"' WHERE Id = '"& SESSION("ID") &"'")
	Response.Write "<table width=""100%"" border=""0"" cellspacing=""2"" cellpadding=""2"">"
	Response.Write "<tr>"
	Response.Write "<td>"
	Response.Write "<table width=""100%"" border=""0"" cellpadding=""2"" cellspacing=""1"">"
	Response.Write "<tr>"
	Response.Write "<td width=""9%"" height=""23""> </td>"
	Response.Write "<td width=""41%""> </td>"
	Response.Write "<td width=""43%""> </td>"
	Response.Write "<td width=""7%""> </td>"
	Response.Write "</tr>"
	Response.Write "<tr>"
	Response.Write "<td height=""63""> </td>"
	Response.Write "<td colspan=""2""><div align=""left"" class=""LinhaBranca""><b>DADOS FORAM ATUALIZADOS!</b><br />"
	Response.Write "<script language=""javascript"">onload = function() {setTimeout(function() {parent.showHide('acesso');}, 4500);}</script><META HTTP-EQUIV=""REFRESH"" CONTENT=""5;URL=""java script:history.back();""></td>"
	Response.Write "<td> </td>"
	Response.Write "</tr>"
	Response.Write "<tr>"
	Response.Write "<td> </td>"
	Response.Write "<td> </td>"
	Response.Write "<td> </td>"
	Response.Write "<td> </td>"
	Response.Write "</tr>"
	Response.Write "</table>"
	Response.Write "</td>"
	Response.Write "</tr>"
	Response.Write "</table>"
	Response.End
%> 


	   
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
	<td>
	  <table width="100%" border="0" cellpadding="2" cellspacing="1">
		<tr>
		  <td width="9%" height="23"> </td>
		  <td width="41%"> </td>
		  <td width="43%"> </td>
		  <td width="7%"> </td>
		</tr>
		<tr>
		  <td height="63"> </td>
		  <td colspan="2"><div align="left" class="LinhaBranca">Seus dados de acesso foram atualizados!<br /><br /><b> Aguarde por gentileza.</b>
		  <script language="javascript">onload = function() {setTimeout(function() {parent.showHide('acesso');}, 4500);}</script></div><META HTTP-EQUIV="REFRESH" CONTENT="5;URL="java script:history.back();""></td>
		  <td> </td>
		</tr>
		<tr>
		  <td> </td>
		  <td> </td>
		  <td> </td>
		  <td> </td>
		</tr>
	  </table>
	</td>
  </tr>
</table>



<%
END IF
%>



</body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Não entendi sua dúvida. Mas só uma dica... você não pode alterar o LOGIN sem antes verificar se ele já está cadastrado... pois se dois usuários tiver o mesmo login, você terá problemas.

Compartilhar este post


Link para o post
Compartilhar em outros sites

HARGON!

 

Como posso fazer isso?

Pois numa tela com o cara já logado, e as sessions USER e a PASS tambem, onde ele clica no link TROCAR SENHA. aí abre um formulario que já resgata da session e coloca nos INPUTs chamada de campouser dele e campopass dele, aí ele só troca o seu user e o sua pass.

 

E este código faz tranquilo, mas como verificar isso que você falou??????

 

 

 

Obrigado!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.