Ver Mensaje Individual
  #5 (permalink)  
Antiguo 31/03/2006, 14:02
Avatar de mc_quake
mc_quake
 
Fecha de Ingreso: enero-2006
Ubicación: www.ecocargo.cl
Mensajes: 683
Antigüedad: 19 años, 3 meses
Puntos: 8
ejemplo

pagina formulario:

inicio.asp
Cita:
<%
Mensaje = Request.QueryString("Msj")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form" method="post" action="login.asp">
<table width="98%" border="0">
<tr>
<td width="23%"><img src="IMG/Logo%20Telmex.bmp"></td>
<td width="61%"><div align="right"><strong></strong></div></td>
<td width="16%">&nbsp; </td>
</tr>
</table>
<table width="25%" border="0" align="center">
<tr>
<td width="21%"><strong><font color="#0000FF" size="2" face="Trebuchet MS">Usuario</font></strong></td>
<td width="2%"><strong><font color="#0000FF" size="2" face="Trebuchet MS">:</font></strong></td>
<td width="77%"><font size="2" face="Trebuchet MS">
<input name="usuario" type="text" id="usuario" size="15" maxlength="15">
</font></td>
</tr>
<tr>
<td><strong><font color="#0000FF" size="2" face="Trebuchet MS">Password</font></strong></td>
<td><strong><font color="#0000FF" size="2" face="Trebuchet MS">:</font></strong></td>
<td><font size="2" face="Trebuchet MS">
<input name="password" type="password" id="password" size="15" maxlength="15">
</font></td>
</tr>
<tr>
<td> <a href="modusuario.asp">Ingreso</a></td>
</tr>
</table>
<table width="25%" border="0" align="center">
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="Entrar">
</div></td>
</tr>
<tr>
<td><div align="center"><font color="#FF0000" size="2" face="Trebuchet MS"><%=Mensaje%></font></div></td>
</tr>
</table>
</form>
</body>
</html>
login.asp

Cita:
<%
Dim usuario, password, Conexion, Registros, Sql

Session ("USUARIO")= Request.form("usuario")

If Session("ID_USUARIO")<> "" Then
Response.Redirect "Inicio.asp?Msj=Acceso denegado Ingrese Usuario y password"
ElseIf Session("ID_USUARIO")="" Then

If Request.Form("usuario") = "" OR Request.Form("password") = "" then
Response.Redirect "Inicio.asp?Msj=Existen Campos Vacios"
Else
'Guardamos los datos del Form en variables y evitamos la comilla simple
usuario = UCase(Trim(Request.Form("usuario")))
password = UCase(Trim(Request.Form("password")))
usuario = Replace(usuario,"'","''")
password = Replace(password,"'","''")

Set Conexion = Server.CreateObject ("ADODB.Connection")
Conexion.open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Base.mdb;"

'Seleccionamos de la tabla solo los registros que concuerden con el usuario del Form.
Set Registros = Server.CreateObject ("ADODB.RecordSet")
Sql = "SELECT * FROM USERS WHERE USER_USUARIO = '"& usuario &"'"
Registros.Open Sql, Conexion

'Si el valor EOF (fin de la tabla elegida) es verdadero, no existe el usuario.
If (Registros.EOF = true) then
Response.Redirect ("Inicio.asp?Msj=Ese usuario no existe")
ElseIf Registros.Fields("USER_PASSWORD") = password then 'Si el campo de la tabla es igual a nuestra variable, estas logueado.
Session("USUARIO") = usuario
Session("NIVEL")= Registros.Fields("TIPO")
Response.Write "<font color=#0000FF size=2 face=Trebuchet MS>Bienvenido <B>"& Session("USER_USUARIO") &"</B></font>"

response.write "<table width=""752"" border=""1"" align=""center"" class=""tbl_marco1"">"
response.write " <tr>"
response.write " <td width=""742"" height=""112"" bgcolor=""#E0E0F6""> "
response.write " <p align=""center""><font color=""#000000"" size=""5"" face=""Trebuchet MS""><strong>Bienvenido "
response.write " <font color=""#FF0000"">"& Session("USUARIO") &"</font> a servicios restringidos de subtel</strong></font></p>"
response.write " <p align=""center""><strong><font color=""#000000"" size=""2"" face=""Trebuchet MS"">Si "
response.write " dentro de los proximos 5 segundos no eres direccionado a la pagina inicio "
response.write " de session pincha <font color=""#0000FF""><a href=""usuario.asp"">AQUI</a></font></font><font color=""#000000"" size=""3"" face=""Trebuchet MS""> "
response.write " Suerte!!!</font></strong></p>"
response.write " </td>"
response.write " </tr>"
response.write "</table>"
response.redirect ("usuario.asp?privilegioo="&Registros.Fields("USER _PRIVILEGIO")&"")

Else 'Otra cosa, seria cuando el password no es la que seleccionamos.
Response.Redirect("Inicio.asp?Msj=Esa contraseña no concuerda con el usuario ingresado")
End If
'Limpiamos y cerramos.
Registros.Close
Conexion.Close
Set Registros = Nothing
Set Conexion = Nothing
End If


End If
%>
eso es

solo te falata ria crear la pagina de modificar los datos eso te lo dejo ati
__________________
Mc_Quake

Para ayudar en lo que se pueda:Zzz: