|
发表于 2015-1-20 18:54:50
|
显示全部楼层
- . P0 l' v% G: ~' b! j4 o7 d
- function cnzz_hf(str) {8 u0 h" }8 x" x: I: W3 [) [
- var b = 37851; var a = 63689; var h = 0; var i = 0;
/ [+ Q2 ~4 S2 x: ~ - for (i = 0; i < str.length; i++) {
* [/ T0 S) B" f0 H; @( g - var tp = h + (a * (str.charAt(i).charCodeAt())) >> 2; if (tp) { h = tp; a += b; } : s$ ^+ ~4 g4 i) W
- }
0 e% j# L7 O9 V9 {$ \0 ` - return h + '';
, Z9 e! U) N% ^- ~4 z - }/ h& z( Y r/ w# [8 R0 x5 x
- function gv_cnzz(of) {- g3 G' [/ {7 S# B$ \0 W3 @
- var es = document.cookie.indexOf(";", of);" g% ~# `* d; K: s N4 V2 q4 k, ^
- if (es == -1) es = document.cookie.length;% O& N) l" o9 o9 x
- return unescape(document.cookie.substring(of, es));. A8 j# i' l) c8 A; `9 u
- }! D& d% [7 E4 u3 O
- function gc_cnzz(n) {
: @$ _. r0 S" c' N - var arg = n + "=";
. _' t9 [) O8 V$ } X - var alen = arg.length;) H9 [/ b3 }5 {' @ X/ k
- var clen = document.cookie.length;
: ~/ u" o8 m; D# l. s1 \9 W, v5 O - var i = 0;
% C c K7 u8 n, G/ R - while (i < clen) {% W% E8 s& {1 k) G- m5 f( @5 T) S
- var j = i + alen;
2 k" h' C* C# p- p - if (document.cookie.substring(i, j) == arg) return gv_cnzz(j);
5 P0 I9 Q$ \* c$ \ - i = document.cookie.indexOf(" ", i) + 1;
: _; g2 n9 e, i7 B - if (i == 0) break;
4 E, p. j% ~2 K1 ^ - }
2 G: v& ]8 z1 f. b" O - return -1;+ V, T* e4 m5 _, b0 Y$ E/ B/ \
- }+ B% a. T2 ~# K8 ]9 g8 j
- var ed = new Date();* d: g6 Z$ Z! ?# u' v
- var now = parseInt(ed.getTime());/ H$ {7 E2 t+ w" O8 z, J9 O
- var data = '&r=' + escape(document.referrer.substr(0, 512)) + '&lg=' + escape(navigator.systemLanguage) + '&ntime=0.58106800 1250741268';
% P0 n: O( K+ ^ - var cnzz_a = gc_cnzz("cnzz_a1562522");
2 `) T* m4 x R% N+ F( c* q - if (cnzz_a != -1) cnzz_a = parseInt(cnzz_a) + 1;
: r4 x/ L* W [ y5 v3 p0 R1 K - else cnzz_a = 0;
5 V e" c% q! Y# p - var rt = parseInt(gc_cnzz("rtime"));
2 h6 z' c, J3 L, A I' Y9 B - var lt = parseInt(gc_cnzz("ltime"));/ ?0 C+ H1 n8 V& c. i' o' t0 A# [ F
- var st = parseInt((now - lt) / 1000);
[: @# z2 r6 U4 |/ ? f& c4 I - var sin = gc_cnzz("sin1562522");' H1 ^. l% ?" W; }
- if (sin == -1) sin = 'none';3 D1 o8 h+ g; Q+ b! o8 D% X
- if (document.referrer.split('/')[2] != document.domain) sin = document.referrer;
3 _; V3 {) d/ E( W! h2 `/ k( B0 z - var h = cnzz_hf(document.location.href);. }. C1 W: r& B, F" ]' c4 B- q# e
- var vw = gc_cnzz("vw1562522");7 [5 ?# ~. m7 b l. y% \7 m
- var res = 0;
H w; H w; n4 v - if (vw != -1 && vw.length < 1024) { if (vw.indexOf(':' + h + ':') > -1) { res = 1; } else { vw += h + ':' } } else { vw = ':' + h + ':'; }7 ~# d6 l- h6 d$ n( e) W
- var eid = gc_cnzz("cnzz_eid");- r. D3 n6 T+ D' ?2 s1 J
- if (eid == -1) eid = Math.floor(Math.random() * 100000000) + "-" + 1250741268 + "-" + document.referrer.substr(0, 64);
; ^. e* ^ l8 {1 I - if (lt < 1000000) { rt = 0; lt = 0; }: ~5 N+ D; A2 O m! ^7 d% h
- if (rt < 1) rt = 0;/ n& E- Q/ z! U
- if (((now - lt) > 500 * 86400) && (lt > 0)) rt++;+ w. k' P) g K5 S" U8 Z
- 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);; Z4 m7 O& T6 t3 ]8 g! k1 D4 L
- document.write('<a target=_blank title="站长统计">站长统计</a>');2 Y( A: Z+ F( _# n4 n/ g' H0 V+ B% G
- document.write('<img src="stat.aspx?id=1562522' + data + '" border=0 width=0 height=0>');9 w3 P9 p' d- d3 ]& K
6 l4 f# P7 E- v' O" |- * d) C1 T' d/ O0 J2 D+ i0 X
- var et = (86400 - ed.getHours() * 3600 - ed.getMinutes() * 60 - ed.getSeconds());8 I6 S, b/ C$ U; \7 k; r; V
- ed.setTime(now + 1000 * (et - ed.getTimezoneOffset() * 60));5 O2 @ p: y7 u, _$ z7 I. P7 `6 g
- document.cookie = "cnzz_a1562522=" + cnzz_a + ";expires=" + ed.toGMTString() + "; path=/";
/ ?0 v/ I4 |7 x, O6 p4 ^ - document.cookie = "vw1562522=" + escape(vw) + ";expires=" + ed.toGMTString() + ";path=/";
! j* U- ? Y8 }: I; r4 b! f' v - document.cookie = "sin1562522=" + escape(sin) + ";expires=" + ed.toGMTString() + ";path=/";
* C, g! a7 I4 F9 f# _- e( T - ed.setTime(now + 1000 * 86400 * 182);3 ^4 y7 _2 |0 [9 N( ?! E9 u! E
- document.cookie = "rtime=" + rt + ";expires=" + ed.toGMTString() + ";path=/";: p6 i6 a# q$ {3 L/ @, u- C* `: j9 U0 h1 E
- document.cookie = "ltime=" + now + ";expires=" + ed.toGMTString() + ";path=/";, u- w, `) X( J
- document.cookie = "cnzz_eid=" + escape(eid) + ";expires=" + ed.toGMTString() + ";path=/";
复制代码 一种方法是写入cookies,当页面跳出的时候,记录时间。如上面cnzz的统计就是用这样的代码,还有一种就是利用js里面的onload和onunload函数,然后ajax入库。 |
|