Ragazzi, ciao a tutti,
Ho un piccolo problema, ho creato un'area riservata in un sito ma volevo sapere se gentilmente qualcuno mi può aiutare ad aggiungere nel form di login il pulsante con la spunta "Ricordami" (come in questo forum) oppure "Accedi automaticamente", in modo da essere automaticamente loggati ogni volta che si apre la pagina.
Il codice html della pagina index è questo:
Vengono inseriti ID e Password che vengono confrontati con l'archivio access tramite questa pagina login.asp:codice:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Login</title> </head> <body> <HTML> <HEAD> <font color="#EEEEEE" face="Verdana"> <TITLE>Login</TITLE> </HEAD> </font> <BODY BGCOLOR=#000000> <font color="#EEEEEE" face="Verdana"> </font> <FORM ACTION="login.asp" METHOD="POST"> <TABLE ALIGN=CENTER BORDER=0 BGCOLOR=#FF0000> <TR BGCOLOR=#000000> <TD WIDTH=150 ALIGN=CENTER><font color="#EEEEEE" face="Verdana">NOME UTENTE</font></td> <TD> <font color="#EEEEEE"> <INPUT NAME="nome_utente" SIZE=20 style="font-family: Verdana; color: #FFFFFF; background-color: #000000"><font face="Verdana"> </font> </font> </td> </TR> <TR BGCOLOR=#000000> <TD WIDTH=150 ALIGN=CENTER><font color="#EEEEEE" face="Verdana">PASSWORD</font></td> <TD> <font color="#EEEEEE"> <INPUT TYPE=password NAME="password" SIZE=20 style="font-family: Verdana; color: #FFFFFF; background-color: #000000"><font face="Verdana"> </font> </font> </TD> </TR> <TR BGCOLOR=#EEEEEE> <TD HEIGHT=30 COLSPAN=2 ALIGN=CENTER bgcolor="#000000"> <font color="#EEEEEE"> <INPUT TYPE=submit NAME="show" VALUE="LOGIN" style="font-family: Verdana; color: #FFFFFF; width: 300; background-color: #000000"><font face="Verdana"> </font> </font><font face="Verdana"> </TD> </TR> </TABLE> </FORM> </BODY> </HTML> </font> </body> </html>
Se i dati sono corretti si è indirizzati a riservato.asp che come intestazione ha:codice:<% Dim nome_ut Dim pass nome_ut = Replace(Request.Form("nome_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 Utenti WHERE NOMEUTENTE='" &nome_ut&_ "' 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 %>
Vi ringrazio in anticipo e spero in una rispostacodice:<% if Session("Autenticato")<>"OK" then Response.Redirect("index.htm") end if %>
Grazie 1000
Fabrizio
P.S. Se ho sbagliato sezione chiedo gentilmente ai moderatori di spostarmi in quella giusta![]()


Rispondi quotando