论坛: 网站建设 标题: 关于一段ASP(求教) 复制本贴地址    
作者: gerry [gerry]    版主   登录
下面是一个ASP页面的代码,准确的说,是Webmail的登录页。不知道哪段是定义其不能作为框架的一部分,我怎么改都不成,特此求教各位大侠
<%
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_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_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 "outerr.asp?errstr=" & Server.URLEncode("超时, 请重试") & "&" & 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 "outerr.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") = ""
Session("scpw") = ""
Session("cert_ca") = ""


dim pwwt
pwwt = ei.PassWordWaitMinute

dim checkret
checkret = ei.CheckPassWordEx(un, pw, Request.ServerVariables("REMOTE_ADDR"))

if checkret = 0 then
if un = Application("em_SystemAdmin") and ei.CheckAdminIP(Request.ServerVariables("REMOTE_ADDR")) = false then
set ei = nothing

errmsg = "管理员登录IP地址错误。"
else
Session("tid") = ei.Login(un)
Session("wem") = un
Session("mail") = ei.GetUserMail(un)
set ei = nothing

dim mri
set mri = server.createobject("easymail.MoreRegInfo")
mri.LoadRegInfo un
mri.CurrentlyIP = Request.ServerVariables("REMOTE_ADDR")
mri.SaveRegInfo
set mri = 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
end if
elseif checkret = 2 then
set ei = nothing

errmsg = "连续三次输入密码错误,请过" & pwwt & "分钟后再试。"
else
set ei = nothing

errmsg = "错误的用户名或密码!请再次输入。"
end if
end if

if trim(request("logout")) = "true" then
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") = ""
Session("scpw") = ""
Session("cert_ca") = ""
end if
%>

<html>
<head>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=gb_2312-80">
<title>宝峰企业邮局系统</title>
<LINK href="images\hwem.css" rel=stylesheet>

<SCRIPT LANGUAGE=javascript>
<!--
if (top.location !== self.location) {
top.location=self.location;
}

function window_onload() {
<%
if showaccounts = "" then
%>
usernameshow.focus();
<%
else
%>
pwshow.focus();
<%
end if

if errmsg <> "" then
%>
alert("<%=errmsg %>");
<%
end if
%>
}

function gook() {
<%
if showaccounts = "" then
%>
if (usernameshow.value == "")
{
alert("用户名不可为空");
usernameshow.focus();
return ;
}
<%
end if
%>
if (pwshow.value == "")
{
alert("密码不可为空");
pwshow.focus();
return ;
}

<%
if showaccounts = "" then
%>
f1.saveUser.value = showsaveUser.checked;
f1.username.value = usernameshow.value;
<%
else
%>
f1.username.value = "<%=showaccounts %>";
<%
end if
%>
f1.SecEx.value = showSecEx.checked;
f1.pwhidden.value = encode(pwshow.value, parseInt(f1.picnum.value));

f1.submit();
}

function encode(datastr, bassnum) {
var tempstr;
var tchar;
var newdata = "";

for (var i = 0; i < datastr.length; i++)
{
tchar = 65535 + bassnum - datastr.charCodeAt(i);
tchar = tchar.toString();

while(tchar.length < 5)
{
tchar = "0" + tchar;
}

newdata = newdata + tchar;
}

return newdata;
}
//-->
</SCRIPT>
</head>

<body LANGUAGE=javascript onload="return window_onload()">
<br><br>
<p align="center"><font color="#000099">*[本邮局仅供宝峰公司员工及合作伙伴使用]*</font></p>
<form name="f1" method="post" action="default.asp">
<input type="hidden" name="username">
<input type="hidden" name="pwhidden">
<input type="hidden" name="picnum" value="<%=createRnd() %>">
<input type="hidden" name="saveUser">
<input type="hidden" name="SecEx">
</form>
<table cellspacing=0 cellpadding=0 width=350 align=center border=0>
  <tbody>
  <tr>
    <td valign=bottom align=right width=347 rowspan=2>
      <table cellspacing=0 cellpadding=0 width="100%" border=0 style="BORDER-RIGHT: #333333 1px solid; BORDER-TOP: #333333 1px solid; BORDER-LEFT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid;">
        <tbody>
        <tr align="middle" bgcolor="#3280BE">
          <td colspan=4 height=35 style="BORDER-BOTTOM: #333333 1px solid;"><b><font
            color=#ffffff>欢迎使用宝峰企业邮局系统</font></b></td>
        </tr>
        <tr>
          <td colspan="4" height="20">&nbsp;</td>
        </tr>
        <tr>
<td colspan="3" nowrap height="30" width="56">
</td><td nowrap><font class="s"><%
if showaccounts = "" then
%><b>用户名:&nbsp;</b></font><input type="text" name="usernameshow" maxlength="64" class="textbox"><%
else
%><b>用户名:&nbsp;</b></font><b><font class="s" color="#000099"><%=showaccounts %></font></b><%
end if
%>          </td>
        </tr>
        <tr>
          <td colspan="3" nowrap height="30"></td><td nowrap>
<font class="s"><b>密&nbsp;&nbsp;码:&nbsp;</b></font><input type="password" name="pwshow" maxlength="32" class="textbox">
          </td>
        </tr>
<%
if showaccounts = "" then
%>
        <tr valign="bottom">
          <td colspan="4" nowrap align="center" height="30"><font class="s" color="#000000"><input type="checkbox" name="showSecEx">增强安全性&nbsp;&nbsp;
<input type="checkbox" name="showsaveUser">记住用户名</font>
          </td>
        </tr>
<%
else
%>
        <tr valign="bottom">
          <td colspan="4" nowrap align="center" height="30">
<font class="s" color="#000000"><input type="checkbox" name="showSecEx">增强安全性&nbsp;&nbsp;
<a href="default.asp?cleancookies=true">改用其他身份登录</a></font>
          </td>
        </tr>
<%
end if
%>
</td>
        <tr>
<td colspan="4" nowrap align="right" height="60">
<input class="Bsbttn" type=submit value=" 确定 " onclick="javascript:gook()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
        </tr>
        </tbody>
      </table>
    </td>
    <td width=1 bgcolor=#ffffff height=5></td>
    <td width=1 bgcolor=#ffffff height=5></td>
    <td width=1 bgcolor=#ffffff height=5></td>
  </tr>
  <tr>
  </tr>
  <tr valign=top align=right>
    <td colspan=4>
      <table cellspacing=0 cellpadding=0 width="345" border=0>
        <tbody>
        </tbody>
      </table>
    </td>
  </tr>
  <tr valign=center align=right>
    <td colspan=4 height=35>&nbsp;</td>
  </tr>
  </tbody>
</table>

<div align="center">
  <table width="35%" border="0">
<tr><td align="center"><%
if Application("em_Enable_FreeSign") = true then
%>[<b><a href="create.asp?<%=getGRSN() %>">申请邮箱</a></b>]&nbsp;&nbsp;&nbsp;<%
end if
%>[<b><a href="forgetbf.asp?<%=getGRSN() %>">忘记密码</a></b>]
</td></tr>
<tr><td height="15">
</td></tr>
<tr>
      <td align="center" nowrap height="25">
<a href="http://mail.baof.com.cn" target="_blank">宝峰企业内部网站</a>
      </td>
</tr>
<tr>
      <td align="center" nowrap>
<a href="mailto:ma@winwebmail.com">版权所有:&nbsp;马坚</a>
      </td>
    </tr>
  </table>
</div>
</body>
</html>


<%
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
%>


地主 发表时间: 06-02-21 21:09

回复: Aoming [aoming]   版主   登录
if (top.location !== self.location) {
top.location=self.location;
}


B1层 发表时间: 06-02-22 14:16

回复: NetFog [q70213526]   版主   登录
楼上正解

B2层 发表时间: 06-02-22 20:10

回复: gerry [gerry]   版主   登录
谢了哦!老兄

B3层 发表时间: 06-02-23 22:20

论坛: 网站建设

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号