Home  >  Article  >  Backend Development  >  php实现防止用户cc攻击/频繁刷新

php实现防止用户cc攻击/频繁刷新

WBOY
WBOYOriginal
2016-06-23 13:40:07813browse

用户无意义的频繁跳转、请求都会给服务器加重很多负担 其实 用cookie就可以防止这一点。

<?phperror_reporting (0);//if($_COOKIE["ck"])die("刷新过快!");if($_COOKIE["ck"])header("Location:http://www.baidu.com");//这里如果用户刷新过快,给予终止php脚本或者直接302跳转setcookie("ck","1",time()+3);//设定cookie存活时间3secho "hello!";?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn