title: Is it possible to prevent DDos Attack by cpanel configuration and php scripting?
body: <p>My site is under DDos Attacks (UDP Flooding)!</p>
  
  <p>I have no access to linux shell and only cpanel is available for me! :(</p>
  
  <p>Is it possible to prevent this attacks by php scripting?</p>
  
  <p>Is there a way to configure cpanel to reduce or redirect attacks? How?</p>
  
  <p>According to web hosting help desk: Attack is between 6 to 10 Gbit/s !!!</p>
  
  <p>Is the following code useful?</p>
  
  <pre><code> &lt;?PHP 
  
   if (!isset($_SESSION)) { session_start(); }
   // anti flood protection 
   IF($_SESSION['last_session_request'] &gt; time() - 2){ 
   // users will be redirected to this page if it makes requests faster than 2 seconds 
    header("Location: /flood.html");
   exit; } 
   $_SESSION['last_session_request'] = time(); 
  
  
   ?&gt;
  </code></pre>
  
  <p>Hardware firewall is too expensive.</p>