/* * CDN counter / siyunxian 2010.6.22 * @lastmodify 2010.7.8 */ var __clientID = config.clientID; var __projectID = config.projectID; var __gbookStyle = config.gbookStyle; var __helper = config.helper; var str= window.location.href; var selfUrl = escape(top.location.href); var selfTitle = escape(top.document.title); var comeUrl = top.document.referrer; var es=/./; es.exec(str); var right=RegExp.rightContext; var txt; txt = right.split("?"); var sParam; sParam = "&" + txt[1]; if(sParam == "&undefined") { str = document.referrer; es=/./; es.exec(str); right=RegExp.rightContext; txt = right.split("?"); sParam = "&" + txt[1]; } if(sParam == "&undefined") { sParam = ""; } //只取comeUrl路径,不取参数,20081117 var cometxt = comeUrl.split("?"); var come_str = cometxt[0]; var comeUrl_new = escape(top.document.referrer); //仿ht.28.com/dlz/counter.php进行处理 var bannerID = parseInt(GetQueryString("bannerID"),10); if(isNaN(bannerID)) bannerID = parseInt(GetQueryString("bannerid"),10);//兼容小写 var newComeID = parseInt(GetQueryString("comeID"),10); if(isNaN(newComeID)) newComeID = parseInt(GetQueryString("comeid"),10);//兼容小写 if(isNaN(bannerID)) bannerID = 0; if(isNaN(newComeID)) comeID = parseInt(GetCookie("comeID"),10); else comeID = newComeID; //去掉hao123的comeID var re = "/hao123.com/i"; if (comeUrl_new.search(re)) { comeID = 20504; } SetCookie("comeID",comeID); var free_keywordID = parseInt(GetQueryString("fk"),10); if(isNaN(free_keywordID)) fk = parseInt(GetCookie("comeID"),10); else fk = free_keywordID; if(isNaN(fk)) fk = 0; SetCookie("free_keywordID",fk); if(__gbookStyle > 0) { document.write("
"); } /* 下面执行原来的 keyword_counter.php,有数据库操作 需要新建一个文件调用keywordTotal()类,或直接在keyword_counter.php里调用,根据传入的bannerID执行相应操作。 */ //document.write(''); /*************************************留言来源分析 start**********/ if(comeUrl_new) { if (!comeUrl_new.search(/28.com/)) SetCookie("comeUrl",comeUrl_new); } /*************************************留言来源分析 end**********/ //2008-6-13 快捷留言板 function paraURL(paras){ var url = top.location.href; var paraString = url.substring(url.indexOf("?")+1,url.length).split("&"); var paraObj = {} for (i = 0; j = paraString[i]; i++){ paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length); } var returnValue = paraObj[paras.toLowerCase()]; if(typeof(returnValue) == "undefined"){ return ""; }else{ return returnValue; } } if(__clientID > 1 && __gbookStyle > 0) { var sGuestbook_kw = paraURL("kw"); if(sGuestbook_kw != "") { document.write(''); } } var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fe5d45167151d43ae30f15d82621a8635' type='text/javascript'%3E%3C/script%3E")); /** * 以上为执行主体代码,以下为函数区域 */ //iframe高度自适应 function SetCwinHeight(id){ var bobo=document.getElementById(id); //iframe id if (document.getElementById){ if (bobo && !window.opera){ if (bobo.contentDocument && bobo.contentDocument.body.offsetHeight){ bobo.height = bobo.contentDocument.body.offsetHeight; }else if(bobo.Document && bobo.Document.body.scrollHeight){ bobo.height = bobo.Document.body.scrollHeight; } } } } //获取URL参数 function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i"); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null; } /** JS cookie 操作函数 start */ function GetCookieVal(offset) //获得Cookie解码后的值 { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function SetCookie(name, value) //设定Cookie值 { var expdate = new Date(); var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 )); document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString())) +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain)) +((secure == true) ? "; secure" : ""); } function DelCookie(name) //删除Cookie { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString(); } function GetCookie(name) //获得Cookie的原始值 { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return GetCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } /** JS cookie 操作函数 end */