Sesion y login! Porfa URGENTE
Hola, mira tengo un problemilla, e creado en mi pagina una BD con login y password, pero cuando es ejecutada lo hace en si misma, y me gustaria que cada usuario tuviera su propia sesion con sus datos personales, como lo hago?, este es el codigo que estoy utilizando, como lo modificaria para cada que cada usuario tenga su sesion?:
<%@ Language = "VBScript" %>
<%
Dim cnnLogin
Dim rstLogin
Dim strUsername, strPassword
Dim strSQL
%>
<html>
<head><title>Login Page</title>
</head>
<body bgcolor="gray">
<%
If Request.Form("action") <> "validate_login" Then
%>
<form action="login_db.asp" method="post">
<input type="hidden" name="action" value="validate_login" />
<table border="0">
<tr>
<td align="right">Login:</td>
<td><input type="text" name="login" /></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td align="right"></TD>
<td><input type="submit" VALUE="Login" /></td>
</tr>
</table>
</form>
<%
Else
strSQL = "SELECT * FROM tblLoginInfo " _
& "WHERE username='" & Replace(Request.Form("login"), "'", "''") & "' " _
& "AND password='" & Replace(Request.Form("password"), "'", "''") & "';"
Set cnnLogin = Server.CreateObject("ADODB.Connection")
cnnLogin.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("login.mdb"))
Set rstLogin = cnnLogin.Execute(strSQL)
If Not rstLogin.EOF Then
%>
<p>
<strong>All the Good Stuff We Want to Hide</strong>
</p>
<%
Else
%>
<p>
<font size="4" face="arial,helvetica"><strong>
Login Failed - Please verify username and password.
</strong></font>
</p>
<p>
<a href="login_db.asp">Try Again</a>
</p>
<%
'Response.End
End If
' Clean Up
rstLogin.Close
Set rstLogin = Nothing
cnnLogin.Close
Set cnnLogin = Nothing
End If
%>
</body>
</html>
<%@ Language = "VBScript" %>
<%
Dim cnnLogin
Dim rstLogin
Dim strUsername, strPassword
Dim strSQL
%>
<html>
<head><title>Login Page</title>
</head>
<body bgcolor="gray">
<%
If Request.Form("action") <> "validate_login" Then
%>
<form action="login_db.asp" method="post">
<input type="hidden" name="action" value="validate_login" />
<table border="0">
<tr>
<td align="right">Login:</td>
<td><input type="text" name="login" /></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td align="right"></TD>
<td><input type="submit" VALUE="Login" /></td>
</tr>
</table>
</form>
<%
Else
strSQL = "SELECT * FROM tblLoginInfo " _
& "WHERE username='" & Replace(Request.Form("login"), "'", "''") & "' " _
& "AND password='" & Replace(Request.Form("password"), "'", "''") & "';"
Set cnnLogin = Server.CreateObject("ADODB.Connection")
cnnLogin.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("login.mdb"))
Set rstLogin = cnnLogin.Execute(strSQL)
If Not rstLogin.EOF Then
%>
<p>
<strong>All the Good Stuff We Want to Hide</strong>
</p>
<%
Else
%>
<p>
<font size="4" face="arial,helvetica"><strong>
Login Failed - Please verify username and password.
</strong></font>
</p>
<p>
<a href="login_db.asp">Try Again</a>
</p>
<%
'Response.End
End If
' Clean Up
rstLogin.Close
Set rstLogin = Nothing
cnnLogin.Close
Set cnnLogin = Nothing
End If
%>
</body>
</html>
1 Respuesta
Respuesta de reynerd