Forums

ASP

This topic is locked

Can you locate any errors?

Posted 03 May 2002 15:07:06
1
has voted
03 May 2002 15:07:06 Peter Elkjaer posted:
because it doesnt work..

<%
' If button "login" is pushed on
If Request.Form("Action" = "Login" Then
' Her forberedes de indtastede værdier til validering
strPWD = Trim(Replace(Request.Form("Adgangskode","'","")

' If username and password has been written to
If Len(strPWD) > 0 Then

' DSNLess conn
Set myConn = Server.CreateObject("ADODB.Connection"
myConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("serviceaftale/serviceaftale.mdb"

' SQL streng
strSQL = "SELECT * FROM login"&_
" WHERE (Pasord = '" & strPWD & "')"


Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
' Hvis brugeren fandtes i databasen
intUID = rs("PersonID"
intTRAN = rs("Targetwebsite"


Else
' If user does not exist
strERR = "Du blev ikke godkendt af systemet"
End If

' Cleans connections
myConn.Close
Set myConn = Nothing

If Len(intUID) Then
' Hvis variablen intUID indeholder en værdi sættes denne i sessionen "UserID" og brugeren bliver sendt videre
Session("PersonID" = intUID
Response.Redirect intTRAN
End If
Else
' If no password is entered
strErr = "Du skal skrive adgangskode"
End If

If Len(strErr) > 0 Then
' Convert error message to red text
strErr = "<p><font color=red>" & strErr & "</font></p>"
End If
End If
%>
<html><head>
<title>Login script</title>
</head>

<body>
<form method="POST" action="login.asp">
<p><font size="4">Angiv brugernavn og adgangskode</font></p><%=strErr%>
<table border="0">

<tr>
<td width="50%">Adgangskode:</td>
<td width="50%"><input type="password" name="Adgangskode" size="20">
(test)</td>
</tr>
</table>
<p><input type="submit" value="Login" name="Action"></p>
</form>
url
</body></html>

Replies

Replied 03 May 2002 20:55:47
03 May 2002 20:55:47 Peter Elkjaer replied:
Found the problem myself <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic