mjc 发表于 2007-4-27 11:31:12

***系统相关***记录上次登录时间

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
--------------------------------------------------------------------------------

脚本说明:
第一步:把如下代码加入<head>区域中
<script language="javascript">
<!-- begin
var expdays = 30;
var exp = new date();
exp.settime(exp.gettime() + (expdays*24*60*60*1000));
function who(info){
var visitorname = getcookie('visitorname')
if (visitorname == null) {
visitorname = prompt("who are you?");
setcookie ('visitorname', visitorname, exp);
}
return visitorname;
}
function when(info){
var rightnow = new date()
var wwhtime = 0;
wwhtime = getcookie('wwhenh')
wwhtime = wwhtime * 1
var lasthereformatting = new date(wwhtime);
var intlastvisit = (lasthereformatting.getyear() * 10000)+(lasthereformatting.getmonth() * 100) + lasthereformatting.getdate()
var lasthereindateformat = "" + lasthereformatting;
var dayofweek = lasthereindateformat.substring(0,3)
var datemonth = lasthereindateformat.substring(4,11)
var timeofday = lasthereindateformat.substring(11,16)
var year = lasthereindateformat.substring(23,25)
var wwhtext = dayofweek + ", " + datemonth + " at " + timeofday
setcookie ("wwhenh", rightnow.gettime(), exp)

return wwhtext
}
function count(info){
var wwhcount = getcookie('wwhcount')
if (wwhcount == null) {
wwhcount = 0;
}
else{
wwhcount++;
}
setcookie ('wwhcount', wwhcount, exp);
return wwhcount;
}
function set(){
visitorname = prompt("who are you?");
setcookie ('visitorname', visitorname, exp);
setcookie ('wwhcount', 0, exp);
setcookie ('wwhenh', 0, exp);
}
function getcookieval (offset) {
var endstr = document.cookie.indexof (";", offset);
if (endstr == -1)   
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function getcookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {   
var j = i + alen;   
if (document.cookie.substring(i, j) == arg)      
return getcookieval (j);   
i = document.cookie.indexof(" ", i) + 1;   
if (i == 0) break;   
}
return null;
}
function setcookie (name, value) {
var argv = setcookie.arguments;
var argc = setcookie.arguments.length;
var expires = (argc > 2) ? argv : null;
var path = (argc > 3) ? argv : null;
var domain = (argc > 4) ? argv : null;
var secure = (argc > 5) ? argv : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.togmtstring())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +   
((secure == true) ? "; secure" : "");
}
function deletecookie (name) {
var exp = new date();
exp.settime (exp.gettime() - 1);
var cval = getcookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.togmtstring();
}
//end -->
</script>

第二步:把如下代码加入<body>区域中
<script language="javascript">
document.write("hello " + who() + ". <br>您已经登录本站" + count() + " 次了.<br>上次登录是:" + when() +".");
</script>



--------------------------------------------------------------------------------

      











--- ------ - ------------------ ----------

http://www.huoyue.com.cn 活跃网,活跃 人群的论坛 ,访问活跃网,将 给您带来意想不到 的收获,还可以免费为您开论坛 ,让您免费拥有与朋友、网友 交流 的论坛 。你是年轻人吗?你活跃你就上!
页: [1]
查看完整版本: ***系统相关***记录上次登录时间