Login asp
Publicado por Javier del amo (2 intervenciones) el 10/02/2008 12:44:06
Hola tengo un problema en una web que estoy haciendo en asp. Estoy empezando con ese tipo de programación. Creo una base de datos para el login, password, ID, nombre, apellidos telefono,etc..
Reaizo la página de comprobación y la de detalle y todo va correcto. pero lo que yo quiero es que cuando un usuario introduzca usuario y contraseña solo se vean sus datos y no que se me ven solo los del primer usuario. la pagina detalle es( decir todo esto lo hago con Dreamweaver) :
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/javintro.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="administrador"
MM_authFailedURL="inicio.html"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_javintro_STRING
Recordset1.Source = "SELECT * FROM tabjavintro WHERE id = id"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<% if (session("registrado")="si" + timeout = 5) then
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>Datos de usuario</title>
</head>
<body>
<table width="341" border="1" align="center" cellpadding="5" cellspacing="5">
<tr>
<th colspan="2" scope="col">Datos de usuario </th>
</tr>
<tr>
<th scope="row">Nombre</th>
<td><%=(Recordset1.Fields.Item("Nombre").Value)%></td>
</tr>
<tr>
<th scope="row">Apellidos</th>
<td><%=(Recordset1.Fields.Item("Apellidos").Value)%></td>
</tr>
<tr>
<th scope="row">Dirección</th>
<td><%=(Recordset1.Fields.Item("Direccion").Value)%></td>
</tr>
<tr>
<th scope="row">CP</th>
<td><%=(Recordset1.Fields.Item("CP").Value)%></td>
</tr>
<tr>
<th scope="row">Población</th>
<td><%=(Recordset1.Fields.Item("Poblacion").Value)%></td>
</tr>
<tr>
<th scope="row">Provincia</th>
<td><%=(Recordset1.Fields.Item("Provincia").Value)%></td>
</tr>
<tr>
<th scope="row">Pais</th>
<td><%=(Recordset1.Fields.Item("Pais").Value)%></td>
</tr>
<tr>
<th scope="row">Telefono</th>
<td><%=(Recordset1.Fields.Item("Telefono").Value)%></td>
</tr>
<tr>
<th scope="row">E-mail</th>
<td><%=(Recordset1.Fields.Item("Email").Value)%></td>
</tr>
<tr>
<th scope="row">Nombre de dominio </th>
<td><%=(Recordset1.Fields.Item("Domino").Value)%></td>
</tr>
<tr>
<th scope="row">Nombre de usuario </th>
<td><%=(Recordset1.Fields.Item("usuario").Value)%> </td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Gracias
Reaizo la página de comprobación y la de detalle y todo va correcto. pero lo que yo quiero es que cuando un usuario introduzca usuario y contraseña solo se vean sus datos y no que se me ven solo los del primer usuario. la pagina detalle es( decir todo esto lo hago con Dreamweaver) :
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/javintro.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="administrador"
MM_authFailedURL="inicio.html"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_javintro_STRING
Recordset1.Source = "SELECT * FROM tabjavintro WHERE id = id"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<% if (session("registrado")="si" + timeout = 5) then
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>Datos de usuario</title>
</head>
<body>
<table width="341" border="1" align="center" cellpadding="5" cellspacing="5">
<tr>
<th colspan="2" scope="col">Datos de usuario </th>
</tr>
<tr>
<th scope="row">Nombre</th>
<td><%=(Recordset1.Fields.Item("Nombre").Value)%></td>
</tr>
<tr>
<th scope="row">Apellidos</th>
<td><%=(Recordset1.Fields.Item("Apellidos").Value)%></td>
</tr>
<tr>
<th scope="row">Dirección</th>
<td><%=(Recordset1.Fields.Item("Direccion").Value)%></td>
</tr>
<tr>
<th scope="row">CP</th>
<td><%=(Recordset1.Fields.Item("CP").Value)%></td>
</tr>
<tr>
<th scope="row">Población</th>
<td><%=(Recordset1.Fields.Item("Poblacion").Value)%></td>
</tr>
<tr>
<th scope="row">Provincia</th>
<td><%=(Recordset1.Fields.Item("Provincia").Value)%></td>
</tr>
<tr>
<th scope="row">Pais</th>
<td><%=(Recordset1.Fields.Item("Pais").Value)%></td>
</tr>
<tr>
<th scope="row">Telefono</th>
<td><%=(Recordset1.Fields.Item("Telefono").Value)%></td>
</tr>
<tr>
<th scope="row">E-mail</th>
<td><%=(Recordset1.Fields.Item("Email").Value)%></td>
</tr>
<tr>
<th scope="row">Nombre de dominio </th>
<td><%=(Recordset1.Fields.Item("Domino").Value)%></td>
</tr>
<tr>
<th scope="row">Nombre de usuario </th>
<td><%=(Recordset1.Fields.Item("usuario").Value)%> </td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Gracias
Valora esta pregunta


0