%
'*******************************************************
' Version 5.00 Jan 2, 2002
' Handles customer login
'*******************************************************
dim dbc, url
dim forwardURL
dim strpassword, returnurl
strPassword=Request("strPassword")
stremail=request("stremail")
strLastname = Request.Form("strLastname")
' hacker fix
strlastname=replace(strlastname, "=","")
strpassword=replace(strpassword,"=","")
stremail=replace(stremail,"=","")
stremail=replace(stremail,"'","''")
strpassword=replace(strpassword,"'","")
'
returnurl=request("returnurl")
If strLastname = "" Then
If getconfig("xPasswordLastname")="Yes" or getconfig("Xpassword")="No" then
sError = sError & getlang("langLoginLastname") & "
"
end if
End If
if strEmail="" then
sError = sError & getlang("langLoginEmail") & "
"
end if
If ucase(getconfig("xpassword"))="YES" then
if strPassword="" then
sError = sError & getlang("langLoginPassword") & "
"
end if
end if
If Serror="" then
RetrieveLoginData
else
Serror= getlang("langCommonRequired") & "
" & Serror
end if
setsess "Loginerror",Serror
Setupreturnurl url
Response.redirect url
Sub RetrieveLogindata
Dim fieldvalue
If GetSess("Login")="" then
SetSess "Login","Force"
end if
LocateCustomer strLastName, stremail , strpassword
If strCustomerID <>"" then
LngLoginCount=lngLoginCount+1
UpdateCustomerSessionData
UpdateLoginData
SetSess "Login",strlastname
Else
SError = SError & getlang("langLoginLocateFail")
SetSess "Login", ""
' debugwrite "Not found"
end if
ShopCloseDatabase dbc
set rs=nothing
end sub
Sub UpdateLoginData
Dim dbc
'on error resume next
OpenCustomerDB dbc
'response.write "Login count" & lngLoginCount
sql = "update customers set "
sql = sql & "logincount=" & lnglogincount
'sql = sql & ",lastlogindate='" & date() & "'"
sql = sql & ",lastlogindate=" & datedelimit(date() )
sql = sql & " where contactid=" & strcustomerid
dbc.execute(sql)
ShopCloseDatabase dbc
end sub
'*****************************************************************
' determine where to go to
'*****************************************************************
Sub SetupReturnurl (url)
if returnurl<>"" then
if Serror="" then
url=returnurl
exit sub
else
url="shopcustadminlogin.asp"
end if
exit sub
end if
If Getsess("Followonurl")="" and getsess("Currenturl")="" then
If Serror="" then
url=getconfig("xhome")
else
url="shopcustadminlogin.asp"
end if
exit sub
end if
If Serror="" then
url=GetSess("FollowonURL")
else
url=getSess("CurrentURL")
end if
end sub
%>