Salve ragazzi,![]()
vi espongo il mio problemino =P
La mia " esigenza " sarebbe quella di saltare il login se l'utente ha gia effettuato altri ingressi nel "portale".
Mi avete consigliato di utilizzare i cookie ho provato a modificare la mia pagina , attualmente riesco a scrivere e leggere il cookie creato ma non so come fare l'automatismo che lo riconsce e mi fa entrare..vi posto il codice...
se potete darmi una mano vi rigrazierei di cuore...
codice:<%@ LANGUAGE="VBSCRIPT" %> <%Response.Buffer=TRUE%> <% If Request.querystring("mode") = "login" then Dim rsCheckUser Dim strSQL Dim strUserName strUserName = Request.Form("txtUserName") Set rsCheckUser = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT password, username, admin, ID FROM tblusers WHERE username ='" & strUserName & "'" rsCheckUser.Open strSQL, adoCon If NOT rsCheckUser.EOF Then If (Request.Form("txtUserPass")) = rsCheckUser("password") Then Session("userName") = rsCheckUser("username") Session("userAdmin") = rsCheckUser("admin") Session("userGood") = True Session("userID") = rsCheckUser("ID") '-------------------------CooKieS-beta 0.1-Scrittura------------------------------ dim intAnni intAnni = 1 dim dtScadenza dtScadenza = dateAdd("yyyy",intAnni, date) Response.cookies("UserName").expires = dtScadenza Response.cookies("UserName") = rsCheckUser("username") Response.Cookies("userID") = rsCheckUser("ID") 'Response.Write(Request.Cookies("UserName")) 'Response.Write(Request.Cookies("userID")) '----------------------------fine------------------------------------------------------ End If rsCheckUser.Close Set rsCheckUser = Nothing Set adoCon = Nothing Response.Redirect"index.asp?mode=main" End If rsCheckUser.Close Set rsCheckUser = Nothing Set adoCon = Nothing Session("userAdmin") = 0 Response.Redirect"default.asp" Else %> <form name="Login" method="post" action="default.asp?mode=login"> <table width="320" border="0" align="center" cellspacing="0" cellpadding="0" bgcolor="#CCCCCC"> <tr> <td align="right" height="47" valign="bottom" width="94">User name: </td> <td height="47" valign="bottom" width="172"> <input type="text" name="txtUserName"> </td> </tr> <tr> <td align="right" width="94">Password: </td> <td width="172"> <input type="password" name="txtUserPass"> </td> </tr> <tr> <td align="right" height="44" width="94"></td> <td height="44" width="172"> <input name='Submit' type='image' value='Enter' src='images/go2.png' alt='Entra!' width="64" height="64"> <input name='Reset' type='image' value='Reset' src='images/reset.png' alt='Reset!!!' width="64" height="64"> </td> </tr> </table></form> <% End If %> <% if Request.ServerVariables("HTTP_COOKIE") = "" then Response.Write "Attenzione, Cookie non abilitati!" else Response.Write "CooKie Abilitati Grazie!!!" end if Set rsCookie = Server.CreateObject("ADODB.Recordset") strCookieSQL = " SELECT password, username, admin, ID FROM tblusers" rsCookie.Open strCookieSQL, adoCon dim strCode strCode = request.cookies("UserName")("userID") 'Response.Write(Request.Cookies("UserName")) 'Response.Write(Request.Cookies("userID")) 'Response.Write rsCookie("username") 'Response.Write rsCookie("ID") if strCode = rsCookie("username") then 'Pagina Area Riservata Response.Redirect"index.asp?mode=main" else 'Pagina Iniziale Response.Redirect"default.asp" end if rsCookie.Close Set rsCookie = Nothing Set adoCon = Nothing %>
![]()
![]()

vi posto il codice...
Rispondi quotando
