Winwebmail 企业邮局外部登录代码

2009-11-25 浏览:1551
Winwebmail 企业邮局外部登录代码
评论:(0)复制地址

为了可以在您网站首页上或其他页面输入用户名以及密码后直接进入邮箱,您可以参考以下最简化登录页面,并将其溶入您自己的页面中。(注意:适用于 3.5.2.1 及更高版本)

1、HTML格式文件(注意:请将action中的http地址替换为有效路径):
 

<html>
<title>登录WebMail</title>

<SCRIPT LANGUAGE=javascript>
<!--
function gook() {
 f1.pwhidden.value = encode(f1.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>


<!--
请用有效路径替换下一行中的http地址
//-->
<form name="f1" method="post" action="http://localhost/webmail/default.asp">
用户名:<input type="text" name="username">
<input type="hidden" name="pwhidden">
<br>
密&nbsp;&nbsp;码:<input type="password" name="pwshow">
<input type="hidden" name="picnum" value="7652">
</form>
<input type="button" value="提交" onclick="javascript:gook()">
</html>
 

2、ASP格式文件(注意:请将root.asp中的yourSite变量替换为您服务器上WebMail的URL路径):
 

<%
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>


<%
dim yourSite
yourSite = "http://localhost/"


Session("wem") = ""
Session("mail") = ""
Session("tid") = ""
Session("SecEx") = ""
%>

<html>

<SCRIPT LANGUAGE=javascript>
<!--
function gook() {
 if (document.getElementById("usernameshow").value == "")
 {
  alert("用户名不可为空");
  document.getElementById("usernameshow").focus();
  return ;
 }

 if (document.getElementById("pwshow").value == "")
 {
  alert("密码不可为空");
  document.getElementById("pwshow").focus();
  return ;
 }

 f1.username.value = document.getElementById("usernameshow").value;
 f1.pwhidden.value = encode(document.getElementById("pwshow").value, parseInt(f1.picnum.value));
 f1.SecEx.value = document.getElementById("showSecEx").checked;

 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>
<form name="f1" method="post" action="<%=yourSite %>default.asp">
<input type="hidden" name="username">
<input type="hidden" name="pwhidden">
<input type="hidden" name="picnum" value="<%=createRnd() %>">
<input type="hidden" name="SecEx">
</form>
用户名:<input type="text" id="usernameshow" name="usernameshow" maxlength="64" class="textbox">
<br>
密&nbsp;&nbsp;码:<input type="password" id="pwshow" name="pwshow" maxlength="32" class="textbox">
<br>
<input type="checkbox" id="showSecEx" name="showSecEx">增强安全性
&nbsp;&nbsp;&nbsp;
<a href="<%=yourSite %>forgetbf.asp?<%=getGRSN() %>">忘记密码</a>
<br><br>
<input class="Bsbttn" type=submit value="确定" onclick="javascript:gook()">
</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
%>
 

3.打开新窗口

<form name="f1" method="post" action="<%=yourSite %>default.asp">
改为:
<form name="f1" method="post" target="_blank"  action="<%=yourSite %>default.asp">

评论:(0)复制地址

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。