Sono disperato per poco.
Ho una tabella con su i seguenti dati
Colonne = ID, NomeUtente e Password.
Chiaramente ho memorizzato qualche dato!
Con il seguente codice devo garantire la autenticazione, e poi devo fare in modo che una volta che l'utente si sia autenticato abbia una pagina con dei link personalizzati:
tipo si autentica Mario toh si apre la pagina mario.asp e cosi via(le pagine sono quattro in quanto gli utenti sono 4).
index.htm
<HTML>
<HEAD>
<TITLE> On Site Support Sale Server RE</TITLE>
</HEAD>
<BODY>
<CENTER>
[img]images2.jpg[/img]
<FORM ACTION="login.asp" method="POST">
<table border="0" width="745">
<tr>
<td height="80" width="735" align="center" valign="top">
<font face="Verdana" size="4" color="#002D65">On Site Support Sale Server Re</font><font color="#002D65" face="Verdana" size="4">
</font></td>
</tr>
<tr>
<td height="80" width="735" bgcolor="#EBF3F3" align="center">
<font face="Verdana" size="4" color="#042D65">LOGIN UTENTE</font></td>
</tr>
<tr>
<td height="40" width="718" align="center" bgcolor="#FDFEC5">
<font face="Verdana" color="#FF6600" size="2">Username</font>
<INPUT TYPE=text SIZE=15 NAME=username></td>
</tr>
<tr>
<td height="40" width="718" align="center" bgcolor="#FDFEC5">
<font face="Verdana" color="#FF6600"><font size="2">Password</font> </font><INPUT type=password SIZE=15 NAME=password></td>
</tr>
<tr>
<td height="80" width="735" align="center" bgcolor="#004497">
<INPUT TYPE=submit value="Login" style="border:1px solid #004497; font-family: Verdana; font-weight: bold; color:#004497; background-color:#EBF3F3">
<INPUT TYPE=reset value="Reset" style="border:1px solid #004497; font-family: Verdana; font-weight: bold; color:#004497; background-color:#EBF3F3"></td>
</tr>
</table>
</FORM>
</CENTER>
</BODY>
</HTML>
login.asp
<%
Dim utente
Dim pass
utente = Replace(Request.Form("username"), "'", "''")
session("id_utente") = utente
pass = Replace(Request.Form("password"), "'", "''")
Dim cn
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("Utenti.mdb")
Dim sql
sql = "SELECT ID FROM UserPwd WHERE NomeUtente ='" &utente& _
"' AND Password='" &pass& "'"
Dim rs
Set rs = cn.Execute(sql)
Dim autenticato
if rs.eof then
autenticato = false
else
autenticato = true
end if
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
if autenticato = true then
Session("Autenticato") = "OK"
Response.Redirect("riservato.asp")
else
Response.Redirect("index.htm")
end if
%>
Non ci riesco non so cosa fare.
Help
Speravo che con il valore estratto da access ID riuscivo a creare
una struttura di controllo per pescare la pagina asp giusta.
Grazie per l'aiuto
Mario

Rispondi quotando
