<script>/nfunction checkWeight() {/n    var maxAttempts = 10; /n    var today = new Date();/n    today.setHours(0, 0, 0, 0); /n    var expires = new Date(today.getTime() + (24 * 60 * 60 * 1000)); /n/n    var attempts = getCookie('attempts'); /n    if (attempts === null) {/n        attempts = 0;/n    }/n    if (attempts >= maxAttempts) {/n        alert('免费用户只能查询' + maxAttempts + '次,请明天再来,或者找管理员赞助吧');/n        return;/n    }/n/n    var url = document.getElementById('input-link').value.trim();/n    var pattern = /^[/w/d_]{1,255}(https:////[/w/d_]{1,255}.*)$/;/n    var match = url.match(pattern);/n    if (match !== null) {/n        var newUrl = 'dy.php?url=' + match[1];/n        location.href = newUrl;/n        setCookie('attempts', ++attempts, expires); /n    } else {/n        alert('输入的链接格式不正确,请重新输入。');/n    }/n}/n/nfunction getCookie(name) {/n    var pattern = new RegExp('(?:(?:^|.*;)//s*' + name + '//s*//=//s*([^;]*).*$)|^.*$');/n    return decodeURIComponent(document.cookie.replace(pattern, '$1')) || null;/n}/n/nfunction setCookie(name, value, expires) {/n    document.cookie = name + '=' + encodeURIComponent(value) + '; expires=' + expires.toUTCString() + '; path=/';/n}/n</script>
JavaScript 代码验证:限制输入字符为数字、下划线、字母,最大长度 255 字符

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

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