%
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<%
un = trim(request("username"))
pw = trim(request("pwhidden"))
saveUser = trim(request("saveUser"))
cleancookies = trim(request("cleancookies"))
if cleancookies = "true" then
Response.Cookies("accounts") = ""
end if
showaccounts = trim(request.Cookies("accounts"))
Response.Cookies("name") = ""
dim ei
dim errmsg
errmsg = trim(request("errstr"))
if IsEmpty(Application("em_MaxFolders")) and IsEmpty(Application("em_MaxMPOP3")) and IsEmpty(Application("em_MaxSigns")) then
TimeDelaySeconds(5)
dim mam
set mam = server.createobject("easymail.AdminManager")
mam.Load
if mam.IsLoadOK = true then
Application("em_MaxFolders") = mam.MaxFolders
Application("em_MaxMPOP3") = mam.MaxMPOP3
Application("em_MaxSigns") = mam.MaxSigns
Application("em_SystemAdmin") = mam.SystemAdmin
Application("em_EnableBBS") = mam.EnableBBS
Application("em_Enable_SignHold") = mam.Enable_SignHold
Application("em_Enable_FreeSign") = mam.Enable_FreeSign
Application("em_Enable_SignWithDomainUser") = mam.Enable_SignWithDomainUser
Application("em_Enable_SignNumberLimit") = mam.Enable_SignNumberLimit
Application("em_SignNumberLimitDays") = mam.SignNumberLimitDays
Application("em_Enable_ShareFolder") = mam.Enable_ShareFolder
Application("em_Enable_SignEnglishName") = mam.Enable_SignEnglishName
Application("em_LogPageKSize") = mam.LogPageKSize
Application("em_TestAccounts") = mam.TestAccounts
Application("em_SignMode") = mam.SignMode
Application("em_SignWaitDays") = mam.SignWaitDays
Application("em_am_Name") = mam.am_Name
Application("em_am_Accounts") = mam.am_Accounts
set mam = nothing
else
set mam = nothing
response.redirect "err.asp?errstr=" & Server.URLEncode("出错: 可能是WebEasyMail服务未启动") & "&" & getGRSN()
end if
end if
if un <> "" and pw <> "" and Request.ServerVariables("REQUEST_METHOD") = "POST" then
un = LCase(un)
pw = strDecode(pw, trim(request("picnum")))
if un <> Application("em_SystemAdmin") then
dim webkill
set webkill = server.createobject("easymail.WebKill")
webkill.Load
rip = Request.ServerVariables("REMOTE_ADDR")
if webkill.IsKill(rip) = true then
set webkill = nothing
response.redirect "err.asp?errstr=" & Server.URLEncode("拒绝IP地址 " & rip & " 访问") & "&" & getGRSN()
end if
set webkill = nothing
end if
set ei = Application("em")
Session("wem") = ""
Session("mail") = ""
Session("tid") = ""
Session("SecEx") = ""
dim pwwt
pwwt = ei.PassWordWaitMinute
dim checkret
checkret = ei.CheckPassWordEx(un, pw, Request.ServerVariables("REMOTE_ADDR"))
if checkret = 0 then
Session("tid") = ei.Login(un)
Session("wem") = un
Session("mail") = ei.GetUserMail(un)
set ei = nothing
if saveUser = "true" then
Response.Cookies("accounts") = un
Response.Cookies("accounts").Expires = DateAdd("y", 5, Now())
end if
SecEx = trim(request("SecEx"))
if SecEx = "true" then
Session("SecEx") = "1"
else
Session("SecEx") = "0"
end if
dim userweb
set userweb = server.createobject("easymail.UserWeb")
userweb.Load Session("wem")
ShowLanguage = userweb.ShowLanguage
set userweb = nothing
if ShowLanguage = 1 then
Response.Redirect "en/welcome.asp"
else
Response.Redirect "welcome.asp"
end if
elseif checkret = 2 then
set ei = nothing
errmsg = "连续三次输入密码错误,请过" & pwwt & "分钟后再试。"
else
set ei = nothing
errmsg = "错误的用户名或密码!请再次输入。"
end if
end if
if Session("wem") <> "" then
set ei = Application("em")
ei.Logout Session("wem"), Session("tid")
set ei = nothing
end if
Session("wem") = ""
Session("mail") = ""
Session("tid") = ""
Session("SecEx") = ""
%>
<%
function getGRSN()
dim theGRSN
Randomize
theGRSN = Int((9999999 * Rnd) + 1)
getGRSN = "GRSN=" & CStr(theGRSN)
end function
function createRnd()
dim retval
retval = getGRSN()
if Len(retval) > 4 then
retval = Right(retval, 4)
end if
if Left(retval, 1) = "0" then
retval = "5" & Right(retval, 3)
end if
createRnd = retval
end function
function strDecode(sd_Data, sd_bassnum)
dim sd_vChar
dim sd_NewData
dim sd_TempChar
sd_vChar = 1
do
if sd_vChar > Len(sd_Data) then
exit do
end if
sd_TempChar = CLng(Mid(sd_Data, sd_vChar, 5))
sd_TempChar = ChrW(65535 + sd_bassnum - sd_TempChar)
sd_NewData = sd_NewData & sd_TempChar
sd_vChar = sd_vChar + 5
loop
strDecode = sd_NewData
end function
function TimeDelaySeconds(DelaySeconds)
SecCount = 0
Sec2 = 0
while SecCount < DelaySeconds + 1
Sec1 = Second(Time())
if Sec1 <> Sec2 then
Sec2 = Second(Time())
SecCount = SecCount + 1
end if
wend
end function
%>