📄 excel_report.php
字号:
<?php
include_once( "inc/auth.php" );
include_once( "inc/utility_all.php" );
include_once( "inc/check_type.php" );
include_once( "inc/ip2add.php" );
ob_end_clean( );
header( "Cache-control: private" );
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename= 系统日志.xls" );
if ( $BEGIN_DATE != "" )
{
$TIME_OK = is_date_time( $BEGIN_DATE );
if ( !$TIME_OK )
{
message( "错误", "起始时间格式不对,应形如 1999-1-2 14:55:20" );
button_back( );
exit( );
}
}
if ( $END_DATE != "" )
{
$TIME_OK = is_date_time( $END_DATE );
if ( !$TIME_OK )
{
message( "错误", "截止时间格式不对,应形如 1999-1-2 14:55:20" );
button_back( );
exit( );
}
}
echo "\r\n<html>\r\n<head>\r\n<title>系统日志</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n</head>\r\n\r\n<body topmargin=\"5\">\r\n <table border=\"1\" cellspacing=\"1\" width=\"95%\" class=\"small\" cellpadding=\"3\">\r\n <tr style=\"BACKGROUND: #D3E5FA; color: #000000; font-weight: bold;\">\r\n <td nowrap align=\"center\">用户姓名</td>\r\n <td nowrap align=\"center\">时间</td>\r\n <td nowrap align=\"center\">IP地址</td>\r\n <td nowrap align=\"center\">IP所在地</td>\r\n <td nowrap align=\"center\">日志类型</td>\r\n <td nowrap align=\"center\">备注</td>\r\n </tr>\r\n";
if ( $BEGIN_DATE == "" )
{
$query = "SELECT * from SYS_LOG where TIME<='".$END_DATE."'";
}
else if ( $END_DATE == "" )
{
$query = "SELECT * from SYS_LOG where TIME>='".$BEGIN_DATE."'";
}
else
{
$query = "SELECT * from SYS_LOG where TIME>='".$BEGIN_DATE."' and TIME<='{$END_DATE}'";
}
if ( $TYPE != "" )
{
$query .= " and TYPE='".$TYPE."'";
}
if ( $IP != "" )
{
$query .= " and IP='".$IP."'";
}
$cursor = exequery( $connection, $query );
while ( $ROW = mysql_fetch_array( $cursor ) )
{
$LOG_ID = $ROW['LOG_ID'];
$USER_ID = $ROW['USER_ID'];
$TIME = $ROW['TIME'];
$IP = $ROW['IP'];
$IP_ADD = convertip( $IP );
$TYPE = $ROW['TYPE'];
$REMARK = $ROW['REMARK'];
$USER_ID = addslashes( $USER_ID );
$USER_NAME = "";
$query2 = "SELECT * from USER where USER_ID='".$USER_ID."'";
$cursor2 = exequery( $connection, $query2 );
if ( $ROW2 = mysql_fetch_array( $cursor2 ) )
{
$USER_NAME = $ROW2['USER_NAME'];
}
$TYPE_DESC = get_code_name( $TYPE, "SYS_LOG" );
echo " <tr style=\"BACKGROUND: #FFFFFF;\">\r\n\t\t <td nowrap align=\"center\">";
echo $USER_NAME;
echo "</td>\r\n\t\t <td nowrap align=\"center\">";
echo $TIME;
echo "</td>\r\n\t\t <td nowrap align=\"center\">";
echo $IP;
echo "</td>\r\n\t\t <td nowrap align=\"center\">";
echo $IP_ADD;
echo "</td>\r\n\t\t <td nowrap align=\"center\">";
echo $TYPE_DESC;
echo "</td>\r\n\t\t <td align=\"left\">";
echo $REMARK;
echo "</td>\r\n </tr>\r\n";
}
echo " </table>\r\n\r\n</body>\r\n</html>";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -