Anti-CC attack PHP anti-CC attack implementation code

Source: Internet
Author: User
At such times your statistical system (probably quantum, Baidu, etc.) is not statistically. However, we can use some anti-attack software to achieve, but the effect is sometimes not obvious. Below I provide a section of PHP code, can play a certain anti-CC effect.
Main function: in 3 seconds continuously refresh the page 5 times will point to the native http://127.0.0.1

Copy the Code code 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 is the user's reply:
The SESSION relies on cookies, what if I block the cookie?
TCP/IP-Apache-PHP This process has consumed a lot of things, to this step just no more computational operations and MySQL connections
With these lines of code, the problem cannot be solved. At most, for those in the browser to press F5 Brush page operation.
So we recommend that the server install anti-CC attack firewall effect will be better. You can go to s.jb51.net to see the relevant software.

The above describes the anti-CC attack PHP anti-CC attack implementation code, including anti-CC attacks on the content, I hope the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.