A friend server is under attack. Currently, it can be determined that it is a CC attack. Therefore, a PHP anti-CC attack code is provided. This is a bit too much. In fact, it is to prevent the code from being refreshed quickly. This does not play a major role for so many fake IP addresses. CC attacks are really a headache. Directly add the code.
<? Php/*** @ author Tianya * mail@phpha.com * // The proxy IP directly exits empty ($ _ SERVER ['HTTP _ VIA ']) or exit ('Access Denied '); // prevent fast refresh of session_start (); $ seconds = '3'; // time period [seconds] $ refresh = '5 '; // refresh times // set the monitoring variable $ cur_time = time (); if (isset ($ _ SESSION ['last _ time']) {$ _ SESSION ['refresh_times '] + = 1;} else {$ _ SESSION ['refresh_times'] = 1; $ _ SESSION ['last _ time'] = $ cur_time;} // process the monitoring result if ($ cur_time-$ _ SESSION ['last _ time'] <$ seconds) {if ($ _ SESSION ['refresh_times ']> = $ refresh) {// jump to the attacker server address header (sprintf ('location: % s', 'HTTP: // 127.0.0.1 '); exit ('Access Denied') ;}} else {$ _ SESSION ['refresh _ times '] = 0; $ _ SESSION ['last _ time'] = $ cur_time;}?>