attach.php
来自「极限网络智能办公系统—MYOA26—100%—源程序。」· PHP 代码 · 共 52 行
PHP
52 行
<?php
class attach
{
function attach( )
{
global $ibforums;
global $DB;
global $std;
global $print;
global $skin_universal;
$ibforums->input['id'] = preg_replace( "/^(\\d+)\$/", "\\1", $ibforums->input['id'] );
if ( $ibforums->input['id'] == "" )
{
$std->error( array( "LEVEL" => 1, "MSG" => "missing_files" ) );
}
if ( $ibforums->input['type'] == "post" )
{
$DB->query( "SELECT pid, attach_id, attach_type, attach_file FROM ibf_posts WHERE pid='".$ibforums->input['id']."'" );
if ( !$DB->get_num_rows( ) )
{
$std->error( array( "LEVEL" => 1, "MSG" => "missing_files" ) );
}
$post = $DB->fetch_row( );
if ( $post['attach_id'] == "" )
{
$std->error( array( "LEVEL" => 1, "MSG" => "missing_files" ) );
}
$file = $ibforums->vars['upload_dir']."/".$post['attach_id'];
if ( file_exists( $file ) && $post['attach_type'] != "" )
{
$DB->query( "UPDATE ibf_posts SET attach_hits=attach_hits+1 WHERE pid='".$post['pid']."'" );
@header( "Content-Type: ".$post['attach_type']."\nContent-Disposition: inline; filename=\"".$post['attach_file']."\"\nContent-Length: ".( boolean )filesize( $file ) );
$fh = fopen( $file, "rb" );
fpassthru( $fh );
@fclose( $fh );
}
else
{
$std->error( array( "LEVEL" => 1, "MSG" => "missing_files" ) );
}
}
}
}
attach( );
$idx = new attach( );
echo "\r\n\r\n\r\n\r\n\r\n";
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?