<script>
function checkWeight() {
    var maxAttempts = 10; 
    var today = new Date();
    today.setHours(0, 0, 0, 0); 
    var expires = new Date(today.getTime() + (24 * 60 * 60 * 1000)); 

    var attempts = getCookie("attempts"); 
    if (attempts === null) {
        attempts = 0;
    }
    if (attempts >= maxAttempts) {
        alert("免费用户只能查询" + maxAttempts + "次,请明天再来,或者找管理员赞助吧");
        return;
    }

    var url = document.getElementById("input-link").value.trim();
    var pattern = /^[\w\d_]{1,255}(https:\/\/[\w\d_]{1,255}.*)$/;
    var match = url.match(pattern);
    if (match !== null) {
        var newUrl = "dy.php?url=" + match[1];
        location.href = newUrl;
        setCookie("attempts", ++attempts, expires); 
    } else {
        alert("输入的链接格式不正确,请重新输入。");
    }
}

function getCookie(name) {
    var pattern = new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$");
    return decodeURIComponent(document.cookie.replace(pattern, "$1")) || null;
}

function setCookie(name, value, expires) {
    document.cookie = name + "=" + encodeURIComponent(value) + "; expires=" + expires.toUTCString() + "; path=/";
}
</script>
把下面的js代码修改成只允许数字下划线大小字母的组合最大长度为255字符scriptfunction checkWeight var maxAttempts = 10; var today = new Date; todaysetHours0 0 0 0; var expires = new DatetodaygetTime + 24 60 60 1000;

原文地址: https://www.cveoy.top/t/topic/0rc 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录