%@ Language=VBScript %>
<% Call DefineScriptMessages %>
<%
Dim strMessage, strUsername, strPassword, strChecked
'On Error Resume Next
Session("UserID")="Guest"
Session("AccessLevel")=ACCESS_LEVEL_GUEST
If Request("action")="logout" then
Session.Abandon
Response.Redirect "login.asp"
end if
if Request("lang")<>"" then
Session("Language") = Request("lang")
Response.CharSet = "Windows-" & MultilangCodepage()
Session.CodePage = CInt(MultilangCodepage())
end if
If Request("btnSubmit") = "Login" Then
If Request("remember_password") = "1" Then
Response.Cookies("username") = Request("username")
Response.Cookies("username").Expires = DateAdd("y", 1, Now())
Response.Cookies("password") = Request("password")
Response.Cookies("password").Expires = DateAdd("y", 1, Now())
strChecked = " checked"
Else
Response.Cookies("username") = ""
Response.Cookies("password") = ""
strChecked = ""
End If
if cLoginMethod = LOGIN_HARDCODED then
' username and password are hardcoded
If StrComp(cPassword, Request("password"), vbBinaryCompare) = 0 _
and StrComp(cUserName, Request("username"), vbBinaryCompare) = 0 Then
Session("UserID") = Request("username")
Session("AccessLevel")=ACCESS_LEVEL_USER
if Session("MyURL")<>"" then
Response.Redirect Session("MyURL")
else
Response.Redirect Replace("menu.asp", "%20", " ")
end if
Else
strMessage = MultilangMessage("INVALID_LOGIN")
Session.Abandon
End If
else
' username and password are stored in the database
Set rs = server.CreateObject("ADODB.Recordset")
set dbConnection = server.CreateObject("ADODB.Connection")
dbConnection.ConnectionString = strConnection
dbConnection.Open
Call ReportError
strUsername = Replace(Trim(Request("username")),"'","''")
strPassword = Replace(Trim(Request("password")),"'","''")
Set rsTemp = server.CreateObject("ADODB.Recordset")
rsTemp.open "select * from " & cLoginTable & " where 1=0", dbConnection
if IfNeedQuotes(rsTemp(cUserNameField).Type)="True" _
then strUsername = "'" & strUsername & "'"
if IfNeedQuotes(rsTemp(cPasswordField).Type)="True" _
then strPassword = "'" & strPassword & "'"
strSQL = "select * from " & cLoginTable & " where " & AddWrappers(cUserNameField) & _
"=" & strUsername & " and " & AddWrappers(cPasswordField) & _
"=" & strPassword
rs.open strSQL, dbConnection
Call ReportError
If Not rs.EOF Then
while not rs.eof
if request("username")=CStr(rs(cUserNameField)) and request("password")=CStr(rs(cPasswordField)) then
Session("UserID") = Request("username")
Session("AccessLevel") = ACCESS_LEVEL_USER
if Request("username")=cAdminUserID then _
Session("AccessLevel") = ACCESS_LEVEL_ADMIN
if RemoveWrappers("Email")<>""then
Session("OwnerID") = rs("Email")
end if
if Session("MyURL")<>"" then
Response.Redirect Session("MyURL")
else
Response.Redirect Replace("menu.asp", "%20", " ")
end if
else
rs.MoveNext
end if
wend
strMessage = MultilangMessage("INVALID_LOGIN")
Session.Abandon
Else
strMessage = MultilangMessage("INVALID_LOGIN")
Session.Abandon
End If
end if
Else
strChecked = " checked"
End If
If Request("username") <> "" Then
strUsername = Request("username")
Else
strUsername = Request.Cookies("username")
End If
If Request("password") <> "" Then
strPassword = Request("password")
Else
strPassword = Request.Cookies("password")
End If
if Request("message")="expired" then
strMessage = MultilangMessage("SESSION_EXPIRED")
end if
%>