📄 attach.php
字号:
<?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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -