PHP implementation code against CC attacks

  • 2020-05-10 17:52:07
  • OfStack

At this time your statistical system (may be quantum, baidu, etc.) is of course not statistical. However, we can use some anti - attack software to achieve, but sometimes the effect is not obvious. Below I provide a section of PHP code, can play a definite CC effect.

Main function: refresh the page 5 times or more in 3 seconds will point to http://127.0.0.1
 
$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; 
} 

Here is the response:
SESSION relies on COOKIE. What if COOKIE is blocked?
TCP/IP - > apache - > The php process has consumed a lot of stuff, to this point there is just no more computational operation and the MYSQL connection
These lines of code don't solve the problem. At most, this is for those who swipe through the browser by pressing F5.

Therefore, it is recommended that you install cc server against the firewall effect will be better. You can check it out at s.ofstack.com.

Related articles: