La pagina register.asp registra i dati dell'utente immessi nel form nel database. Dopo immessi i dati, register.asp rimanda all'index.asp dove c'è il modulo per autenticarsi (user e password).Fino a qui tutto ok.
Se verificato user esistente, dovrebbe rimandandare l'utente alla pagina inserita (da me dopo la registrazione)nel database, per esempio utente.asp.
Se user non esistente rimandarlo alla pagina index.asp.
Dopo l'autenticazione leggo l'errore
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/login_utenti/login.asp, line 17
....dove la linea 17 è ....
Set rs = cn.Execute(sql)
il resto del codice è ......
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
Dim nome_ut
Dim pass
nome_ut = Replace(Request.Form("Username"), "'", "''")
pass = Replace(Request.Form("Password"), "'", "''")
Dim cn
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("/mdb-database/utenti.mdb")
Dim sql
sql = "SELECT ID, PAGINA FROM Utenti WHERE NOMEUTENTE='" &nome_ut&_
"' AND PASSWORD='" &pass& "'"
Dim rs
Set rs = cn.Execute(sql)
Dim autenticato
if rs.eof then
autenticato = false
else
pagina = rs("pagina")
autenticato = true
end if
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
if autenticato = true then
Session("Autenticato") = "OK"
Response.Redirect pagina
else
Response.Redirect("index.asp")
end if
%>
Se verificato user esistente, dovrebbe rimandandare l'utente alla pagina inserita (da me dopo la registrazione)nel database, per esempio utente.asp.
Se user non esistente rimandarlo alla pagina index.asp.
Dopo l'autenticazione leggo l'errore
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/login_utenti/login.asp, line 17
....dove la linea 17 è ....
Set rs = cn.Execute(sql)
il resto del codice è ......
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
Dim nome_ut
Dim pass
nome_ut = Replace(Request.Form("Username"), "'", "''")
pass = Replace(Request.Form("Password"), "'", "''")
Dim cn
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("/mdb-database/utenti.mdb")
Dim sql
sql = "SELECT ID, PAGINA FROM Utenti WHERE NOMEUTENTE='" &nome_ut&_
"' AND PASSWORD='" &pass& "'"
Dim rs
Set rs = cn.Execute(sql)
Dim autenticato
if rs.eof then
autenticato = false
else
pagina = rs("pagina")
autenticato = true
end if
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
if autenticato = true then
Session("Autenticato") = "OK"
Response.Redirect pagina
else
Response.Redirect("index.asp")
end if
%>