Torgath
Mitglied
Ich hab ein Login-Script aus dem I-Net versucht ein wenig anzupassen, aber richtig klappen will es nicht...
Hier mal der Code:
default.asp:
logincheck.asp
Zum zeigen in welchem Ordner die DB steckt:
getadog\admin\db\gad.asp
Das es nicht richtig funktioniert sieht man im Moment hier: http://asp.se-dd.com/getadog/admin
Problem: Ich will mich einloggen mit dem Benutzernamen Testuser und dem Password zelda2 aber er gibt mir immer an, das es falsch sei...
Woran könnte es liegen? Ich suche schon seit Stunden und finde nichts!
Danke schonmal für Hilfe...
Hier mal der Code:
default.asp:
Code:
<% @ Language="VBScript"
LCID = 1031 %><%
Option Explicit
Response.Buffer = true
Session.LCID = 1031
Response.Expires=0
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-control", "private"
Response.Expires = 0
Response.Expiresabsolute = Now() - 1000
Response.CacheControl = "no-cache"
Public Steps, User_Name, User_Password, blnError, strSite
strSite = Request("Sites")
Steps = Request.Form("Steps")
User_Name = Request.Form("User_Name")
User_Password = Request.Form("User_Password")
blnError = false
If len(Steps) > 0 Then
If len(User_Name) > 0 AND len(User_Password) > 0 Then
Call Steps2(strSite, blnError, User_Name, User_Password, Steps)
Else
blnError = true
Call LoginMaske(strSite, blnError)
End if
Else
Call LoginMaske(strSite, blnError)
End if
Private Sub LoginMaske(ByRef strSite, ByRef blnError) %>
<html>
<head>
<title>
Login
</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
</head>
<body>
<table align="center">
<form action="default.asp" method="post" id="form2" name="form2">
<input type="hidden" name="Steps" id="Steps" value="2">
<input type="hidden" name="Sites" id="Sites" value="<%=strSite%>">
<tr>
<th colspan="2" align="center">
Einloggen
</th>
</tr>
<tr>
<td>
Name:
</td>
<td>
<input type="text" size="40" name="feld2" id="User_Name" name="User_Name">
</td>
</tr>
<tr>
<td>
Passwort:
</td>
<td>
<input type="password" size="40" name="pass1" id="User_Password" name="User_Password">
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" value="Login" id="submit2" name="submit2" style="width:100px;">
</td>
</tr>
<% If blnError Then %>
<tr>
<td align="center" colspan="2">
Fehler: Name oder Passwort fehlt bzw. ist falsch
</td>
</tr>
<% End if %>
</form>
</table>
</body>
<%
End Sub
Private Sub Steps2(byref strSite, byref blnError, byref User_Name, byref User_Password, byref Steps)
Dim cn, rs, strConn, strSQL, LoginOK
set rs = Server.CreateObject("ADODB.Recordset")
set cn = server.CreateObject("ADODB.Connection")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath(".") & "\admin\db\gad.mdb;"
strSQL = "SELECT " & "tbl_member.id, " & "tbl_member.username, " & "tbl_member.password " & "FROM tbl_member WHERE " & "tbl_member.username='" & SQLEncode(User_Name) & "' " & "AND tbl_member.password='" & SQLEncode(User_Password) & "'"
rs.Open strSQL, strConn, 3, 1
LoginOK = false
if not rs.EOF then
if rs.RecordCount = 1 then
if User_Name = rs.Fields(1).Value and User_Password = rs.Fields(2).Value then
LoginOK = true
end if
end if
end if
rs.Close
set rs = nothing
If LoginOK Then
Session("Login") = true
If NOT len(strSite) > 0 Then
strSite = "test.asp"
End if
Response.Redirect(strSite)
Else
blnError = true
Call LoginMaske(strSite, blnError)
end if
End Sub
%>
logincheck.asp
Code:
<%
call logincheck()
public function logincheck()
dim strSite
strSite = Request.ServerVariables("SCRIPT_NAME")
if instr(1, strSite, "/") > 0 then
strSite = right(strSite, len(strSite) - instrrev(strSite, "/", -1))
end if
if not Session("Login") = true then
Response.Redirect("default.asp?Sites=" & strSite)
end if
end function
%>
Zum zeigen in welchem Ordner die DB steckt:
getadog\admin\db\gad.asp
Das es nicht richtig funktioniert sieht man im Moment hier: http://asp.se-dd.com/getadog/admin
Problem: Ich will mich einloggen mit dem Benutzernamen Testuser und dem Password zelda2 aber er gibt mir immer an, das es falsch sei...
Woran könnte es liegen? Ich suche schon seit Stunden und finde nichts!
Danke schonmal für Hilfe...