Used to filter fast duplicate requests

Source: Internet
Author: User
No details? PhpfunctionC ($ key) {$ c_arrarray (kernel, DDOS_MEMCACHE_HOST127.0.0.1, restart apache to take effect ddos_memcache_port1_11. Restart apache to take effect DDOS_MEMCACHE_EXPIRE2,); retu

No details? Phpfunction C ($ key) {$ c_arr = array ('ddos _ MEMCACHE_PERSISTENT_ID_COUNT '= 200, 'ddos _ MEMCACHE_HOST' = '2017. 0.0.1 ', // you need to restart apache to take effect. 'ddos _ MEMCACHE_PORT' = 11211, // you need to restart apache to take effect. 'ddos _ MEMCACHE_EXPIRE '= 2,); retu

<无详细内容> <无>
   200, 'ddos _ MEMCACHE_HOST '=>' 127. 0.0.1 ', // you need to restart apache to take effect 'ddos _ MEMCACHE_PORT' => 11211, // you need to restart apache to take effect 'ddos _ MEMCACHE_EXPIRE '=> 2 ,); return $ c_arr [$ key];} /*** @ brief isDdos judge whether it is a rapid ddos attack ** @ param $ index_arr ** @ return */function isDdos ($ index_arr) {$ persistent_id = mt_rand (1, C ('ddos _ MEMCACHE_PERSISTENT_ID_COUNT '); $ m = new Memcached ($ persistent_id); if (! $ M-> getServerList () {$ m-> addServer (C ('ddos _ MEMCACHE_HOST '), C ('ddos _ MEMCACHE_PORT '));} $ key = md5 (http_build_query ($ index_arr); $ ret = $ m-> get ($ key) === 1? True: false; $ m-> set ($ key, 1, C ('ddos _ MEMCACHE_EXPIRE '); return $ ret;} if (isDdos (array ('tjx ', 'fdf ') {echo 'ddos'; die ();} sleep (2); echo 'Return value ';

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.