Los Foros de ASPTutor.com
Home | Perfil | Registrarse | Temas Activos | Miembros | Buscar | FAQ
Usuario:
Password:
 Todos los Foros
 ASP
 validar contraseña
 Foro Bloqueado  Tema Bloqueado


Autor Temas
junnior
Starting Member

Chile
6 Posts
Mensajes - 25 Jun 2007 :  18:00:44  Ver Perfil  Enviar Email
hola tengo unproblemita con la validacion de contrasena.... hice como redireccionar cuando no coincide, pero cunado coincide con la base de datos, no me ingresa al pagina que deberia.. como puedo hacerlos , me pueden ayudar

atte. jcorrea

zahed
Starting Member

Mexico
7 Posts
Posted - 27 Jun 2007 :  20:18:14  Ver perfil  Enviar e-mail
Lo que tienes que hacer es compararlo con la base y despues mediante un form lo redireccionas a la pagina, claro que si es verdadero.

Siempre incrementando mis destrezas!!!Inicio Pagina

wichosaenz
Junior Member

Mexico
211 Posts
Posted - 03 Jul 2007 :  20:25:26  Ver perfil  Enviar e-mail  Enviar wichosaenz un Mensaje Yahoo!e
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="/importar.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("user"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="http://www.yahoo.com"
MM_redirectLoginFailed="http://www.hotmail.com"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_importar_STRING
MM_rsUser.Source = "SELECT user, password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM user WHERE user='" & Replace(MM_valUsername,"'","''") &"' AND password='" & Replace(Request.Form("password"),"'","''") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<!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=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
<table width="35%">
<tr>
<td>usuario:</td>
<td><label>
<input name="user" type="text" id="user" />
</label></td>
</tr>
<tr>
<td>password</td>
<td><label>
<input name="password" type="password" id="password" />
</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><label>
<input type="submit" name="Submit" value="Enviar" />
</label></td>
</tr>
</table>
</form>
</body>
</html>


Wicho Saenz

Recuerda, lo único que te ofrezco es la verdad, nada más.
La pildora azul es para la impotencia, la roja para la diarrea.

Edited by - wichosaenz on 03 Jul 2007 20:31:36Inicio Pagina

ollg
Starting Member

Mexico
6 Posts
Posted - 18 Jul 2007 :  19:47:14  Ver perfil  Enviar e-mail
quote:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="/importar.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("user"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="http://www.yahoo.com"
MM_redirectLoginFailed="http://www.hotmail.com"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_importar_STRING
MM_rsUser.Source = "SELECT user, password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM user WHERE user='" & Replace(MM_valUsername,"'","''") &"' AND password='" & Replace(Request.Form("password"),"'","''") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<!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=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
<table width="35%">
<tr>
<td>usuario:</td>
<td><label>
<input name="user" type="text" id="user" />
</label></td>
</tr>
<tr>
<td>password</td>
<td><label>
<input name="password" type="password" id="password" />
</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><label>
<input type="submit" name="Submit" value="Enviar" />
</label></td>
</tr>
</table>
</form>
</body>
</html>


Wicho Saenz

Recuerda, lo único que te ofrezco es la verdad, nada más.
La pildora azul es para la impotencia, la roja para la diarrea.

Edited by - wichosaenz on 03 Jul 2007 20:31:36


Inicio Pagina

   
 Foro Bloqueado  Tema Bloqueado
Ir a:
Los Foros de ASPTutor.com Los Foros de ASPTutor.com
Ir al principio de la Página

 Imprimir Tema
 

Descargas de manuales¦ Ejemplos de código ¦ Artículos mas visitados ¦ Envía tu articulo ¦ Foros ¦
  Libro de visitas ¦Crea un enlace con ASPTutor 
 

    © 2001-Hasta hoy  Pedro Rufo Martín  contactar