function sdatetime($str){
$str=ereg_replace("-","/",$str);
$str=substr($str,5,strlen($str)-8);
return $str;
}
function reAnum($sid){ //羆萊絞計
$DROOT=getenv('DOCUMENT_ROOT');
include("sql.php3");
$db=MySQL_connect($sql['host'], $sql['user'] , $sql['passwd']);
$qsql="SELECT id from bbs_docs where sid='$sid'";
$rs=mysql_db_query($sql['db'],$qsql);
return mysql_num_rows($rs);
}
function pagebar($pages) {
global $pgno;
//global $pages;
global $PHP_SELF;
global $aid;
global $OPEN_LIST;
echo "
//========================================================================
function area() {
global $PHP_SELF;
global $aid,$sid,$pgno;
global $OPEN_LIST;
$showitems=20;
$DROOT=getenv('DOCUMENT_ROOT');
include("sql.php3");
$db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);
//============================================================
if(!$aid) {
$qsql="SELECT id from bbs_area";
$rs=mysql_db_query($sql['db'],$qsql);
$row=mysql_fetch_array($rs);
$aid=$row['id'];
}
if(!$sid) {
$qsql="SELECT id from bbs_subj where aid=$aid order by wdate DESC";
$rs=mysql_db_query($sql['db'],$qsql);
$row=mysql_fetch_array($rs);
$sid=$row['id'];
}
if(!$pgno) {//礚﹚計
//$pgno=0;
$items=0;
$qsql="SELECT id from bbs_subj where aid=$aid order by wdate DESC";
$rs=mysql_db_query($sql['db'],$qsql);
while($row=mysql_fetch_array($rs)){
$id=$row['id'];
if($id==$sid) break;
$items++;
}
$pgno=(INT)($items/$showitems);
}
//============================================================
$qsql="SELECT * from bbs_area where id=$aid ";
$rs=mysql_db_query($sql['db'],$qsql);
$row=mysql_fetch_array($rs);
$banner=$row['banner'];
$body=$row['body'];
$master=$row['master'];
echo "
$banner";
echo "";
$qsql="SELECT * from bbs_subj where aid=$aid order by wdate DESC";
$rs=mysql_db_query($sql['db'],$qsql);
$all=mysql_num_rows($rs); //how rows
$pages=(INT)($all/$showitems); // how pages
$pgcount=$pgno*$showitems;
if($pgcount > $all) {
$pgno=$pages-1; // Page point over all pages
$pgcount=$pgno*$showitems;
}
mysql_data_seek($rs, $pgcount);
$cnt=0;
pagebar($pages);
echo "