Jump to content

PHP DDOS ?


d.shankar

Recommended Posts

I got this script from a chinese website.

It seems that it can prevent DDOS attack ... :-X

 

If (preg_replace ( "/ https? : \ / \ / ([^ \ /]+).*/ I "," \ \ 1 ", $ HTTP_SERVER_VARS [ 'HTTP_REFERER'])! = $ _SERVER [ 'HTTP_HOST']) {
Exit ( 'warning - your operation has been banned. '); 
}  

 

Is it correct ?

Link to comment
https://forums.phpfreaks.com/topic/70446-php-ddos/
Share on other sites

It will NOT stop DDOS attacks but can slow some of them down

if (!preg_match('%https?://([^/]+)%i', $_SERVER['HTTP_REFERER'])))
{
 Exit ( 'warning - your operation has been banned. '); 
}

 

But will also cause problems for some users, who are not doing anything bad..

 

 

'HTTP_REFERER'

    The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

 

so to sum up, its more trouble that its worth..

Link to comment
https://forums.phpfreaks.com/topic/70446-php-ddos/#findComment-356754
Share on other sites

basically it looks for where the script was called from (using $_SERVER['HTTP_REFERER']), if its not from the server then it fails..

 

the problem.. not all clients/proxies will set this thus they will fail, it can be changed to make it seam like its from the server so its unsafe..

 

also if you have a submit button someone could Still simply click it 10000000X of times to cause a kinda DDOS attak

 

so to someup $_SERVER['HTTP_REFERER'] is usless, and the whole script replies on it..!

 

your probably be better off using sessions and on each click check the time in a session then set the session to the currect time..

ie

if($_SESSION['Clicker'] >= time()+15)
{
$_SESSION['Clicker'] = time();
//process action
}

 

hope that makes sense!

Link to comment
https://forums.phpfreaks.com/topic/70446-php-ddos/#findComment-357821
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.