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

WBOY
Release: 2016-06-23 13:40:07
Original
855 people have browsed it

用户无意义的频繁跳转、请求都会给服务器加重很多负担 其实 用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!";?>
Copy after login


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template