Area Riservata
Utenti
Accesso

<%
' PRELEVA L'USERNAME E LA PASSWORD INSERITI
Dim N_password
Dim N_pin
N_Password = Replace(Request.Form("password"), "'", "''")
N_Pin = Replace(Request.Form("pin"), "'", "''")
'**************************************************************
Dimm Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)}; & "DBQ=" & server.mappath("/mdb-database/E-commerce.mdb")
Conn.Open
SQL = "SELECT * FROM admins where password = '" & N_password &"' OR pin = '" & N_pin &"'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql,conn,3,3
' CONTROLLA INNANZITUTTO SE E' STATO PASSATO UN VALORE, CIOE' VERIFICA
' CHE I CAMPI "Paswword" o "Pin" NON SIANO VUOTI
' Se è inserita la password o il Pin
IF N_password <> "" OR N_Pin <> ""then
' TUTTO OK...
' PERCORSO DEL DATABASE
url_DB = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("/mdb-database/E-commerce.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
conn.Open url_DB
Set RecSet = Server.CreateObject("ADODB.Recordset")
'**************************************************
'* aggiunta
'**************************************************
Set RS = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM admins where password = '" & N_password &"' OR pin = '" & N_pin &"'"
RecSet.Open SQL, Conn, adOpenStatic, adLockOptimistic
RS.Open SQL, Conn, adOpenkeyset
'*******************************************************
' * Carica la variabile area
'*********************************************************
' CONTROLLA SE L'UTENTE ESISTE
IF Not RecSet.Eof Then
' UTENTE ESISTENTE
' IMPOSTA DUE SESSION:
' - LOGGATO, CON IL VALORE DI TRUE
' - USERNAME, CON IL SUO USERNAME
' Carica la variabile del campo Lista
Lista = RecSet("Lista")
Session("Loggato") = True
Session("password") = password
Session("Lista") = lista
response.redirect "../default.asp"
Else
' ALTRIMENTI ... UTENTE NON ESISTENTE
' IMPOSTA LA SESSION "LOGGATO" CON
' IL VALORE DI FALSE
Session("Loggato") = False
End IF
' Chiude la connessione al DB
RecSet.Close
Set RecSet = Nothing
Conn.Close
Set Conn = Nothing
IF Session("Loggato") = True then
'response.redirect "../default.asp"
ELSE
' DATI NON CORRETTI (UTENTE INESISTENTE - USERNAME/PASSWORD NON CORRETTI)
%>
Password o Pin non corretti!
<%
End IF
Else
' CAMPI "PIN" E "PASSWORD" VUOTI
%>
Almeno uno dei campi deve essere inserito!
<%
End IF
%>