Notice we
check if the user is logged in before attempting to block them.
/**
* If they are logged in, blocks the current user's account.
*
* @access private
* @return boolean true on success
*/
function _block()
{
$user =& JFactory::getUser();
print_r($user);
if($user->get('id'))
{
$user->set('block', '1');
return $user->save(true);
}
return false;
}
To be able to use the DefenceHandler class we need to register the event with the
application. This creates a new instance of DefenceHandler and attaches it to the
application event handler.
$mainframe->registerEvent('onAttackDetected',
'DefenceHandler');
If we detected an attack we would use the handler by triggering the event
onAttackDetected in the application ($mainframe):
$mainframe->triggerEvent('onAttackDetected');
Attack Logging
Detecting attacks can prevent individual attacks but, when we encounter a persistent
attacker, having a history of attacks can provide us with vital information. This
information can be used to determine the nature of each attack and to try to identify
the perpetrator.
Pages:
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466