男人尿泡沫多什么原因:vb怎样在cookies加密的网页中输入用户名密码

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/09 20:43:09
function saveCookie(name, value, expires, path, domain, secure){
var strCookie = name + "=" + value;
if (expires){
// caculate Cookie expire time, parameters : days
var curTime = new Date();
curTime.setTime(curTime.getTime() + expires*24*60*60*1000);
strCookie += "; expires=" + curTime.toGMTString();
}
// Cookie path
strCookie += (path) ? "; path=" + path : "";
// Cookie?omain
strCookie += (domain) ? "; domain=" + domain : "";
// need send by security , boolean value
strCookie += (secure) ? "; secure" : "";
document.cookie = strCookie;
}
function getCookie(name){
var strCookies = document.cookie;
var cookieName = name + "="; // Cookie name
var valueBegin, valueEnd, value;
// search Cookie name
valueBegin = strCookies.indexOf(cookieName);
if (valueBegin == -1) return null; // no this Cookie
// get the situation of this value
valueEnd = strCookies.indexOf(";", valueBegin);
if (valueEnd == -1)
valueEnd = strCookies.length; // last Cookie
// get Cookie value
value = strCookies.substring(valueBegin+cookieName.length,valueEnd);
return value;
}

function doCookie()
{
username = document.loginForm.user.value;
password = document.loginForm.pswd.value;
saveCookie("username", username,1);
saveCookie("password", password,1);
window.location.href=sysIpAddress;
}

saveCookie("username","",-1);
saveCookie("password","",-1);
//-->
</script>
<style type="text/css">
<!--
.dialog {
background-color: #EFEFEF;
border: 1px solid #000000;
}
table {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
th {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #FFFFFF;
background-color: #006699;
height: 23px;
}
-->
</style>
</HEAD>
<body bgcolor="#e1e9f4" onLoad="" leftmargin="20" topmargin="20">
<CENTER>
<form name="loginForm" method="post" action="home.htm">
<table width="350" border="0" cellpadding="1" cellspacing="3" class="dialog">
<tr>
<th colspan="2" align="center" style=" color:#FFFFFF; background-color:#006699"><strong>Web user login</strong></td>
</th>
<tr>
<td width="90"> </td>
<td width="250"> </td>
</tr>
<tr>
<td align="right">User Name  </td>
<td><input name="user" type="text" maxlength="8" style="width:150"></td>
</tr>
<tr>
<td align="right">Password  </td>
<td><input name="pswd" type="password" maxlength="8" style="width:150"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<p>
<input type="button" onClick="doCookie()" value="Login" style="width:80">
</p>
</form>
</CENTER>
</body>
</html>