首頁 >web前端 >js教程 >JS記錄使用者登入次數實現程式碼_javascript技巧

JS記錄使用者登入次數實現程式碼_javascript技巧

WBOY
WBOY原創
2016-05-16 17:03:341644瀏覽
複製程式碼如下程式碼:

function www_helpor_net(offset) {

function www_helpor_net(offset) {
var end = documdent. .indexOf(";", 偏移);
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 var j = i alen;
if (document.cookie.substring(i, j) == arg)
return www_helpor_net(jj );
i = document.cookie.indexOf(" ", i) 1;
if (i == 0)
中斷;
}
回空;
}

function SetCookie(name, 值) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var 過期= (2 var 路徑= (3 var 域= (4 var secure = (5 document.cookie = name
"=
escape(value)
((expires == null) ? "" : ("; expires= expires
.toGMTString()) )
((path == null) ? "" : ("; path="path))
((domain == null) ? "" : ("; domain="domain))
((安全== true) ? "; 安全" : "");
}
var expdate = new Date();
var 存取;
expdate.setTime(expdate.getTime() (24 * 60 * 60 * 1000 * 365)); //設定COOKIES時間為1年,自己方便設定該時間
if (!(visits = GetCookie("visits" ))) {
visits = 0;
}
var oldjessionid = GetCookie("OLDJSESSIONID");
if (!oldjessionid) {
oldjessionid = "111";
var newjessionid = GetCookie("JSESSIONID");
if (oldjessionid != newjessionid) {
存取;
SetCookie("OLDJSESSIONID", newjessionid, expdate "/al" ;
SetCookie("存取", 存取, expdate, "/", null, false);
}

//以下資訊顯示可以使用標準的HTML語法,自行方便設定

document.write("你已經光臨本頁" " "訪問"""次! ");

//當登入次數達到三次,就自動呼叫函數,隱藏彈出框,如果只要記錄登入次數,下邊代碼可以忽略
if (visits > 3) {
setInterval ("更改H('向下')", 2);
} */
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn