PHP IP地址锁定:10秒后自动锁定网页,需输入密码访问
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charSet="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="referrer" content="never">
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>果果互联-在线观看</title>
<link rel="stylesheet" href="css/style.css">
<style>
body {margin:0;}
<pre><code>ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover:not(.active) {
background-color: #111;
}
.active {
background-color: #4CAF50;
}
</style>
</code></pre>
</head>
<body>
<section id="main">
<video id="player" src="http://sp.guodns.xyz/92sp.php" controls controlsList="nodownload" webkit-playsinline playsinline></video>
</section><?php
$dir = "mp4/aaaa/";
$format = "mp4";
$count = 0;
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (pathinfo($file, PATHINFO_EXTENSION) == $format) {
$count++;
}
}
closedir($handle);
}
echo "共有" . $count . "个视频";
?>
<section id="buttons">
<button id="switch">自动切换</button>
<button id="next">下一位</button>
<a href="http://idc.cn"><button id="next">购买源码</button></a>
</section>
<script>
<pre><code>(function (window, document) {
if (top != self) {
window.top.location.replace(self.location.href);
}
var get = function (id) {
return document.getElementById(id);
}
var bind = function (element, event, callback) {
return element.addEventListener(event, callback);
}
var auto = true;
var player = get('player');
var randomm = function () {
player.src = 'http://sp.guodns.xyz/92sp.php';
player.play();
}
bind(get('next'), 'click', randomm);
bind(player, 'error', function () {
randomm();
});
bind(get('switch'), 'click', function () {
auto = !auto;
this.innerText = '自动: ' + (auto ? '开' : '关');
});
bind(player, 'ended', function () {
if (auto) randomm();
});
})(window, document);
</script>
</code></pre>
<script>
document.addEventListener('contextmenu', event => event.preventDefault());
document.addEventListener('keydown', event => {
if (event.keyCode == 123 || (event.ctrlKey && event.shiftKey && event.keyCode == 73)) {
event.preventDefault();
}
});
</script>
<script>
// 设置COOKIE函数
function setCookie(name, value, day) {
var exp = new Date();
exp.setTime(exp.getTime() + day * 24 * 60 * 60 * 1000);
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}
</script>
</body>
</html>
<?php
// 获取客户端IP地址
$ip = $_SERVER['REMOTE_ADDR'];
// 设置锁定时间
$time = 10;
// 设置密码
$password = '369';
<p>// 判断IP是否已经被锁定
if (isset($_COOKIE[$ip]) && time() - $_COOKIE[$ip] < $time) {
// 弹出提示框,要求输入密码
echo '<script>var password = prompt("请输入密码");if (password != ''.$password.'') {window.location.href = "https://www.baidu.com";}else {setCookie(''.$ip.'', ''.time().'', 1);}</script>';
} else {
// 设置COOKIE,记录当前IP和时间
setcookie($ip, time(), time() + 3600);
}
?></p>
原文地址: https://www.cveoy.top/t/topic/nn3h 著作权归作者所有。请勿转载和采集!