Originariamente inviato da cavicchiandrea
Per ovviare devi inserire un campo hidden nel form login tipo <input type="hidden" value="<%=request.servervariables("http_referer")% > name="page"> che recupera con referer la pagina precedente al login, quando autentichi l'utente quando lo stesso è autorizzato rimandi alla pagina "originale" con un redirect response.redirect(Reques.form("page")), oppure puoi usare anche una session quando l'utente accede a pagina1.asp imposti la session("page") = request.servervariables("URL") (non sono sicuro contra) e rimandi al login una volta logato reindirizzi alla session
andrea non sono un espertissimo di Asp qui c'è il codice della pagina login.asp
dove metto il tuo codice ?
Codice PHP:
<% Server.Execute("header.asp") %>
<%
If Request.QueryString("step") = "2" THEN
'Rimuovo l'username e la password da caratteri illegali come per esempio '.
str_username = Replace(Request.Form("username"), "'", "''")
str_password = Replace(Request.Form("password"), "'", "''")
Set rs_login = Server.CreateObject ("ADODB.RecordSet")
strSQL = "SELECT * FROM tbl_authors WHERE name='" & str_username & "' AND pass='" & str_password & "'"
rs_login.open strSQL,adoConnes
'Se la combinazione username e password non esiste, reindirizzo l'utente ad un altra pagina
If rs_login.EOF _
Or rs_login.BOF Then
Response.Redirect("login_errato.asp")
Else
'Scrivo l'user code nel cookie
Response.Cookies("Login")("userCode") = rs_login("code")
'Reindirizzo alla pagina appropriata
If adminEmail = "d.milea@libero.it" AND str_password = "admin" Then
Response.Redirect("setup.asp?setup=firstTime")
Else
if request.servervariables("http_referer") <> "" then
response.redirect(request.servervariables("http_referer"))
else
Response.redirect("visualizza_profilo.asp")
End if
End If
End If
End if
%><head>
<title><%=pageTitle%> .::. Login .::.</title>
<LINK href="css/file.css" type=text/css rel=stylesheet></head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<center>
<% If Request.QueryString("disp") = "login" Then %>
Grazie per esserti registrato, <%=Session("tmpUN")%>! Per loggarti inserisci la password</p>
<% Else %>
Se non sei registrato, [url="registrazione.asp"]registrati[/url]!</p>
<% End If %>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="14">
<tr>
<td width="100%" height="14">
<p align="center">[img]images/login.gif[/img]</p>
</td>
</tr>
</table>
<form action="login.asp?step=2" method="post" onReset="return confirm('Cencello i campi?');">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="300">
<tr>
<td>Username</td>
<td>
<input type="text" name="username" size="30" maxlength="80" value="<%If Request.QueryString("disp") = "login" Then Response.Write(Session("tmpUN")) Else Response.Write(str_users_name) End If%>"></td>
</tr>
<tr>
<td colspan="2" height="8"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" size="30" maxlength="80"></td>
</tr>
<tr>
<td colspan="2" height="8"></td>
</tr>
<tr>
<td colspan="2">
<p align="center"><input type="submit" value="Login">
<input type="reset" value="Reset"> </p>
</td>
</tr>
<tr>
<td colspan="2" height="8"></td>
</tr>
<tr>
<td colspan="2">
<p align="center">[url="recupera_password.asp"]Recupera password[/url]</p>
</td>
</tr>
</table>
</center>
</div>
</form>
</center>
<% Server.Execute("footer.asp") %>