<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><%
If Request.Form("Action") = "Login" Then
stripQuotesUID=Request.Form("Brugernavn")
stripQuotesPWD=Request.Form("Adgangskode")
strUID = replace(stripQuotesUID, "'", "")
strPWD = replace(stripQuotesPWD, "'", "")
dim badChars
dim newChars
dim coun
badChars = array("select", "drop", ";", "--", "insert", "delete", "xp_")
newChars = strUID
for coun = 0 to uBound(badChars)
newChars = replace(newChars, badChars(coun), "")
next
If Len(newChars) > 0 And Len(strPWD) > 0 Then
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open "Driver={SQL Server};Server=[lokal ip adresse];Database=[databasenavn];Uid=[bruger];Pwd=[password];"
strSQL = "SELECT Usernr FROM Adgang WHERE (Userid = '" & newChars & "') AND (Password = '" & strPWD & "')"
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
intUID = rs("Usernr")
Else
strERR = "Du blev ikke godkendt af systemet"
End If
myConn.Close
Set myConn = Nothing
If Len(intUID) Then
Session("Usernr") = intUID
Response.Redirect("success/komind.asp")
End If
Else
strErr = "Du skal skrive både brugernavn og adgangskode"
End If
If Len(strErr) > 0 Then
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%>
<p>
<table border="0">
<tr>
<td width="50%">Brugernavn:</td>
<td width="50%"><input type="text" name="Brugernavn" size="20"></td>
</tr>
<tr>
<td width="50%">Adgangskode:</td>
<td width="50%"><input type="password" name="Adgangskode" size="20"></td>
</tr>
</table>
<p><input type="submit" value="Login" name="Action"></p>
</form>
<p>Kan du ikke komme ind , kontakt da vores it afdeling ved at klikke
<%
response.write("<a href='mailto:[min mail adresse]?subject=Loginfejl hjemmeside'>HER.</a></p>")
%>
</body></html>
Jeg har sat alle de "hemmelige" oplysninger i []
Grunden til at jeg har response.write på min mail adresse, er fordi jeg har hørt at dette kan hjælpe imod SPAM. Passer det?