Skal have UserId ind i redirect
Hej AlleDet er mange år siden jeg sidst har kigger på ASP, og har lige brug for lidt hjælp. Nedenfor poster jeg min kode.
Jeg vil gerne ved succesfuld login at den skriver:
response.redirect("indberet.asp?Userid=UserId")
Altså det rigtige tal (UserId) fra databasen, så det ender med en url der viser f.eks indberet.asp?UserId=2
Som det er nu redirecter den bare til indberet.asp
Nogen der kan hjælpe mig?
-------------------------------------------------
<html>
<body>
<link REL="stylesheet" TYPE="text/css" HREF="style.css">
<%
'Response.Buffer = True
'strRedirect = Request.ServerVariables("HTTP_REFERER")
'Response.Redirect strRedirect
SET RS = Server.CreateObject("ADODB.Connection")
rs.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../database/data.mdb")
If Request("mode") = "Check" then
' Authes user, password, and fixed a known securitybug to many login systems.
strUsername = Trim(Replace(request("username"),"'","''" ))
strPassword = Trim(Replace(request("password"),"'","''" ))
Sql = "Select Count(*) as Found from users where (username = '" & strUsername & "') and (password ='" & strPassword & "')"
Set LO = RS.Execute(Sql)
if LO("Found") = 0 then
Session("login") = ""
error = "Ugyldigt brugernavn eller adgangskode "
else
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("../database/data.mdb")
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open strDSN
strSQL = "SELECT * FROM users where (username = '" & Request("username") & "') and (password ='" & Request("password") & "')"
Set ez = myConn.Execute(strSQL)
Session("Brugernavn") = ez("Username")
Session("login") = "Authed"
dim temp
temp = ez("info")
EZ.Close
RS.Close
End if
End if
if temp = "A" then
response.redirect("indberet.asp")
elseif temp = "B" then
response.redirect("login.asp")
end if
%>
<form method="POST" action="login.asp">
<input type="hidden" name="mode" VALUE="Check">
<table border="1" align="center" cellpadding="3" cellspacing="0" style="border-collapse: collapse" bordercolor="#000000" height="121" bgcolor="#F8F5EE">
<tr>
<td class="tekstboks"><span id="tekstboks">
<b>Brugernavn:</b><br>
<input class='forms' type='text' name='username' size='31' value="<%=strUsername%>"><br>
<b>Adgangskode:</b><br>
<input class="forms" type="password" value="<%=strpassword%>" name="password" size="31" ></font><br><br>
<div alig="left">
<input class="formsknap" type="submit" value="Log ind" name="submit"> </div>
<center><%=error%></center></span>
</td>
</tr>
</table>
</form>
</body>
</html>