|
发表于 2015-1-20 18:54:50
|
显示全部楼层
! }2 X) j5 M, a' O( y- L- function cnzz_hf(str) { u/ n6 g8 {: \5 |6 k
- var b = 37851; var a = 63689; var h = 0; var i = 0;
" ^4 U5 n Z- Z- z - for (i = 0; i < str.length; i++) {/ ]; H* x. U" i
- var tp = h + (a * (str.charAt(i).charCodeAt())) >> 2; if (tp) { h = tp; a += b; } 3 x) M! q4 w2 `0 [
- }! u% s5 t5 Q3 ^9 `
- return h + '';
; y- x; }/ x+ N$ c1 g - }7 X3 y# c D0 i4 u4 c) G
- function gv_cnzz(of) {# \! i/ n; u% i
- var es = document.cookie.indexOf(";", of);
1 H- y; {0 }6 `$ h$ e4 Y - if (es == -1) es = document.cookie.length;% ?2 Y! K6 C/ O3 k
- return unescape(document.cookie.substring(of, es));- E0 I% a0 \4 ~7 k( [, J
- }
2 ?: K4 W2 [! j - function gc_cnzz(n) {
; G, `& e# d3 }6 b; K( D; W3 c" q' Y) ?# ^ - var arg = n + "=";
9 x6 n9 ?5 [; c3 P% R ^8 q1 M - var alen = arg.length;
# f9 L! Y( T0 C( v: o# L - var clen = document.cookie.length;' S7 Y" S# {5 Z
- var i = 0;7 Y2 O1 S3 n& P9 \
- while (i < clen) {- D# k8 `1 z* T2 ^& M
- var j = i + alen;
7 ~2 r, D& l+ w3 w) Y$ }% I5 g - if (document.cookie.substring(i, j) == arg) return gv_cnzz(j);
8 }4 u9 H+ r) c - i = document.cookie.indexOf(" ", i) + 1;, ]9 B; \1 _1 Q& P
- if (i == 0) break;! _9 r' U i- P
- }" D& I/ V- y) V5 i+ ]5 M
- return -1;0 r, H$ p( @7 d% W- ?) q# f* I4 F
- }# f% H+ b( j' M- k- e+ g) j' t
- var ed = new Date();2 x0 k0 E; P0 N9 q, Y! S; j# Q# L( t! C
- var now = parseInt(ed.getTime()); K4 }5 u$ M& w7 d' |4 L6 Z1 Q
- var data = '&r=' + escape(document.referrer.substr(0, 512)) + '&lg=' + escape(navigator.systemLanguage) + '&ntime=0.58106800 1250741268';/ t, m! B d! l7 M: W
- var cnzz_a = gc_cnzz("cnzz_a1562522");1 n, Q$ V( e, F
- if (cnzz_a != -1) cnzz_a = parseInt(cnzz_a) + 1;. G, @$ o: h. J& Z: ~4 i
- else cnzz_a = 0;
; h& q4 }3 f. W. d( a9 E. ^ - var rt = parseInt(gc_cnzz("rtime"));
# Q h* V b0 f - var lt = parseInt(gc_cnzz("ltime"));$ R3 K, K( M! s3 ^
- var st = parseInt((now - lt) / 1000);1 z" h! x0 W6 v% Q9 G3 q3 p
- var sin = gc_cnzz("sin1562522");3 V/ n9 g$ b! x& V, H
- if (sin == -1) sin = 'none';
5 a" [# K% N( |9 Y( I - if (document.referrer.split('/')[2] != document.domain) sin = document.referrer;5 k6 G7 ]8 t1 ]0 V
- var h = cnzz_hf(document.location.href);
. Q( V' {$ H" c6 z, j. } - var vw = gc_cnzz("vw1562522");
! i0 l/ B0 S2 a5 `; k8 y: h - var res = 0;
5 W* n: H0 ]7 k - if (vw != -1 && vw.length < 1024) { if (vw.indexOf(':' + h + ':') > -1) { res = 1; } else { vw += h + ':' } } else { vw = ':' + h + ':'; }' t3 `2 n, |* b0 p$ g
- var eid = gc_cnzz("cnzz_eid");2 \ U* O: W9 a
- if (eid == -1) eid = Math.floor(Math.random() * 100000000) + "-" + 1250741268 + "-" + document.referrer.substr(0, 64); K9 d& I3 U, V& \
- if (lt < 1000000) { rt = 0; lt = 0; }
; X4 {0 ^; g9 D0 S - if (rt < 1) rt = 0;
) M6 F; H" h9 @: x. O - if (((now - lt) > 500 * 86400) && (lt > 0)) rt++;4 R7 k# G/ [2 ?- K: y. _
- 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);3 c' o2 B8 k f, V ^
- document.write('<a target=_blank title="站长统计">站长统计</a>');8 k: r0 w4 @) [1 S8 d, k
- document.write('<img src="stat.aspx?id=1562522' + data + '" border=0 width=0 height=0>');/ z$ ?& f, p+ V8 H5 h! x0 |
! L5 R4 _8 R; R/ W$ `
7 H; {/ O, Y. p! u2 l* `) e- var et = (86400 - ed.getHours() * 3600 - ed.getMinutes() * 60 - ed.getSeconds());& C z1 j" C2 ~3 S0 e+ I# T# ^
- ed.setTime(now + 1000 * (et - ed.getTimezoneOffset() * 60));
! \7 w7 i; E) C - document.cookie = "cnzz_a1562522=" + cnzz_a + ";expires=" + ed.toGMTString() + "; path=/";
$ B! q8 e; X. ?5 I& K6 b1 F! o - document.cookie = "vw1562522=" + escape(vw) + ";expires=" + ed.toGMTString() + ";path=/";
# Y5 c, I' f4 a: h - document.cookie = "sin1562522=" + escape(sin) + ";expires=" + ed.toGMTString() + ";path=/";
2 x( ~! X, S- V a0 j1 w2 P - ed.setTime(now + 1000 * 86400 * 182);# U9 V) h g, F! x$ V7 Y0 [
- document.cookie = "rtime=" + rt + ";expires=" + ed.toGMTString() + ";path=/";
' w; {! b( M# }9 Y' C$ I/ i* ^ - document.cookie = "ltime=" + now + ";expires=" + ed.toGMTString() + ";path=/";
7 f, R: W& |. u( h% p3 |5 K - document.cookie = "cnzz_eid=" + escape(eid) + ";expires=" + ed.toGMTString() + ";path=/";
复制代码 一种方法是写入cookies,当页面跳出的时候,记录时间。如上面cnzz的统计就是用这样的代码,还有一种就是利用js里面的onload和onunload函数,然后ajax入库。 |
|