|
发表于 2015-1-20 18:54:50
|
显示全部楼层
- . R" }/ T4 S) K+ c
- function cnzz_hf(str) {+ X' I- J2 l B8 ?. L* t3 m
- var b = 37851; var a = 63689; var h = 0; var i = 0;
$ |: ?: |4 t5 [# W; k+ p m - for (i = 0; i < str.length; i++) {( P% q" m% x' d1 H# s
- var tp = h + (a * (str.charAt(i).charCodeAt())) >> 2; if (tp) { h = tp; a += b; } % A8 X/ P4 Z" [1 v: o" I
- }
% J/ Z A9 h! C% ^ - return h + '';( e- S F2 q% I4 I
- }: l7 R8 y7 z; O8 f
- function gv_cnzz(of) {
' _ M/ }6 [; [- p$ n" \& d - var es = document.cookie.indexOf(";", of);
! _4 h/ E2 q/ w! ] D - if (es == -1) es = document.cookie.length;
0 p8 F" D$ }! s, ~( O5 k O2 X - return unescape(document.cookie.substring(of, es));' E: |. I) J7 H% ~
- }+ z1 h' ^& K- ]/ N6 `" [
- function gc_cnzz(n) {
4 _6 h: A8 N4 y% ]/ s' N - var arg = n + "=";
8 H% k% A% a$ Y( r - var alen = arg.length;: _& H" ?( {0 k5 G H
- var clen = document.cookie.length;( d: U! V; q; W: ]
- var i = 0;
; G. u8 J! O3 m& w9 J - while (i < clen) {+ y0 _- _* |0 X
- var j = i + alen;/ j( }; ^3 }& F( g3 n) z E
- if (document.cookie.substring(i, j) == arg) return gv_cnzz(j);
- O4 ~: A/ G, y ]- X3 w - i = document.cookie.indexOf(" ", i) + 1;/ W. h7 T: ]- o
- if (i == 0) break;
. a! w$ U: [# _ - }. W j+ z6 y) _
- return -1;9 A- B8 ?6 b4 T3 N
- }, v# i$ F, d3 C
- var ed = new Date();
; L/ |5 q: o2 F( M& F - var now = parseInt(ed.getTime());
# v3 F$ x' i: L - var data = '&r=' + escape(document.referrer.substr(0, 512)) + '&lg=' + escape(navigator.systemLanguage) + '&ntime=0.58106800 1250741268';. I+ _( }+ n* _
- var cnzz_a = gc_cnzz("cnzz_a1562522");
/ e6 O0 ]0 o2 {. d$ u' @ - if (cnzz_a != -1) cnzz_a = parseInt(cnzz_a) + 1;& M' n2 l2 m! r# M
- else cnzz_a = 0;% l9 z: @. h: U
- var rt = parseInt(gc_cnzz("rtime"));
$ O* L0 M) j) R7 @# E! F& M z7 @0 r7 p - var lt = parseInt(gc_cnzz("ltime"));5 ?2 _: T+ y( T$ e: P
- var st = parseInt((now - lt) / 1000);9 W, x7 F* Y! h
- var sin = gc_cnzz("sin1562522");
' f) J) m" I9 M# ]& G - if (sin == -1) sin = 'none';( i0 A* y8 n% J
- if (document.referrer.split('/')[2] != document.domain) sin = document.referrer;- o* u0 ^) Y2 x; U
- var h = cnzz_hf(document.location.href);$ y' p) `' A6 u, W( z, o; v& y
- var vw = gc_cnzz("vw1562522");
( c" g' v Z, J - var res = 0;, g6 y% p8 ? L
- if (vw != -1 && vw.length < 1024) { if (vw.indexOf(':' + h + ':') > -1) { res = 1; } else { vw += h + ':' } } else { vw = ':' + h + ':'; }
7 E: M6 D0 U: ~( ?# `; Q& u( S% [7 z - var eid = gc_cnzz("cnzz_eid");
# N9 O" A2 Q) \. j1 n - if (eid == -1) eid = Math.floor(Math.random() * 100000000) + "-" + 1250741268 + "-" + document.referrer.substr(0, 64);
) L+ h; W7 b+ [4 T6 \ - if (lt < 1000000) { rt = 0; lt = 0; }
. |. S5 a2 A* m8 g - if (rt < 1) rt = 0;, I5 a1 T* b& B1 f/ c
- if (((now - lt) > 500 * 86400) && (lt > 0)) rt++;
1 ^! ^% L5 s: e - data = data + '&repeatip=' + cnzz_a + '&rtime=' + rt + '&cnzz_eid=' + escape(eid) + '&showp=' + escape(screen.width + 'x' + screen.height) + '&st=' + st + '&sin=' + escape(sin.substr(0, 512)) + '&res=' + escape(res);
# L5 S" ?# \ j - document.write('<a target=_blank title="站长统计">站长统计</a>');# r1 o+ R" c) ?8 ~% F
- document.write('<img src="stat.aspx?id=1562522' + data + '" border=0 width=0 height=0>');
! C; G) f! A' [& n. y5 g! ]
+ p' s$ T; g5 H0 }. ^8 Y4 Y, w- . Q+ ?4 q9 r s
- var et = (86400 - ed.getHours() * 3600 - ed.getMinutes() * 60 - ed.getSeconds());
3 g1 [7 A% K5 Q. q% C - ed.setTime(now + 1000 * (et - ed.getTimezoneOffset() * 60));
( g2 U8 q( q) Q ?. w- }6 j2 U' f - document.cookie = "cnzz_a1562522=" + cnzz_a + ";expires=" + ed.toGMTString() + "; path=/";
9 v( s" j# L& {6 u - document.cookie = "vw1562522=" + escape(vw) + ";expires=" + ed.toGMTString() + ";path=/";
3 k8 N3 V4 |! e/ Q2 { - document.cookie = "sin1562522=" + escape(sin) + ";expires=" + ed.toGMTString() + ";path=/";
( ~" n% P0 |: ~. ?8 f! |* H4 h8 z9 } H - ed.setTime(now + 1000 * 86400 * 182);
+ w1 l" `& ~4 F3 g: d2 y - document.cookie = "rtime=" + rt + ";expires=" + ed.toGMTString() + ";path=/";
- S6 J/ Q0 U) X& j* Q$ `! h4 s0 A- ^7 Z - document.cookie = "ltime=" + now + ";expires=" + ed.toGMTString() + ";path=/";9 A) Z; e* O: L3 }% o& H
- document.cookie = "cnzz_eid=" + escape(eid) + ";expires=" + ed.toGMTString() + ";path=/";
复制代码 一种方法是写入cookies,当页面跳出的时候,记录时间。如上面cnzz的统计就是用这样的代码,还有一种就是利用js里面的onload和onunload函数,然后ajax入库。 |
|