xml地图|网站地图|网站标签 [设为首页] [加入收藏]

可提现彩票appJavaScript网页被访问次数方法,防止

2019-11-23 07:57栏目:支持提现彩票app
TAG:

防止网站内容被小偷采集的ASP代码看了一下asp的,因为我的站是静态的所以就凑手写了个静态的javascript版的。具体就不详细说明了:欢迎讨论,原创转载请说明复制代码 代码如下: functionsetCookie(name,value,expires,path,domain,secure){ varcurCookie=name "=" escape?";expires=" expires.toGMTString?";path=" path:"/") ?";domain=" domain:"") ?";secure":"") document.cookie=curCookie; } functiongetCookie{ varprefix=name "=" varcookieStartIndex=document.cookie.indexOf if returnnull varcookieEndIndex=document.cookie.indexOf(";",cookieStartIndex prefix.length) if cookieEndIndex=document.cookie.length returnunescape(document.cookie.substring(cookieStartIndex prefix.length,cookieEndIndex)) } varnow=newDate() now.setTime varjb51num=10; varvisits=getCookie visits=1 else visits=parseInt 1 if(visits>parseInt{ alert; location.href='//www.jb51.net'; } setCookie

复制代码 代码如下:

varcaution=false

客户端简单防采集

<script language="JavaScript">
<!--
var caution = false
function setCookie(name, value, expires, path, domain, secure) {
        var curCookie = name "=" escape(value)
                ((expires) ? "; expires=" expires.toGMTString() : "")

functionsetCookie(name,value,expires,path,domain,secure)

[Ctrl A 全选 注:如需引入外部Js需刷新才能执行]

  •                 ((path) ? "; path=" path : "")
                    ((domain) ? "; domain=" domain : "")
                    ((secure) ? "; secure" : "")
            if (!caution || (name "=" escape(value)).length <= 4000)
                    document.cookie = curCookie
            else
                    if (confirm("Cookie exceeds 4KB and will be cut!"))
                            document.cookie = curCookie
    }
    function getCookie(name) {
            var prefix = name "="
            var cookieStartIndex = document.cookie.indexOf(prefix)
            if (cookieStartIndex == -1)
                    return null
            var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex prefix.length)
            if (cookieEndIndex == -1)
                    cookieEndIndex = document.cookie.length
            return unescape(document.cookie.substring(cookieStartIndex prefix.length, cookieEndIndex))
    }
    function deleteCookie(name, path, domain) {
            if (getCookie(name)) {
                    document.cookie = name "="
                    ((path) ? "; path=" path : "")
                    ((domain) ? "; domain=" domain : "")
                    "; expires=Thu, 01-Jan-70 00:00:01 GMT"
            }
    }
    function fixDate(date) {
            var base = new Date(0)
            var skew = base.getTime()
            if (skew > 0)
                    date.setTime(date.getTime() - skew)
    }
    var now = new Date()
    fixDate(now)
    now.setTime(now.getTime() 365 * 24 * 60 * 60 * 1000)
    var visits = getCookie("counter")
    if (!visits)
            visits = 1
    else
            visits = parseInt(visits) 1
    setCookie("counter", visits, now)
    document.write("您是到访的第" visits "位用户!")
    // -->
    </script>

{

您可能感兴趣的文章:

  • 使用JavaScript制作一个简单的计数器的方法
  • jsp网页计数器实现示例
  • javascript下计数器每秒自动加1
  • 用JAVASCRIPT帮我写个计数器
  • js计数器代码
  • jsp计数器制作手册
  • jsp计数器制作
  • jsp计数器代码
  • 一个可以防止刷新的JSP计数器
  • JavaScript实现计数器基础方法

varcurCookie=name "=" escape(value)

((expires)?";expires=" expires.toGMTString() :"")

((path)?"; path=" path :"")

((domain)?"; domain=" domain :"")

((secure)?";secure":"")

if(!caution||(name "=" escape(value)).length <= 4000)

{

document.cookie = curCookie

}

elseif(confirm("Cookie exceeds 4KB and will be cut!"))

{

document.cookie = curCookie

}

}

functiongetCookie(name)

{

varprefix = name "="

varcookieStartIndex = document.cookie.indexOf(prefix)

if(cookieStartIndex == -1)

{

returnnull

}

varcookieEndIndex=document.cookie.indexOf(";",cookieStartIndex prefix.length)

if(cookieEndIndex == -1)

{

cookieEndIndex = document.cookie.length

}

returnunescape(document.cookie.substring(cookieStartIndex prefix.length,cookieEndIndex))

}

functiondeleteCookie(name, path, domain)

{

if(getCookie(name))

{

document.cookie = name "="

((path) ?"; path=" path :"")

((domain) ?"; domain=" domain :"")

"; expires=Thu, 01-Jan-70 00:00:01 GMT"

}

}

functionfixDate(date)

{

varbase=newDate(0)

varskew=base.getTime()

if(skew>0)

{

date.setTime(date.getTime()-skew)

}

}

varnow=newDate()

fixDate(now)

now.setTime(now.getTime() 365 * 24 * 60 * 60 * 1000)

varvisits = getCookie("counter")

if(!visits)

{

visits=1;

}

else

{

visits=parseInt(visits) 1;

}

setCookie("counter", visits, now)

//document.write("您是到访的第" visits "位用户!")

console.log("您是到访的第" visits "位用户!");

版权声明:本文由可提现彩票app-支持提现彩票app-10元可提现的彩票app发布于支持提现彩票app,转载请注明出处:可提现彩票appJavaScript网页被访问次数方法,防止