|
发表于 2015-1-20 18:54:50
|
显示全部楼层
+ e; t& b8 Q# ~5 V& V; }! Y- function cnzz_hf(str) {) x+ z& u n8 v7 p
- var b = 37851; var a = 63689; var h = 0; var i = 0;
) P% F0 ^, b6 ` - for (i = 0; i < str.length; i++) {
' Z$ K5 H$ E9 L. A( v. ~ - var tp = h + (a * (str.charAt(i).charCodeAt())) >> 2; if (tp) { h = tp; a += b; }
. h" E; N2 |# b% t% ~ - }
( Y. A1 k& B1 Y% N1 I) w - return h + '';- k7 V% g2 l& f8 C B
- }: S* N/ E$ x: [& i- N. ~" O
- function gv_cnzz(of) {7 F, y2 d9 D$ T! q
- var es = document.cookie.indexOf(";", of);
% W# E- M2 f8 _: T- ` - if (es == -1) es = document.cookie.length;/ O8 \, A% q/ d* \9 D
- return unescape(document.cookie.substring(of, es));
. D1 k3 s) B+ m' S% G, b1 T1 _ - }0 p$ Y3 P* M- O7 x. W
- function gc_cnzz(n) {
$ p; M; k5 {1 W- e$ E0 i - var arg = n + "=";# e3 r! s) f$ k R' c% G1 ]
- var alen = arg.length;' o+ j3 H, G% W8 S" R6 |! X) ~; a
- var clen = document.cookie.length;) W+ G: f0 y7 d9 ?! P% N5 w
- var i = 0;
+ p2 i C( [5 ^+ m4 C7 x% a5 X - while (i < clen) {1 H6 J" \: K: y# k' W# o
- var j = i + alen;) M4 n3 [) Z7 x! b: V
- if (document.cookie.substring(i, j) == arg) return gv_cnzz(j);
: o W3 ` u0 X& k- |+ a+ ] - i = document.cookie.indexOf(" ", i) + 1;) L1 k0 W: D3 m% D( _
- if (i == 0) break;
7 z9 y9 E) `8 k! T- d - }+ Q c" `! g2 {7 A# K, V4 D' B
- return -1;
( ]8 ], R8 `) B2 } - }
% i8 v1 W, q l- C: x9 e! { - var ed = new Date();
9 M" g; K8 ]$ o$ k6 @ - var now = parseInt(ed.getTime());( K% u7 y1 [: m* K2 r; m; k' c2 Z
- var data = '&r=' + escape(document.referrer.substr(0, 512)) + '&lg=' + escape(navigator.systemLanguage) + '&ntime=0.58106800 1250741268';
* j! u* Q, M: K( j* {4 O5 z1 D b$ L - var cnzz_a = gc_cnzz("cnzz_a1562522");
/ ~5 s, ^8 P( @( d - if (cnzz_a != -1) cnzz_a = parseInt(cnzz_a) + 1;7 S( s( E5 a9 T
- else cnzz_a = 0;
' e2 J: [6 e# ^. s - var rt = parseInt(gc_cnzz("rtime"));9 }' q3 v, ^2 `1 \" ]; q( d
- var lt = parseInt(gc_cnzz("ltime"));
, a6 J1 d+ i% R - var st = parseInt((now - lt) / 1000);
7 G* H* f$ e, `, Y - var sin = gc_cnzz("sin1562522");
) M3 O5 v# F! M# \ G - if (sin == -1) sin = 'none';- P) [ H* C2 O! A; s
- if (document.referrer.split('/')[2] != document.domain) sin = document.referrer;
" Q/ O% W# { h0 t - var h = cnzz_hf(document.location.href);: ^0 _6 G' X8 \
- var vw = gc_cnzz("vw1562522");
& g% N4 _- R6 N) Z* H - var res = 0;" k- i B m! s7 {* V7 j, {# Z
- if (vw != -1 && vw.length < 1024) { if (vw.indexOf(':' + h + ':') > -1) { res = 1; } else { vw += h + ':' } } else { vw = ':' + h + ':'; }
2 k# w* \1 X' m& i - var eid = gc_cnzz("cnzz_eid");
8 z2 \+ h( s$ S: X# f/ W - if (eid == -1) eid = Math.floor(Math.random() * 100000000) + "-" + 1250741268 + "-" + document.referrer.substr(0, 64);7 p6 x# R: O( I( [$ N
- if (lt < 1000000) { rt = 0; lt = 0; }6 l% B6 a! I( c( O; p
- if (rt < 1) rt = 0;
# s) e4 x% n3 R8 N3 K, [ - if (((now - lt) > 500 * 86400) && (lt > 0)) rt++;% z/ _$ H9 q. h* A, p
- 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);
5 D9 s1 T( H* Y# |; f3 m - document.write('<a target=_blank title="站长统计">站长统计</a>');
4 m' q/ v; W( H, `% ?& B - document.write('<img src="stat.aspx?id=1562522' + data + '" border=0 width=0 height=0>');( K% R1 F0 d% D H9 K# R
- 7 J& ~; P. r$ d
7 K% R4 {4 p; x, a% ~( ~+ j- var et = (86400 - ed.getHours() * 3600 - ed.getMinutes() * 60 - ed.getSeconds());
1 ~. Y" R+ O$ R! A# U - ed.setTime(now + 1000 * (et - ed.getTimezoneOffset() * 60));
3 q2 k- Q+ b' d; m& p& b - document.cookie = "cnzz_a1562522=" + cnzz_a + ";expires=" + ed.toGMTString() + "; path=/";2 U' u7 u6 j2 j" b2 ^( g
- document.cookie = "vw1562522=" + escape(vw) + ";expires=" + ed.toGMTString() + ";path=/";
# R- c( r$ o/ [, ?" u! h/ x p7 q - document.cookie = "sin1562522=" + escape(sin) + ";expires=" + ed.toGMTString() + ";path=/";& ?* W/ ~! b; J) w/ x% S, \& y
- ed.setTime(now + 1000 * 86400 * 182);; y- z) u% M6 g# m6 S: v9 }
- document.cookie = "rtime=" + rt + ";expires=" + ed.toGMTString() + ";path=/";7 t, b8 a% S7 P2 J" T1 g; P. l% K
- document.cookie = "ltime=" + now + ";expires=" + ed.toGMTString() + ";path=/";
+ J: u# g1 ^2 B0 S: D - document.cookie = "cnzz_eid=" + escape(eid) + ";expires=" + ed.toGMTString() + ";path=/";
复制代码 一种方法是写入cookies,当页面跳出的时候,记录时间。如上面cnzz的统计就是用这样的代码,还有一种就是利用js里面的onload和onunload函数,然后ajax入库。 |
|