close
<?php
// 打開syslog,包括進程ID並發送日誌到標準錯誤,並使用用戶定義記錄機制
openlog("myScriptLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);
// some code
if (authorized_client()) {
// do something
} else {
// unauthorized client!
// log the attempt
$access = date("Y/m/d H:i:s");
syslog(LOG_WARNING, "Unauthorized client: $access {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})");
}
closelog();
?>
全站熱搜
留言列表