0 ) { $end = trim( $range[ 2 ] ); } else { $end = $total - 1; } $start = trim( $range[ 1 ] ); $size = $end - $start + 1; header( 'HTTP/1.1 206 Partial Content' ); header( 'Content-Length:' . $size ); header( 'Content-Range: bytes ' . $start . '-' . $end . '/' . $total ); } else { $size = $end = $total; header( 'HTTP/1.1 200 OK' ); header( 'Content-Length:' . $size ); header( 'Content-Range: bytes 0-' . ( $total - 1 ) . '/' . $total ); } header( 'Accenpt-Ranges: bytes' ); header( 'Content-Type:' . $mime ); $fp = fopen( $filename, 'rb+' ); fseek( $fp, $start, 0 ); $cur = $start; @ob_end_clean(); if ( getglobal( 'gzipcompress' ) )@ob_start( 'ob_gzhandler' ); while ( !feof( $fp ) && $cur <= $end && ( connection_status() == 0 ) ) { print fread( $fp, min( 1024 * 16, ( $end - $cur ) + 1 ) ); $cur += 1024 * 16; } fclose( $fp ); exit(); } else { //$cachefile=$_G['siteurl']['attachdir'].'cache/'.play_cache_md5(file).'.'.$ext; //$meta=IO::getMeta($path); //$size=$meta['size']; header( 'cache-control:public' ); header( 'Accenpt-Ranges: bytes' ); header( 'Content-Type: ' . $mime ); //header('Content-Length:'.$size); //header('Content-Range: bytes 0-'.($size-1).'/'.$size); @ob_end_clean(); if ( getglobal( 'gzipcompress' ) )@ob_start( 'ob_gzhandler' ); @readfile( $url ); @flush(); @ob_flush(); exit(); } ?>