当前位置: 首页 > 工具软件 > PHPIDS > 使用案例 >

php入侵检测,PHP入侵检测系统—PHPIDS

伯彦君
2023-12-01

// set the include path properly for PHPIDS

set_include_path(

get_include_path()

. PATH_SEPARATOR

. ‘phpids/lib/’

);

if (!session_id()) {

session_start();

}

require_once ‘IDS/Init.php’;

try {

$request = array(

‘REQUEST’ => $_REQUEST,

‘GET’ => $_GET,

‘POST’ => $_POST,

‘COOKIE’ => $_COOKIE

);

$init = IDS_Init::init(dirname(__FILE__) . ‘/phpids/lib/IDS/Config/Config.ini.php’);

$f=$init->config['General']['base_path'] = dirname(__FILE__) . ‘/phpids/lib/IDS/’;

echo $f;

$init->config['General']['use_base_path'] = true;

$init->config['Caching']['caching'] = ‘file’;

$ids = new IDS_Monitor($request, $init);

$result = $ids->run();

if (!$result->isEmpty()) {

require_once ‘IDS/Log/File.php’;

require_once ‘IDS/Log/Email.php’;

require_once ‘IDS/Log/Composite.php’;

$compositeLog = new IDS_Log_Composite();

$compositeLog->addLogger(IDS_Log_Email::getInstance($init),IDS_Log_File::getInstance($init));

$compositeLog->execute($result);

}

} catch (Exception $e) {

//this shouldn’t happen and if it does you don’t want the notification public.

}

?>

 类似资料: