request('colid','int','get'); $getId = $sr->request('id','int','get'); $sql = 'select id,parent_id from site_column where id = '.$getColId; $rs = $db->query($sql); if(0==$db->resultNum){ $errMsg = '您指定的項目不存在!'; }else{ if($rs[0]['parent_id']>0){ $parent_id = $rs[0]['parent_id']; $column_id = $rs[0]['id']; }else{ $sql = 'select id from site_column where parent_id = '.$getColId.' order by range_num,id'; $rs = $db->query($sql); if(0==$db->resultNum){ $errMsg = '您指定的項目不存在!'; }else{ $parent_id = $getColId; $column_id = $rs[0]['id']; } } } $ColumnIsList = ReturnOneValue('is_list','site_column','id='.$column_id,$db); if($ColumnIsList>0){ $ShowTitle = true; $ShowList = true; }else{ if(0==$getId){ $sql = 'select id from article where column_id='.$column_id.' and is_show = 1 order by id desc limit 0,1'; $rs=$db->query($sql); if($db->resultNum > 0){ $getId = $rs[0]['id']; }else{ $errMsg = '資料整理中,敬請期待!'; } } } if($getId > 0){ $ShowList = false; } function getFileSize($url){ $url = parse_url($url); if($fp = @fsockopen($url['host'],empty($url['port'])?80:$url['port'],$error)){ fputs($fp,"GET ".(empty($url['path'])?'/':$url['path'])." HTTP/1.1\r\n"); fputs($fp,"Host:$url[host]\r\n\r\n"); while(!feof($fp)){ $tmp = fgets($fp); if(trim($tmp) == ''){ break; }else if(preg_match('/Content-Length:(.*)/si',$tmp,$arr)){ // print_r($arr); return trim($arr[1]); } } return null; }else{ return null; } } ?> <?=$rsSiteConfig[0]['site_name']?>
query($sql); $SubNavNum = $db->resultNum; if($SubNavNum>1){ include('panel_sub_nav.php'); }else{ include ('panel_in_left.php'); } ?>
pageSize = 15; $sp->currentPage = $sr->request('page','int','get'); $mb = 1048576; $kb = 1024; $sql = 'select id,title,intro,small_image,large_image,release_date from article where column_id = '.$column_id.' and is_show = 1 order by is_recommend desc,range_num,id desc'; $rs = $sp->query($sql); $rsNum = $sp->resultNum; for($i=0;$i<$rsNum;$i++){ if($rs[$i]['large_image'] != '' && $rs[$i]['large_image']!='http://'){ $FileUrl = trim($rs[$i]['large_image']); if(strpos($rs[$i]['large_image'],$_SERVER ['HTTP_HOST']) !== FALSE){ $filePath = str_replace("http://".$_SERVER ['HTTP_HOST'].'/','',$FileUrl); $FileSize = filesize($filePath); }else{ $FileSize = getFileSize($FileUrl); } }else{ $FileUrl = "http://".$_SERVER ['HTTP_HOST'].'/'.trim($rs[$i]['small_image'],'\.\./'); $FileSize = filesize(trim($FileUrl,'\.\./')); } if($FileSize>$mb){ $FileSize = round($FileSize/($mb),2); $FileSize = $FileSize . " MB"; }elseif($FileSize>$kb){ $FileSize = round($FileSize/($kb),2); $FileSize = $FileSize . " KB"; }elseif($FileSize > 0){ $FileSize = $FileSize . " B"; }else{ $FileSize = ''; } echo ''; } ?>
'.$rs[$i]['release_date'].' '.$rs[$i]['title'].' '.$FileSize.' 下載
getHtmlCode(); ?>
query($sql); if($rs[0]['large_image']!='' && $rs[0]['large_image']!='http://'){ $FileUrl = $rs[0]['large_image']; $FileSize = getFileSize($FileUrl); }else{ $FileUrl = "http://".$_SERVER ['HTTP_HOST'].'/'.trim($rs[0]['small_image'],'\.\./'); $FileSize = filesize(trim($rs[0]['small_image'],'\.\./')); } $arrFile = explode('/',$FileUrl); $FileName = $arrFile[count($arrFile)-1]; $mb = 1048576; $kb = 1024; if($FileSize>$mb){ $FileSize = round($FileSize/($mb),2); $FileSize = $FileSize . " MB"; }elseif($FileSize>$kb){ $FileSize = round($FileSize/($kb),2); $FileSize = $FileSize . " KB"; }else{ $FileSize = $FileSize . " B"; } echo '
檔案名稱:'.$FileName.'
檔案大小:'.$FileSize.'
發佈日期:'.$rs[0]['release_date'].'
'.$rs[0]['title'].'
'.$rs[0]['content'].'
'; } }else{ echo $errMsg; } ?>