Salve a tutto il forum.
Ho due pagine per l'accesso riservato all'area shop del mio sito, eil login si basa sulle session.In pratica tutto funge bene, se non che io vorrei che l'utente già loggato sia ricordato ad un successivo accesso all'area,ho provato a inserire i cookies ma non funziona in quanto mi richiede sempre di metter edi nuovo i dati d'accesso.
Come fare?
Posto le due pagine interessate:
LOGIN.asp
LOGIN_MAIN.aspcodice:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>ALIWORK POINT_SHOP</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <% if Request.Form("inviato") = "si" then Dim strnick, strpsw strnick = Trim(Replace(Request.Form("nick"), "'", "")) strpsw = Trim(Replace(Request.Form("psw"), "'", "")) if strnick <> "" AND strpsw <> "" then dim objConn, objRs, strSql set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& server.MapPath("../../mdb-database/aliwork_shop.mdb") set objRs = Server.CreateObject("ADODB.RecordSet") strSql = "SELECT * FROM utenti WHERE nick='"& strnick &"' AND psw='"& strpsw &"';" objRs.open strSql, objConn, 1, 3 if not objRs.eof then Session("nick") = objRs("nick") Session("psw") = objRs("psw") %> %> <% else %> Login fallito. Nome utente e/o password sconosciuti. <% end if objRs.close objConn.close set objRs = nothing set objConn = nothing else %> I dati inseriti non sono corretti... riprovare. <% end if else %> <form name="login" action="login.asp" method="post"> Area riservata Nick: <input type="text" name="nick"> password: <input name="psw" type="password" id="psw"> <input type="hidden" name="inviato" value="si"> <input type="submit" value="Loggati"> <input type="hidden" name="data" value="<%=date()%>"15"> <input type="hidden" name="codhw" maxlength="50" size="25" value="<%=rec("codhw")%>"> <input type="hidden" name="cat" maxlength="50" size="25" value="<%=rec("cat")%>"> <input type="hidden" name="art" maxlength="50" size="25" value="<%=rec("art")%>"> <input type="hidden" name="descr" maxlength="50" size="25" value="<%=rec("descr")%>"> <input type="hidden" name="prz" maxlength="50" size="25" value="<%=rec("prz")%>"> <div align="left"> </div> <%end if%>
[CODE]
<html>
<head>
<body>
<%
dim scodhw
dim sart
dim scat
dim sprz
dim sdescr
dim sdata
scodhw=request.Form("codhw")
scat=request.Form("cat")
sart=request.Form("art")
sdescr=request.Form("descr")
sprz=request.Form("prz")
sdata=request.Form("data")
Session("ordine") = scodhw & "|" & scat & "|" & sart & "|" & sdescr & "|" & sprz& "|" & sdata & "|"
%>
</p>
</p>
</p>
<link href="../file_asp/stile/stile.css" rel="stylesheet" type="text/css"></head> <body>
<table border="1" align="left" cellpadding="2" cellspacing="2">
<tr>
<td width="58" height="34" wcodth="112"> <div align="left">Codice</div></td>
<td width="175" wcodth="102"> <div align="left">Categoria</div></td>
<td width="53" wcodth="102">Articolo</td>
<td width="78" wcodth="102">Descrizione</td>
<td width="79" wcodth="102">Prezzo</td>
</tr>
<tr>
<td height="36"> <div align="left"><font color="red"><%=scodhw%></font></div></td>
<td> <div align="left"><font color="red"><%=scat%></font></div></td>
<td><font color="red"><%=sart%></font></td>
<td><font color="red"><%=sdescr%></font></td>
<td><font color="red"><%=sprz%></font></td>
</tr>
<tr>
<td height="25">QTA</td>
<td colspan="4" rowspan="2"><form action="basket.asp" method="post" name="qta" target="_self" id="qta">
<p align="left"><font size="2"> </font>
<input name="qta" type="text" id="qta" size="5" maxlength="3">
<input type="hidden" name="idcliente" id="idcliente" value="<%=rec("id")%>" size="25" maxlength="50">
<input type="hidden" name="email" id="email" value="<%=rec("email")%>" size="25" maxlength="50">
</p>
<p align="left"><font size="2">
<input type="submit" name="Submit" value="Metti nel carrello">
</font></p>
</FORM></td>
</tr>
<tr>
<td height="17"></td>
</tr>
</table>
</p>
</p>
</p>
</body>
</head>
</html>
![]()

Rispondi quotando