Login kvaler
Her er mit login script:<%
set Conn = SErver.CreateObject(\"ADODB.Connection\")
Dim userName, passWord, redirectPage
if( Request.ServerVariables(\"REQUEST_METHOD\") = \"POST\" ) then
Response.Cookies(\"MyCookie\")(\"userName\") = userName
userName = Request.Form(\"userName\")
passWord = Request.Form(\"passWord\")
Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\" & Server.MapPath(\"login.mdb\")
SQL = \"SELECT * FROM userTable WHERE username LIKE \'\" & userName & \"\' AND password LIKE \'\" & passWord & \"\'\"
Set RS = Conn.Execute( SQL )
if( NOT RS.EOF ) then
response.redirect( RS(\"redirectPage\") )
end if
end if
%>
<html><title>www.xxxxx.dk - Kunde - Log ind</title>
<body>
<p align=\"center\"><img src=\"images/infostat.gif\"></p>
<p align=\"center\"><font face=\"Arial, Helvetica, sans-serif\" size=\"2\"><b>Statistik
log ind</b></font><br>
</p>
<form action=\"\" method=\"POST\">
<div align=\"center\">
<input type=\"text\" name=\"userName\">
<br>
<input type=\"text\" name=\"passWord\">
<br>
<input type=\"submit\" value=\"Log ind\">
<br>
</div>
</form></body>
</html>
På siderne der er beskyttet via cookie har jeg dette i toppen:
<%
Dim strUserAllowed, arrUserAllowed, userName, found
found = false
strUserAllowed = \"user1,user2\"
arrUseAllowed = Split(strUserAllowed,\",\")
userName = Request.Cookies(\"MyCookie\")(\"userName\")
for i=LBound(arrUseAllowed) To UBound(arrUseAllowed)
if arrUseAllowed(i) = userName then
found = true
exit for
end if
next
if NOT found then
response.redirect \"http://www.xxxxxx.dk/login.asp\"
end if
%>
Af en eller anden grund bliver der ikke sat en cookie så jeg kan ikke logge ind men bliver smidt tilbage til login.asp.
Hjælp