Anti-CC attack PHP anti-CC attack implementation code

WBOY
Release: 2016-07-29 08:47:35
Original
2076 people have browsed it

At this time, your statistical system (perhaps Quantum, Baidu, etc.) will of course not be able to count. However, we can use some anti-attack software to achieve this, but the effect is sometimes not obvious. Below I provide a piece of PHP code, which can have a certain anti-CC effect.
Main function: Continuously refreshing the page more than 5 times within 3 seconds will point to the local http://127.0.0.1

Copy the code The code is as follows:


$P_S_T = $t_array[0] + $t_array [1];
$timestamp = time();
session_start();
$ll_nowtime = $timestamp;
if (session_is_registered('ll_lasttime')){
$ll_lasttime = $_SESSION['ll_lasttime'];
$ll_times = $_SESSION['ll_times'] + 1;
$_SESSION['ll_times'] = $ll_times;
}else{
$ll_lasttime = $ll_nowtime;
$ll_times = 1;
$_SESSION['ll_times'] = $ ll_times;
$_SESSION['ll_lasttime'] = $ll_lasttime;
}
if (($ll_nowtime - $ll_lasttime)<3){
if ($ll_times>=5){
header(sprintf("Location: % s",'http://127.0.0.1'));
exit;
}
}else{
$ll_times = 0;
$_SESSION['ll_lasttime'] = $ll_nowtime;
$_SESSION['ll_times'] = $ll_times;
}


The following are the replies from netizens:
SESSION relies on COOKIE. What should I do if I block COOKIE?
TCP/IP -> apache -> php This process has consumed a lot of things. At this point, there are no more calculation operations and MYSQL connections.
Just these few lines of code cannot solve the problem. At most, it is disabled for those operations where you press F5 to refresh the page in the browser.
So it is recommended that everyone install a firewall to prevent CC attacks on the server, so that the effect will be better. You can go to s.jb51.net to view related software.

The above introduces the anti-cc attack PHP anti-CC attack implementation code, including the content of anti-cc attack. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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