#!/usr/local/bin/perl
#------------------------------------------------------#
#                 本程序為飛喵喵提供 
#                Yuzi論壇3000 免費版 v3.47             
#                                                      
#                                                      
#                此程式由 台北抒情夜 中文化            
#                                                      
#    中文化版本 : v3.47b5                              
#    日期       : 2001.2.11                            
#    中文化作者 : 台北抒情夜站長 DC                    
#                                                      
#    台北抒情夜 http://www.ttt.idv.tw                  
#                                                      
#------------------------------------------------------#
require "setup.cgi";
######################
## 以下部分不需修改 ##
######################
$cgiurl="bbs.cgi";
$from    = $ENV{'REMOTE_ADDR'};
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday)= localtime(time+(3600*$time_hour));
$mon=$mon+1;
if($mon <10){$mon="0".$mon;}
if($mday<10){$mday="0".$mday;}
if($hour<10){$hour="0".$hour;}
if($min<10){$min="0".$min;}
if($sec<10){$sec="0".$sec;}
$year=$year+1900;
$thistime=$year."-".$mon."-".$mday.".".$hour.":".$min.":".$sec;
$lasttime=$year."-".$mon."-".$mday;
$topdata=$year.$mon;
$ftime=$year.$mon.$mday.$hour.$min.$sec;
##########
if ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
else {
$buffer = $ENV{'QUERY_STRING'};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$value =~ s/\t/--/g;
$value =~ s/>/&gt;/g;
$value =~ s/</&lt;/g;
$value =~ s/\n/\<br\>/g;
$FORM{$name} = $value;
}
##########
$id= $FORM{'id'};
$see  = $FORM{'see'};
$emote  = $FORM{'emote'};
$username = $FORM{'username'};
$yjhf = $FORM{'yjhf'};
$userpsd  = $FORM{'userpsd'};
$titles   = $FORM{'titles'};
$comment  = $FORM{'comment'};
$search   = $FORM{'search'};
$mail     = $FORM{'mail'};
$home     = $FORM{'home'};
$menu = $FORM{'menu'};
$no = $FORM{'no'};
$replytime= $FORM{'replytime'};
$retitles= $FORM{'retitles'};
$deltitle = $FORM{'deltitle'};
$rdcomment = $FORM{'rdcomment'};
$sign=$FORM{'sign'};
&GetCookies;
if ($username eq ""){$username=$Cookies{username}};
if ($userpsd eq ""){$userpsd=$Cookies{password}};
$username=~ s/\ //g;
$username=~ s/\　//g;
$username=~ s/\--//g;
$peo="$filepath/temp/$id.top$topdata";
unless(-f $peo){
open(TMP,">$peo");
close(TMP);
chmod(0666,$peo);
}
unless(-f "$filepath/temp/$id.stat"){
open(TMP,">$filepath/temp/$id.stat");
print TMP 0;
close(TMP);
chmod(0666,"$filepath/temp/$id.stat");
}
##########
$filename="$people";
($sec,$min,$hour,$mday,$mon,$year)=localtime(time);
$mon=$mon+1;
$year=$year+1900;
$people=1;
open (FILE,"$filename");
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;
open (FILE,">$filename");
for ($i=0;$i<$SIZE;$i++)
{
$_=$LINES[$i];
($addr,$come_hour,$come_min,$come_sec,$host,$come_time,$olduser)=split(/,/,$_);
$flag=($hour-$come_hour)*3600+($min-$come_min)*60+($sec-$come_sec);
if ( $addr eq "$ENV{'REMOTE_ADDR'}" ) {
print FILE "$ENV{'REMOTE_ADDR'},$hour,$min,$sec,$ENV{'REMOTE_HOST'},$come_time,$username,$id\n";
$check=1;
}
elsif ($flag < 120 && $flag > 0) {
print FILE $_;
$people++;
}
}
if ($check == 0) {
print FILE "$ENV{'REMOTE_ADDR'},$hour,$min,$sec,$ENV{'REMOTE_HOST'},$hour:$min:$sec,$username,$id\n";
open(PSD,"$filepath/temp/$id.stat");
@lines=<PSD>;
close(PSD);
open(PSD,">$filepath/temp/$id.stat");
foreach $line (@lines) {
if($line ne ""){
($jrll)=split(/\t/,$line);
unless($jrll){$jrll=1;}
$jrll=$jrll+1;
print PSD $jrll;
}
}
close(PSD);
open (FILE,"$peo");
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;
open (FILE,">$peo");
for ($i=0;$i<$SIZE;$i++)
{
$_=$LINES[$i];
($addr,$host,$come_time,$olduser,$tlsj)=split(/,/,$_);
if ( $olduser eq $username ) {
$tlsj=$tlsj+1;
print FILE "$ENV{'REMOTE_ADDR'},$ENV{'REMOTE_HOST'},$thistime,$username,$tlsj\n";
$check1=1;
}else{
print FILE $_;
}
}
if ($check1 == 0) {
print FILE "$ENV{'REMOTE_ADDR'},$ENV{'REMOTE_HOST'},$thistime,$username,1\n";
}
close (FILE);
}
close (FILE);
##########
if($id ne ""){
open (CHAT,"$filepath/list/$id.cgi");
$line=<CHAT>;
close(CHAT);
($rname,$rpass,$bzrmail,$rhome,$rtitle,$yhq,$rtime,$htmlt,$htmlw,$jj,$fbzmc)=split(/\t/,$line);
open(TITLESyu,"$filepath/yhzl/$rname.cgi");
$myu=<TITLESyu>;
close(TITLESyu);
($bzdel)=split(/\t/,$myu);
$fbzmc=~ s/\n//g;
if($fbzmc ne ""){
open(TITLESyu2,"$filepath/yhzl/$fbzmc.cgi");
$myu2=<TITLESyu2>;
close(TITLESyu2);
($fbzdel)=split(/\t/,$myu2);
}
$admname=$rname;
$bbsname    = $rtitle;
$outurl = $rhome  ;
}
if($username ne ""){
$yhzlurl ="$filepath/yhzl/$username.cgi";
if($regok eq "0"){
unless(-f $yhzlurl){
open(PSD,">$yhzlurl");
print PSD $userpsd."\t".$username."\t".$mail."\t".$home."\t".$lasttime;
close(PSD);
chmod(0666,$yhzlurl);
}}
open(PSD,"$yhzlurl");
$liness=<PSD>;
close(PSD);
$liness=~ s/\n//g;
($rdpassword)=split(/\t/,$liness);
if($rdpassword ne $userpsd){&errorview("名字沒有註冊或密碼錯誤! ");exit;}
}
if($bbsname eq ""){$bbsname="公告欄";}
if($FORM{'page'}){$page = $FORM{'page'};}
else{$page =0;}
if($FORM{'slttitle'}){$slttitle = $FORM{'slttitle'};}
else{$slttitle =0;}
if($menu eq "findtitle"){&findtitle; exit;}
if($menu eq "show1"){&show1; exit;}
if($menu eq "fabiao1"){&fabiao1; exit;}
if($menu eq "reply"){&reply; exit;}
if($menu eq "reg"){&reg;exit;}
if($menu eq "show"){&show; exit;}
if($menu eq "fabiao"){&fabiao;exit;}
if($menu eq "win"){&win;exit;}
if($menu eq "addtitle"){&addtitle; exit;}
if($menu eq "delreply"){&delreply; exit;}
if($menu eq "deltitle"){&deltitle; exit;}
if($menu eq "viewjh"){&viewjh; exit;}
if($menu eq "editform"){&editform; exit;}
if($menu eq "reditform"){&reditform; exit;}
if($menu eq "edit"){&edit; exit;}
if($menu eq "redit"){&redit; exit;}
if($menu eq "viewreply"){&viewreply; exit;}
&listtitle;
exit;
##########
sub listtitle{
if ($username ne ""){
$counter ="$filepath/guest/2$username.cgi";
unless(-f $counter){
open(TMP,">$counter");
close(TMP);
chmod(0666,$counter);
}
open(NUMBER,"$counter");
$NUMBER=<NUMBER>;
close(NUMBER);
($lys,$oldlys,$money,$charm)=split(/\t/,$NUMBER);
$lys=$lys+0;
$oldlys=$oldlys+0;
if ($oldlys<$lys){
$lytrue=1;
$lytrues=$lys-$oldlys;
open(NUMBER,">$counter");
print NUMBER "$lys"."\t"."$lys"."\t"."$money"."\t"."$charm";
close(NUMBER);
}
}
opendir (MEMBERDIR, "$filepath/list/$id"); 
@members = readdir(MEMBERDIR);
closedir (MEMBERDIR);
$members=@members;
if ((-z "$filepath/list/$id/bbs")&&($members > 9)) {print "Location: search.cgi?menu=index&id=$id\n\n";}
open(TITLES,"$filepath/list/$id/bbs");
@hastitles=<TITLES>;
close(TITLES);
$size=@hastitles;
if (-z "$filepath/temp/$id.stat"){
$ssiizzee=$size*50;
open(TMP,">$filepath/temp/$id.stat");
print TMP $ssiizzee;
close(TMP);
}
open(PSD,"$filepath/temp/$id.stat");
$jrll=<PSD>;
close(PSD);
open(PSD,"$filepath/list/bbs");
$index=<PSD>;
close(PSD);
open(PSD,"$filepath/list/$index");
$line=<PSD>;
close(PSD);
($index)=split(/\t/,$line);
if (length($index) > 22) {$index = substr($index,0,22);$index.="...";} 
unless(-x "$filepath/list/$id/"){chmod(0777,"$filepath/list/$id/");}
&send_html;
print <<EOF;
<html>
<head>
<title>$bbsname（BBS 風格）</title>
<style type=text/css>
a:link {  font-family: 宋體, serif; font-size: 9pt; color: #004080; text-decoration: none}
a:hover {  color: #004080; text-decoration: underline; background-color: #CCCC99}
a:visited {  text-decoration: none}
td {  font-family: 宋體, serif; font-size: 9pt}
body {  font-family: 宋體,serif; font-size: 9pt}
</style>
</head>
<SCRIPT language=JavaScript>function openWindow(url) {popupWin = window.open('guest.cgi?guest=$username&password=$userpsd','','resizable,scrollbars')}
function New(para_URL)
{var URL =new String(para_URL)
window.open(URL,'','resizable,scrollbars')}
</SCRIPT>
<body topmargin=0>
$htmlt
<table border=0 width=100% cellspacing=0 cellpadding=0>
<tr>
<td width=50% align=center>
<table width=100% border=0 cellpadding=4 cellspacing=0 background=$imagurl/tablebg.gif><tr><td><font color=#FFFFFF>交流區名稱：<a href=$cgiurl?id=$id><font color=#FFFFFF>$bbsname</a></font>　　版主：<a href=yhreg.cgi?menu=viewuser&username=$admname target=_blank><font color=#FFFFFF>$admname</a></font> <a href=yhreg.cgi?menu=viewuser&username=$fbzmc target=_blank><font color=#FFFFFF>$fbzmc</a></font></td><td><font color=#ffffff><marquee width=300>$jj</marquee></font></td><td align=right>
EOF
if(($outurl ne "")&&($outurl ne "http://")){
print "<a href=$outurl target=_blank><font color=#FFFFFF>$outurl</font></a></td>";
}else{print "<a href=list.cgi target=_top><font color=#FFFFFF>$cityname</font></a></td>";}
print <<EOF;
</tr></table><br><table border=0 cellPadding=0 cellSpacing=0 height=16 style=PADDING-LEFT: 10px; PADDING-RIGHT: 10px><tr><td height=16  width=500><a href=$cgiurl?menu=fabiao&id=$id><img src=$imagurl/sbutton-post2.gif border=0 alt=發 表 width=59 height=21></a></td>
<td width=100% align=right><span style=font-size: 9pt><a href=$cgiurl?menu=findtitle&search=$lasttime&id=$id>查看今天的文章</a><font color=#FF0000>>></font><font color=#FF0000>>></font><a href=xiu.cgi target=_blank>版主資料修改</a><font color=#FF0000>>></font><a href=yhreg.cgi target=_blank>用戶資料註冊</a><font color=#FF0000>>></font><a href=yhxiu.cgi target=_blank>用戶資料修改</a><font color=#FF0000>>></font><a href=yhreg.cgi?id=$id&menu=guoke target=_blank>用戶排行榜</a><font color=#FF0000>>></font><a href=$cgiurl?menu=viewjh&id=$id>精華區</a><font color=#FF0000>>></font><a href=$imagurl/help.htm target=_blank>使用幫助</a><br><img src=$imagurl/caution.gif><a href=affiche.cgi target=_blank>$index</a>　
EOF
if ($username eq ""){
print <<EOF;
<img src=$imagurl/101.gif><a href=yhreg.cgi?menu=online>喵喵線上人數: <font color=#FF0000>$people</font></a>　<img src=$imagurl/101.gif>文章數: <font color=#ff0000>$size</font>　<img src=$imagurl/101.gif>訪客: <font color=#ff0000>$jrll</font></span></td>
EOF
}else {
if ($lytrue==0){
print <<EOF;
<img src=$imagurl/101.gif><a href=javascript:openWindow()>$username的留言本</a>  <img src=$imagurl/101.gif><a href=yhreg.cgi?menu=online>線上人數: <font color=#FF0000>$people</font></a>　<img src=$imagurl/101.gif>文章數: <font color=#ff0000>$size</font>　<img src=$imagurl/101.gif>訪問數: <font color=#ff0000>$jrll</font></span></td>
EOF
}else{
print <<EOF;
<bgsound src=$imagurl/msg.wav loop=$lytrues><img src=$imagurl/101.gif><a href="javascript:openWindow()">您有 <font color=#FF0000>$lytrues</font> 條新留言</a>  <img src=$imagurl/101.gif><a href=yhreg.cgi?menu=online>線上人數: <font color=#FF0000>$people</font></a>　<img src=$imagurl/101.gif>論題數: <font color=#ff0000>$size</font>　<img src=$imagurl/101.gif>訪問數: <font color=#ff0000>$jrll</font></span></td>
<SCRIPT language=JavaScript>
alert ("您有 $lytrues 條新留言");
</SCRIPT>
EOF
}
}
print <<EOF;
</tr></table></table>
<table width=100% cellspacing=1 bgcolor=$bgcolor>
<tr align=center>
<td width=4% background=$imagurl/tablebg.gif>　</td>
<td width=3% background=$imagurl/tablebg.gif>　</td>
<td width=38% background=$imagurl/tablebg.gif>文章標題</td>
<td width=7% background=$imagurl/tablebg.gif>新窗口</td>
<td width=8% background=$imagurl/tablebg.gif>作者</td>
<td width=7% background=$imagurl/tablebg.gif>字[回]</td>
<td width=8% background=$imagurl/tablebg.gif>最後回覆</td>
<td width=19% background=$imagurl/tablebg.gif>最後更新時間</td>
<td width=6% background=$imagurl/tablebg.gif>來訪</td>
</tr>
</table>
EOF
if($sign ne ""){$page=$sign*20-20};
$syy=$page-20;
for ($i=$page; $i<$page+20; $i++){
$hastitle=@hastitles[$i];
$hastitle=~ s/\n//g;
if($hastitle ne ""){
($rcomment)=split(/\t/,$hastitle);
open(TITLES,"$filepath/list/$id/$rcomment");
$m=<TITLES>;
close(TITLES);
$m=~ s/\n//g;
($rtitles,$rthistime,$rusername,$nr,$rfrom,$rhasreply,$emote,$lastname,$rlasttime,$re,$rhassee,$jing,$lock)=split(/\t/,$m);
if (length($rtitles) > 40) {$rtitles = substr($rtitles,0,40);$rtitles.="...";} 
$see8=$see8+1;
$see=$see8+$page;
if($rhasreply<15){$hot="closed.gif";}
if($rhasreply>=15){$hot="hot.gif";}
if($rhasreply<=0){$hot="closedb.gif";}
if ($lock eq "1"){$hot="lock.gif";}
($oldday)=split(/\./,$rlasttime);
$new="";
if(($rhassee<=10)&&($oldday eq $lasttime)){$new="new.gif";}
if ($rusername eq $username){$my="my.gif";}else{$my="";}
if ($jing eq "1"){$my="jh.gif";}
print <<EOF;
<table width=100% cellspacing=1 bgcolor=$bgcolor><tr align=center><td width=4% bgcolor=$bgcolor2><img src=$imagurl/$hot></td>
EOF
if ($my ne ""){
print <<EOF;
<td bgcolor=$bgcolor1 width=3%><img src=$imagurl/$my></td>
EOF
}else{
print <<EOF;
<td bgcolor=$bgcolor1 width=3%>　</td>
EOF
}
print <<EOF;
<td bgcolor=$bgcolor2 align=left width=38%><img src=$imagurl/$emote.gif> <a href=$cgiurl?menu=show&id=$id&slttitle=$rcomment&see=$see>$rtitles</a>
EOF
if(($new ne "")){
print "<img src=$imagurl/$new>";
}
if($rhasreply eq 0){$rhasreply=length($nr);}else{$rhasreply="<font color=#FF0000>[$rhasreply]</font>";}
print <<EOF;
</td><td bgcolor=$bgcolor1 width=7%><a href=JavaScript:New('$cgiurl?menu=show&id=$id&slttitle=$rcomment&see=$see')><img border=0 src=$imagurl/newwin.gif></a></td>
<td bgcolor=$bgcolor2 width=8%><a href=yhreg.cgi?menu=viewuser&username=$rusername target=_blank>$rusername</a></td>
<td bgcolor=$bgcolor1 width=7%>$rhasreply</td>
<td bgcolor=$bgcolor2 width=8%><a href=yhreg.cgi?menu=viewuser&username=$lastname target=_blank>$lastname</a></td>
<td bgcolor=$bgcolor1 width=19%><a href=$cgiurl?menu=show&slttitle=$rcomment&id=$id&see=$see#$rlasttime><img src=$imagurl/lastpost.gif border=0 alt=到最後發表文章></a> $rlasttime</td>
<td bgcolor=$bgcolor2 width=6%>$rhassee</td></tr></table>
EOF
}
}
$gpage=$page+20;
$dye=$gpage-19;
if($page eq "0"){$page=20;$ge=1};
$yep=$page/20+1-$ge;
$ysize=$size/20+1;
($ysize)=split(/\./,$ysize);
print <<EOF;
</table>
<table border=0 width=100% cellspacing=0 cellpadding=0><tbody><tr>
<td align=center valign=baseline>
<form method=post action=$cgirul><input type=hidden name=id value=$id>
<FONT color=#000066>直接跳到第<INPUT size=1 name=sign value=$yep>頁　$yep/$ysize頁 -- 第$dye條到第$gpage條</FONT></td></form>
<td align="right">
EOF
if($syy>-1){
print "<a href=$cgiurl?id=$id&page=$syy><img src=$imagurl/sbutton-backpage.gif  border=0></a>";
}else{
print "<img src=$imagurl/sbutton-backpage.gif>";
}
if(($size>20)&&($i<$size)){
print "<a href=$cgiurl?id=$id&page=$i><img src=$imagurl/sbutton-nextpage.gif  border=0></a>";
}else{
print "<img src=$imagurl/sbutton-nextpage.gif>";
}
if(($outurl ne "")&&($outurl ne "http://")){
print "<a href=$outurl><img src=$imagurl/sbutton-back.gif  border=0></a>";
}else{
print "<a href=javascript:history.back(1)><img src=$imagurl/sbutton-back.gif  border=0></a>";}
print <<EOF;
</td>
</tr>
</table>
<table border=0 width=100%>
<tr valign=top>
<td width=100% valign=middle align=center>
<table width=350 border=1 cellspacing=0 cellpadding=0 bordercolorlight=#008000 bordercolordark=#FFFFFF>
<tr bgcolor=#CFE3FE>
<form method=post>
<td background=$imagurl/tablebg.gif width=100% align=center colspan=2> <input type=hidden name=menu value=findtitle><font color=white>輸入您要搜索的字串  </font><input type=hidden name=id size=28 value=$id><input type=hidden name=userpsd value=$userpsd><input type=hidden name=username value=$username><input type=text name=search size=20> <input name=submit type=submit style="background-image: url('$imagurl/tablebg.gif'); border: 0px"  value=" 搜 索 ">
</td>
</form>
</tr>
<tr bgcolor=#CFE3FE>
<form method=post>
<td background=$imagurl/tablebg.gif width=100% align=center colspan=2> <input type=hidden name=menu value=win><font color=white>您的姓名 </font><input type=text name=username size=9 value=><font color=white> 您的密碼 </font><input type=password name=userpsd size=9 value=><input type=hidden name=id size=28 value=$id> <input name=submit type=submit style="background-image: url('$imagurl/tablebg.gif') ; border: 0px" value=" 登 陸 ">
</td>
</form>
</tr>
</table>
</td>
</tr>
</table>
<br><center>
$htmlw
<hr noShade SIZE=1 width=450>
<div align=center>
<table border=0 cellSpacing=4 width=545>
<tbody>
<tr align=middle>
<td width=533>飛喵喵交流區純屬發表者個人意見，與<font color=#ff6633><b>
<font face=Arial, Helvetica, sans-serif>$zyname</font></b></font>
立場無關</td>
</tr>
<tr align=middle>
<td width=533>空服交流區服務由<font color=#cc0033>
</font><font color=#ff6633><b><font Helvetica, sans-serif><a href=$zyurl target=_blank>$zyname</a></font></b></font><font color=#cc0033>
</font>提供：<b>飛喵喵</a><br>中文化 
</tr>
</tbody>
</table>
</html>
EOF
exit;
}
##########
sub show{
unless(-f "$filepath/list/$id/$slttitle"){&errorview("此文章已經被刪除了！");exit;}
&send_html;
print <<EOF;
<HTML>
<HEAD>
<style type=text/css>
a:link {  font-family: 宋體, serif; font-size: 9pt; color: #004080; text-decoration: none}
a:hover {  color: #004080; text-decoration: underline; background-color: #CCCC99}
a:visited {  text-decoration: none}
td {  font-family: 宋體,serif; font-size: 9pt}
body {  font-family: 宋體,serif; font-size: 9pt}
</style>
</HEAD>
<body topmargin=0>
$htmlt
<table width="100%" border="0" cellpadding="4" cellspacing="0" background=$imagurl/tablebg.gif>
<tr>
<td><font color="#FFFFFF">討論區名稱：<a href="$cgiurl?id=$id"><font color="#FFFFFF">$bbsname</a></font>　　版主：<a href=yhreg.cgi?menu=viewuser&username=$admname target=_blank><font color=#FFFFFF>$admname</a></font> <a href=yhreg.cgi?menu=viewuser&username=$fbzmc target=_blank><font color=#FFFFFF>$fbzmc</a></font></td>
<td><font color=#ffffff><marquee width=300>$jj</marquee></font></td>
<td align=right>
EOF
if(($outurl ne "")&&($outurl ne "http://")){
print "<a href=$outurl target=_blank><font color=#FFFFFF>$outurl</font></a></td>";
}else{print "<a href=list.cgi target=_top><font color=#FFFFFF>$cityname</font></a></td>";}
print <<EOF;
</tr>
</table>
<br>
<br>
</table>
EOF
open(TITLES,"$filepath/list/$id/$slttitle");
$m=<TITLES>;
close(TITLES);
($rtitles,$rthistime,$rusername,$nr,$rfrom,$rhasreply,$remote,$rlastname,$rlasttime,$re,$rhassee,$jing,$lock)=split(/\t/,$m);
if($see eq ""){$see=1;}
$see2=$see-1;$see=$see+1;
if($see2 eq "0"){$see2=1;}
$replytime=$rthistime;
$seachreply=$rhasreply;
$thistitle=$rtitles;
if(($userpsd ne $delpsd)&&($userpsd ne $bzdel)){($ip1,$ip2,$ip3,$ip4)=split(/\./,$rfrom);$rfrom  = "$ip1.$ip2.$ip3.*";}
print<<EOF;
<title>$rtitles</title><div align=center>
<table border=0 width=90%><tr><td width=33%><img src=$imagurl/bookmark.gif> <a href="javascript:window.external.AddFavorite('$ym/$cgiurl?menu=show&slttitle=$slttitle&id=$id','$rtitles')">將文章加入您的收藏夾</a></td>
<td width=33% align=center><img src=$imagurl/email.gif> <a href="#" onClick="javascript:open('yhreg.cgi?menu=email&index=$slttitle&id=$id','','resizable,scrollbars')">將本頁寄給您的朋友</a></td>
<td width=33% align=right><img src=$imagurl/print.gif> <a href="javascript:window.print()">將本頁輸出到印表機</a></td></tr></table>
<table width="90%" border=1 cellpadding="0" cellspacing="0" bordercolorlight="#5E9BF7" bordercolordark="#FFFFFF" >
<tr bgcolor=$bgcolor3><td colspan="1"><font color="#CC0033">文章標題：</font><img src='$imagurl/$remote.gif' > $rtitles　　　<font color="#004080"></font>
EOF
$yhzlurl ="$filepath/yhzl/$rusername.cgi";
unless(-f $yhzlurl){
open(TMP,">$yhzlurl");
close(TMP);
chmod(0666,$yhzlurl);
}
open(PSD,"$filepath/yhzl/$rusername.cgi");
$lines=<PSD>;
close(PSD);
$lines=~ s/\n//g;
($rdpassword,$rname,$rmail,$rhome,$rlast,$rqm,$rdsex,$rdwork,$rcity,$rdlove,$rdfy,$rdhf,$tu,$jiao,$iewin,$oicq)=split(/\t/,$lines);
($kkk)=split(/\)/,$iewin);
($bzd,$ie,$win)=split(/;/,$kkk);
$tol=$rdfy+$rdhf;
if($tol <  11){$deji="<img src=$imagurl/star1.gif>";}
elsif ($tol >  10 && $tol <  31){$deji="<img src=$imagurl/star1.gif>";}
elsif ($tol >  30 && $tol <  101){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif>";}
elsif ($tol >  100 && $tol <  201){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif>";}
elsif ($tol >  200 && $tol <  501){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif>";}
elsif ($tol >  500 && $tol <  1001){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif>";}
elsif ($tol >  1000 && $tol <  2001){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif><img src=$imagurl/star4.gif>";}
elsif ($tol >  2000){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif><img src=$imagurl/star4.gif><img src=$imagurl/star5.gif>";}
print <<EOF;
<a href=$cgiurl?menu=findtitle&id=$id&search=$rusername><img border=0 src=$imagurl/find.gif alt=搜索$rusername所有的留言></a>　<a target=_blank href=yhreg.cgi?menu=viewuser&username=$rusername><img border=0 src=$imagurl/pro.gif alt=查看$rusername的信息></a>　<a href=quote.cgi?id=$id&replytime=$slttitle&bbs=$cgiurl&yjhf=$rmail><img border=0 src=$imagurl/quote.gif alt=回覆時引用本文></a>　<a href=quote.cgi?id=$id&menu=copy&replytime=$slttitle><img border=0 src=$imagurl/copy.gif alt=copy此文章內容></a>　<a href=quote.cgi?id=$id&menu=mail&replytime=$slttitle><img border=0 src=$imagurl/mailto.gif alt=將文章內容通過email打包下載></a>　<a target=_blank href=guest.cgi?action=add_form&guest=$rusername><img border=0 src=$imagurl/pm.gif alt=給$rusername留言></a>&nbsp;
EOF
if(($rmail ne "")){print "<a href=mailto:$rmail><img border=0 src=$imagurl/mail.gif alt=給$rusername發信></a>　";}
if(($rhome ne "")&&($rhome ne "http://")){print "<a target=_blank href=$rhome><img border=0 src=$imagurl/home.gif alt=訪問$rusername的主頁></a>　";}
if ($rusername eq $username){print "<a href=$cgiurl?menu=editform&deltitle=$slttitle&id=$id><img border=0 src=$imagurl/xg.gif alt=修改文章></a>　";}
if ($oicq ne ""){print "<img border=0 src=$imagurl/oicq.gif alt=$rusername的OICQ號碼：$oicq>　";}
$online="<img border=0 src=$imagurl/offzx.gif alt=離線>";
open (PEO,"$filepath/data/people.cgi");
@linesz=<PEO>;
close (PEO);
foreach $linesz (@linesz) {
($rip,$r1,$r2,$r3,$r4,$rtimez,$rnamez)=split(/,/,$linesz);
if ($rnamez eq $rusername){$online="<img border=0 src=$imagurl/onzx.gif alt=在線>";}}
print <<EOF;
<img border=0 src=$imagurl/ip.gif alt=$rusername的IP地址：$rfrom>　<a href=$cgiurl?menu=deltitle&deltitle=$slttitle&id=$id><img border=0 src=$imagurl/del.gif alt=刪除此文章></a>
EOF
open(PSD,"$filepath/list/$id/$slttitle");
$line=<PSD>;
close(PSD);
open(PSD,">$filepath/list/$id/$slttitle");
($rtitles,$rthistime,$rusername,$nr,$rfrom88,$rhasreply,$remote,$rlastname,$rlasttime,$re,$rhassee,$jing,$lock)=split(/\t/,$line);
$rhassee++;
print PSD $rtitles."\t".$rthistime."\t".$rusername."\t".$nr."\t".$rfrom88."\t".$rhasreply."\t".$remote."\t".$rlastname."\t".$rlasttime."\t".$re."\t".$rhassee."\t".$jing."\t".$lock;
close(PSD);
print<<EOF;
</td></tr><tr><td colspan="4"><table width=100% border=0 cellspacing=4><tr><td><tr><td valign=top rowspan=2 align=center><IMG SRC=$imagurl/image$tu.gif><br>$deji</td><td width=99% rowspan=2>$nr
EOF
if(($rqm ne "")){
print "<br>──────────<br>$rqm";
}
print <<EOF;
<td align=right valign=top>$online</td></tr><tr><td align=right valign=bottom><img src=$imagurl/system.gif alt="$ie$win"></td></td></tr></table></td><tr bgcolor=$bgcolor3><td colspan="4" align="center">作者：
EOF
if($rmail ne ""){print "<a href=mailto:$rmail>$rusername</a>　";}else{print "$rusername　";}
if(($rhome ne "")&&($rhome ne "http://")){print "<a target=_blank href=$rhome>$rhome</a>";}
print <<EOF;
　時間：$rthistime　來源：
EOF
if($rcity ne ""){print "$rcity";}else{print "$rfrom";}
print <<EOF;
</tr></table></center></div><div align=center><table border=0 borderColor=#008000 borderColorDark=#9EC49D borderColorLight=#65A264 cellPadding=0 cellSpacing=1 height=19><tr><td width=15%><a href=$cgiurl?menu=fabiao1&id=$id&replytime=$slttitle&retitles=$rtitles&yjhf=$rdmail><img src=$imagurl/sbutton-rep2.gif border=0></a></td><td width="45%" align="center"><a href="$cgiurl?menu=show1&id=$id&see=$see2"><img src="$imagurl/sbutton-backword.gif" width="59" height="21" border="0"></a><a href="$cgiurl?menu=show1&id=$id&see=$see"><img src="$imagurl/sbutton-nextword.gif" width="59" height="21" border="0"></a><a href=javascript:history.back()><img src="$imagurl/sbutton-back.gif" width="59" height="21" border="0"></a></td></tr></table>
EOF
if($seachreply > 0){
open(REPLY,"$filepath/list/$id/$re");
@hasreply=<REPLY>;
close(REPLY);
foreach $m (@hasreply){
$m=~ s/\n//g;
if($m ne ""){
($rtime,$rthistime,$rusername,$rcomment,$rfrom,$remote,$retitles)=split(/\t/,$m);
if($rtime eq $slttitle){
print <<EOF;
<div align="center"><center><table width="85%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#5E9BF7" bordercolordark="#FFFFFF"><tr bgcolor=$bgcolor3><td ><img src=$imagurl/$remote.gif > <a NAME=$rthistime>$retitles</a>　　　
EOF
$yhzlurl ="$filepath/yhzl/$rusername.cgi";
unless(-f $yhzlurl){
open(TMP,">$yhzlurl");
close(TMP);
chmod(0666,$yhzlurl);
}
open(PSD,"$filepath/yhzl/$rusername.cgi");
$lines=<PSD>;
close(PSD);
$lines=~ s/\n//g;
($rdpassword,$rdname,$rdmail,$rdhome,$rlast,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rdfy,$rdhf,$tu,$jiao,$iewin,$oicq)=split(/\t/,$lines);
($kkk)=split(/\)/,$iewin);
($bzd,$ie,$win)=split(/;/,$kkk);
$tol=$rdfy+$rdhf;
if($tol <  11){$deji="<img src=$imagurl/star1.gif>";}
elsif ($tol >  10 && $tol <  31){$deji="<img src=$imagurl/star1.gif>";}
elsif ($tol >  30 && $tol <  101){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif>";}
elsif ($tol >  100 && $tol <  201){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif>";}
elsif ($tol >  200 && $tol <  501){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif>";}
elsif ($tol >  500 && $tol <  1001){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif>";}
elsif ($tol >  1000 && $tol <  2001){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif><img src=$imagurl/star4.gif>";}
elsif ($tol >  2000){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif><img src=$imagurl/star4.gif><img src=$imagurl/star5.gif>";}
if($rusername eq $rdname){
$rqm=$rdqm;
$rmail=$rdmail;
$rhome=$rdhome;
$rcity=$rdcity;
}
}
if(($userpsd ne $delpsd)&&($userpsd ne $bzdel)){($ip1,$ip2,$ip3,$ip4)=split(/\./,$rfrom);$rfrom  = "$ip1.$ip2.$ip3.*";}
print <<EOF;
<a href=$cgiurl?menu=findtitle&id=$id&search=$rusername><img border=0 src=$imagurl/find.gif alt=搜尋$rusername所有的文章></a>　<a target=_blank href=yhreg.cgi?menu=viewuser&username=$rusername><img border=0 src=$imagurl/pro.gif alt=查看$rusername的信息></a>　<a href=quote.cgi?id=$id&replytime=$slttitle&bbs=$cgiurl&fff=$rthistime&yjhf=$rmail><img border=0 src=$imagurl/quote.gif alt=回覆時引用此貼></a>　<a href=quote.cgi?id=$id&menu=copy&replytime=$slttitle&fff=$rthistime><img border=0 src=$imagurl/copy.gif alt=COPY此文章內容></a>　<a href=quote.cgi?id=$id&menu=mail&replytime=$slttitle&fff=$rthistime><img border=0 src=$imagurl/mailto.gif alt=將本文章內容通過email打包下載></a>　<a target=_blank href=guest.cgi?action=add_form&guest=$rusername><img border=0 src=$imagurl/pm.gif alt=給$rusername留言></a>&nbsp;
EOF
if(($rmail ne "")){
print "<a href=mailto:$rmail><img border=0 src=$imagurl/mail.gif alt=給$rusername發信></a>　";
}
if(($rhome ne "")&&($rhome ne "http://")){
print "<a target=_blank href=$rhome><img border=0 src=$imagurl/home.gif alt=訪問$rusername的主頁></a>　";
}
if ($rusername eq $username){
print "<a href=$cgiurl?menu=reditform&deltitle=$rthistime&id=$id&no=$re><img border=0 src=$imagurl/xg.gif alt=修改文章></a>　";
}
if ($oicq ne ""){
print "<img border=0 src=$imagurl/oicq.gif alt=$rusername的OICQ號碼：$oicq>　";
}
$onlined="<img border=0 src=$imagurl/offzx.gif alt=離線>";
open (PEO,"$filepath/data/people.cgi");
@lineszd=<PEO>;
close (PEO);
foreach $lineszd (@lineszd) {($rip,$r1,$r2,$r3,$r4,$rtimez,$rnamezd)=split(/,/,$lineszd);
if ($rnamezd eq $rusername){$onlined="<img border=0 src=$imagurl/onzx.gif alt=在線>";}
}
print <<EOF;
<a href=$cgiurl?menu=fabiao1&id=$id&replytime=$slttitle&retitles=$retitles><img border=0 src=$imagurl/hf.gif alt=回覆　$retitles></a>　<img border=0 src=$imagurl/ip.gif alt=$rusername的IP地址：$rfrom>　<a href=$cgiurl?menu=delreply&deltitle=$rthistime&id=$id&no=$re><img border=0 src=$imagurl/del.gif alt=刪除此文章></a></td></tr><tr><td><table width=100% border=0 cellspacing=4><tr><td><tr><td valign=top rowspan=2 align=center><IMG SRC=$imagurl/image$tu.gif><br>$deji</td><td width=99% rowspan=2>$rcomment
EOF
if(($rqm ne "")){print "<br>──────────<br>$rqm";}
print <<EOF;
<td align=right valign=top>$onlined</td></tr><tr><td align=right valign=bottom><img src=$imagurl/system.gif alt="$ie$win"></td></td></tr></table></td></tr><tr bgcolor=$bgcolor3><td align="center">作者：
EOF
if($rmail ne ""){print "<a href=mailto:$rmail>$rusername</a>　";}else{print "$rusername　";}
if(($rhome ne "")&&($rhome ne "http://")){print "<a target=_blank href=$rhome>$rhome</a>";}
print <<EOF;
　時間：$rthistime　來源：
EOF
if($rcity ne ""){print "$rcity";}else{print "$rfrom";}
print <<EOF;
</td></tr></table></center></div><br>
EOF
}}}
if ($rhasreply eq "0"){print "<br>";}print "管理選項: ";
if ($lock eq "1"){
print "<a href=quote.cgi?menu=lock&id=$id&replytime=$slttitle>打開主題</a>";
}else{
print "<a href=quote.cgi?menu=lock&id=$id&replytime=$slttitle>關閉主題</a>";
}
print " | <a href=move.cgi?id=$id&replytime=$slttitle>移動主題</a>";
if ($jing eq "1"){
print " | <a href=quote.cgi?menu=jing&id=$id&replytime=$slttitle>從精華區中移出</a>";
}else{
print " | <a href=quote.cgi?menu=jing&id=$id&replytime=$slttitle>添加到精華區</a>";
}
print " | <a href=$cgiurl?menu=deltitle&deltitle=$slttitle&id=$id>刪除主題</a>";
print <<EOF;
<hr noShade SIZE=1 width=450>
<div align=center>
<table border=0 cellSpacing=4 width=545>
<tbody>
<tr align=middle>
<td width=533>飛喵喵論壇言論純屬發表者個人意見，與<font color=#ff6633><b>
<font face=Arial, Helvetica, sans-serif>$zyname</font></b></font>
立場無關</td>
</tr>
<tr align=middle>
<td width=533>空服交流區服務由飛喵喵提供：</b></td>
</tr>
</tbody>
</table>
</body></html>
EOF
exit;
}
##########
sub show1{
open(TITLES,"$filepath/list/$id/bbs");
@hastitles=<TITLES>;
close(TITLES);
$ss=@hastitles;
$i=0;
foreach $m (@hastitles){
$i++;
$m=~ s/\n//g;
if($m ne ""){
($index)=split(/\t/,$m);
if($i eq $see){
$see1=$see+1;
$see2=$see-1;
if($see1>$ss){$see1=$ss;}
if($see2<1){$see2=1;}
open(TITLES,"$filepath/list/$id/$index");
@hastitles=<TITLES>;
close(TITLES);
foreach $m (@hastitles){
$m=~ s/\n//g;
if($m ne ""){
($rtitles,$rthistime,$rusername,$nr,$rfrom,$rhasreply,$remote,$rlastname,$rlasttime,$re,$rhassee,$jing,$lock)=split(/\t/,$m);
}
}
$replytime=$rthistime;
$seachreply=$rhasreply;
$thistitle=$rtitles;
open(PSD,"$filepath/yhzl/$rusername.cgi");
@lines=<PSD>;
close(PSD);
foreach $line (@lines) {
$line=~ s/\n//g;
($rdpassword,$rdname,$rdmail,$rdhome,$rlast,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rdfy,$rdhf,$tu,$jiao,$iewin,$oicq)=split(/\t/,$line);
($kkk)=split(/\)/,$iewin);
($bzd,$ie,$win)=split(/;/,$kkk);
$tol=$rdfy+$rdhf;
if($tol <  11){$deji="<img src=$imagurl/star1.gif>";}
elsif ($tol >  10 && $tol <  31){$deji="<img src=$imagurl/star1.gif>";}
elsif ($tol >  30 && $tol <  101){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif>";}
elsif ($tol >  100 && $tol <  201){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif>";}
elsif ($tol >  200 && $tol <  501){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif>";}
elsif ($tol >  500 && $tol <  1001){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif>";}
elsif ($tol >  1000 && $tol <  2001){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif><img src=$imagurl/star4.gif>";}
elsif ($tol >  2000){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif><img src=$imagurl/star4.gif><img src=$imagurl/star5.gif>";}
if($rusername eq $rdname){
$rqm=$rdqm;
$rmail=$rdmail;
$rhome=$rdhome;
$rcity=$rdcity;
}
}
if(($userpsd ne $delpsd)&&($userpsd ne $bzdel)){($ip1,$ip2,$ip3,$ip4)=split(/\./,$rfrom);$rfrom  = "$ip1.$ip2.$ip3.*";}
&send_html;
print <<EOF;
<HTML>
<head>
<style type=text/css>
a:link {  font-family: 宋體, serif; font-size: 9pt; color: #004080; text-decoration: none}
a:hover {  color: #004080; text-decoration: underline; background-color: #CCCC99}
a:visited {  text-decoration: none}
td {  font-family: 宋體, serif; font-size: 9pt}
body {  font-family: 宋體,serif; font-size: 9pt}
</style>
</head>
<body topmargin=0>
$htmlt
<table width="100%" border="0" cellpadding="4" cellspacing="0" background=$imagurl/tablebg.gif>
<tr>
<td><font color="#FFFFFF">論壇名稱：<a href="$cgiurl?id=$id"><font color="#FFFFFF">$bbsname</a></font>　　版主：<a href=yhreg.cgi?menu=viewuser&username=$admname target=_blank><font color=#FFFFFF>$admname</a></font> <a href=yhreg.cgi?menu=viewuser&username=$fbzmc target=_blank><font color=#FFFFFF>$fbzmc</a></font></td>
<td><font color=#ffffff><marquee width=300>$jj</marquee></font></td>
<td align=right>
EOF
if(($outurl ne "")&&($outurl ne "http://")){
print "<a href=$outurl target=_blank><font color=#FFFFFF>$outurl</font></a></td>";
}else{print "<a href=list.cgi target=_top><font color=#FFFFFF>$cityname</font></a></td>";}
print <<EOF;
</tr>
</table>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="50%">　</td>
</tr>
</table>
<title>$rtitles</title>
<div align=center>
<table border=0 width=90%><tr>
<td width=33%><img src=$imagurl/bookmark.gif> <a href="javascript:window.external.AddFavorite('$ym/$cgiurl?menu=show&slttitle=$index&id=$id','$rtitles')">將文章加入您的收藏夾</a></td>
<td width=33% align=center><img src=$imagurl/email.gif> <a href="#" onClick="javascript:open('yhreg.cgi?menu=email&index=$index&id=$id','','resizable,scrollbars')">將本頁發給您的朋友</a></td>
<td width=33% align=right><img src=$imagurl/print.gif> <a href="javascript:window.print()">將本頁輸出到印表機</a></td></tr></table>
<table width="90%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#5E9BF7" bordercolordark="#FFFFFF" >
<tr bgcolor=$bgcolor3>
<td colspan="1"><font color="#CC0033">文章標題：</font><img src='$imagurl/$remote.gif' > $rtitles　　　<font color="#004080"></font>
<a href=$cgiurl?menu=findtitle&id=$id&search=$rusername><img border=0 src=$imagurl/find.gif alt=搜尋$rusername所有的文章></a>　<a target=_blank href=yhreg.cgi?menu=viewuser&username=$rusername><img border=0 src=$imagurl/pro.gif alt=查看$rusername的信息></a>　<a href=quote.cgi?id=$id&replytime=$index&bbs=$cgiurl&yjhf=$rmail><img border=0 src=$imagurl/quote.gif alt=回覆時引用此貼></a>　<a href=quote.cgi?id=$id&menu=copy&replytime=$index><img border=0 src=$imagurl/copy.gif alt=覆制此貼內容></a>　<a href=quote.cgi?id=$id&menu=mail&replytime=$index><img border=0 src=$imagurl/mailto.gif alt=將本文章內容通過email打包下載></a>　<a target=_blank href=guest.cgi?action=add_form&guest=$rusername><img border=0 src=$imagurl/pm.gif alt=給$rusername留言></a>&nbsp;
EOF
if(($rmail ne "")){
print "<a href=mailto:$rmail><img border=0 src=$imagurl/mail.gif alt=給$rusername發信></a>　";
}
if(($rhome ne "")&&($rhome ne "http://")){
print "<a target=_blank href=$rhome><img border=0 src=$imagurl/home.gif alt=訪問$rusername的主頁></a>　";
}
if ($rusername eq $username){
print "<a href=$cgiurl?menu=editform&deltitle=$index&id=$id><img border=0 src=$imagurl/xg.gif alt=修改文章></a>　";
}
if ($oicq ne ""){
print "<img border=0 src=$imagurl/oicq.gif alt=$rusername的OICQ號碼：$oicq>　";
}
$online="<img border=0 src=$imagurl/offzx.gif alt=離線>";
open (PEO,"$filepath/data/people.cgi");
@linesz=<PEO>;
close (PEO);
foreach $linesz (@linesz) {
($rip,$r1,$r2,$r3,$r4,$rtimez,$rnamez)=split(/,/,$linesz);
if ($rnamez eq $rusername){$online="<img border=0 src=$imagurl/onzx.gif alt=在線>";}}
print <<EOF;
<img border=0 src=$imagurl/ip.gif alt=$rusername的IP地址：$rfrom>　<a href=$cgiurl?menu=deltitle&deltitle=$index&id=$id><img border=0 src=$imagurl/del.gif alt=刪除此文章></a></td></tr>
<tr>
<td colspan="4">
<table width="100%" border="0" cellspacing="4">
<tr>
<td>
  <tr>
    <td valign=top rowspan=2 align=center><IMG SRC=$imagurl/image$tu.gif><br>$deji</td>
    <td width=99% rowspan=2>$nr
EOF
if(($rqm ne "")){
print "<br>──────────<br>$rqm";
}
print <<EOF;
<td align=right valign=top>$online</td>
  </tr>
<tr>
<td align=right valign=bottom><img src=$imagurl/system.gif alt="$ie$win"></td>
</td>
  </tr>

</td>
</tr>
</table>
</td>
</tr>
<tr bgcolor=$bgcolor3>
<td colspan="4" align="center">作者：
EOF
if($rmail ne ""){
print "<a href=mailto:$rmail>$rusername</a>　";
}else{
print "$rusername　";
}
if(($rhome ne "")&&($rhome ne "http://")){
print "<a target=_blank href=$rhome>$rhome</a>";
}
print <<EOF;
　時間：$rthistime　來源：
EOF
if($rcity ne ""){
print "$rcity";
}else{
print "$rfrom";
}
print <<EOF;
</td>
</tr>
</table> </center>
</div>
<div align="center">
<table border="0" borderColor="#008000" borderColorDark="#9EC49D"
borderColorLight="#65A264" cellPadding="0" cellSpacing="1" height="19">
<tr>
<td width="15%">
<a href=$cgiurl?menu=fabiao1&id=$id&replytime=$index&retitles=$rtitles&yjhf=$rmail><img src=$imagurl/sbutton-rep2.gif border=0></a>
</td>
<td width="45%" align="center"><a href="$cgiurl?menu=show1&id=$id&see=$see2 "><img src="$imagurl/sbutton-backword.gif" width="59" height="21" border="0"></a><a href="$cgiurl?menu=show1&id=$id&see=$see1"><img src="$imagurl/sbutton-nextword.gif" width="59" height="21" border="0"></a><a href="$cgiurl?id=$id"><img src="$imagurl/sbutton-back.gif" width="59" height="21" border="0"></a></td>
</tr>
</table>
EOF
if($seachreply > 0){
open(REPLY,"$filepath/list/$id/$re");
}
}
}
@hasreply=<REPLY>;
close(REPLY);
foreach $m (@hasreply){
$m=~ s/\n//g;
if($m ne ""){
($rtime,$rthistime,$rusername,$rcomment,$rfrom,$remote,$retitles)=split(/\t/,$m);
if($index eq $rtime){
print <<EOF;
<div align="center">
<center>
<table width="85%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#5E9BF7" bordercolordark="#FFFFFF">
<tr bgcolor=$bgcolor3>
<td >
EOF
if($retitles eq ""){
print "<img src=$imagurl/$remote.gif > -回覆-　　　";
}else{
print "<img src=$imagurl/$remote.gif > $retitles　　　";
}
open(PSD,"$filepath/yhzl/$rusername.cgi");
@lines=<PSD>;
close(PSD);
foreach $line (@lines) {
$line=~ s/\n//g;
($rdpassword,$rdname,$rdmail,$rdhome,$rlast,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rdfy,$rdhf,$tu,$jiao,$iewin,$oicq)=split(/\t/,$line);
($kkk)=split(/\)/,$iewin);
($bzd,$ie,$win)=split(/;/,$kkk);
$tol=$rdfy+$rdhf;
if($tol <  11){$deji="<img src=$imagurl/star1.gif>";}
elsif ($tol >  10 && $tol <  31){$deji="<img src=$imagurl/star1.gif>";}
elsif ($tol >  30 && $tol <  101){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif>";}
elsif ($tol >  100 && $tol <  201){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif>";}
elsif ($tol >  200 && $tol <  501){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif>";}
elsif ($tol >  500 && $tol <  1001){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif>";}
elsif ($tol >  1000 && $tol <  2001){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif><img src=$imagurl/star4.gif>";}
elsif ($tol >  2000){$deji="<img src=$imagurl/star1.gif><img src=$imagurl/star2.gif><img src=$imagurl/star3.gif><img src=$imagurl/star4.gif><img src=$imagurl/star5.gif>";}
if($rusername eq $rdname){
$rqm=$rdqm;
$rmail=$rdmail;
$rhome=$rdhome;
$rcity=$rdcity;
}
}
if(($userpsd ne $delpsd)&&($userpsd ne $bzdel)){($ip1,$ip2,$ip3,$ip4)=split(/\./,$rfrom);$rfrom  = "$ip1.$ip2.$ip3.*";}
print <<EOF;
<a href=$cgiurl?menu=findtitle&id=$id&search=$rusername><img border=0 src=$imagurl/find.gif alt=搜索$rusername所有的文章></a>　<a target=_blank href=yhreg.cgi?menu=viewuser&username=$rusername><img border=0 src=$imagurl/pro.gif alt=查看$rusername的信息></a>　<a href=quote.cgi?id=$id&replytime=$index&bbs=$cgiurl&fff=$rthistime&yjhf=$rmail><img border=0 src=$imagurl/quote.gif alt=回覆時引用此貼></a>　<a href=quote.cgi?id=$id&menu=copy&replytime=$index&fff=$rthistime><img border=0 src=$imagurl/copy.gif alt=覆制此貼內容></a>　<a href=quote.cgi?id=$id&menu=mail&replytime=$index&fff=$rthistime><img border=0 src=$imagurl/mailto.gif alt=將本文章內容通過email打包下載></a>　<a target=_blank href=guest.cgi?action=add_form&guest=$rusername><img border=0 src=$imagurl/pm.gif alt=給$rusername留言></a>&nbsp;
EOF
if(($rmail ne "")){
print "<a href=mailto:$rmail><img border=0 src=$imagurl/mail.gif alt=給$rusername發信></a>　";
}
if(($rhome ne "")&&($rhome ne "http://")){
print "<a target=_blank href=$rhome><img border=0 src=$imagurl/home.gif alt=訪問$rusername的主頁></a>　";
}
if ($rusername eq $username){
print "<a href=$cgiurl?menu=reditform&deltitle=$rthistime&id=$id&no=$re><img border=0 src=$imagurl/xg.gif alt=修改文章></a>　";
}
if ($oicq ne ""){
print "<img border=0 src=$imagurl/oicq.gif alt=$rusername的OICQ號碼：$oicq>　";
}
$onlined="<img border=0 src=$imagurl/offzx.gif alt=離線>";
open (PEO,"$filepath/data/people.cgi");
@lineszd=<PEO>;
close (PEO);
foreach $lineszd (@lineszd) {($rip,$r1,$r2,$r3,$r4,$rtimez,$rnamezd)=split(/,/,$lineszd);
if ($rnamezd eq $rusername){$onlined="<img border=0 src=$imagurl/onzx.gif alt=在線>";}
}
print <<EOF;
<a href=$cgiurl?menu=fabiao1&id=$id&replytime=$index&retitles=$retitles><img border=0 src=$imagurl/hf.gif alt=回覆　$retitles></a>　<img border=0 src=$imagurl/ip.gif alt=$rusername的IP地址：$rfrom>　<a href=$cgiurl?menu=delreply&deltitle=$rthistime&id=$id&no=$re><img border=0 src=$imagurl/del.gif alt=刪除此文章></a>
</td></tr>
<tr>
<td>
<table width=100% border=0 cellspacing=4>
<tr>
<td>
  <tr>
    <td valign=top rowspan=2 align=center><IMG SRC=$imagurl/image$tu.gif><br>$deji</td>
    <td width=99% rowspan=2>$rcomment
EOF
if(($rqm ne "")){
print "<br>──────────<br>$rqm";
}
print <<EOF;
<td align=right valign=top>$onlined</td>
  </tr>
<tr>
<td align=right valign=bottom><img src=$imagurl/system.gif alt="$ie$win"></td>
</td>
  </tr>
</table>
</td>
</tr><tr bgcolor=$bgcolor3><td align="center">作者：
EOF
if($rmail ne ""){
print "<a href=mailto:$rmail>$rusername</a>　";
}else{
print "$rusername　";
}
if(($rhome ne "")&&($rhome ne "http://")){
print "<a target=_blank href=$rhome>$rhome</a>";
}
print <<EOF;
　時間：$rthistime　來源：
EOF
if($rcity ne ""){
print "$rcity";
}else{
print "$rfrom";
}
print <<EOF;
</td>
</tr>
</table>  </center>
</div>
<br>
EOF
}
}
}
}
if ($rhasreply eq "0"){print "<br>";}print "管理選項: ";
if ($lock eq "1"){
print "<a href=quote.cgi?menu=lock&id=$id&replytime=$index>打開主題</a>";}else{
print "<a href=quote.cgi?menu=lock&id=$id&replytime=$index>關閉主題</a>";}
print " | <a href=move.cgi?id=$id&replytime=$index>移動主題</a>";
if ($jing eq "1"){
print " | <a href=quote.cgi?menu=jing&id=$id&replytime=$index>從精華區中移出</a>";}else{
print " | <a href=quote.cgi?menu=jing&id=$id&replytime=$index>添加到精華區</a>";}
print " | <a href=$cgiurl?menu=deltitle&deltitle=$index&id=$id>刪除主題</a>";
print <<EOF;
<hr noShade SIZE=1 width=450>
<div align=center>
<table border=0 cellSpacing=4 width=545>
<tbody>
<tr align=middle>
<td width=533>本討論區言論純屬發表者個人意見，與飛喵喵立場無關</td>
</tr>
<tr align=middle>
<td width=533>免費論壇服務由飛喵喵提供<font color=#cc0033></td>
</tr>
</tbody>
</table>
EOF
exit;
}
##########
sub findtitle{
open(TITLES,"$filepath/list/$id/bbs");
@hastitles=<TITLES>;
close(TITLES);
$size=0;
$size1=0;
$syy=$page-20;
$findtmp="$filepath/temp/$id.tmp";
open(TMP,">$findtmp");
foreach  $hastitle (@hastitles){
$hastitle =~ s/\n//g;
if($hastitle ne ""){
($index)=split(/\t/,$hastitle);
if ( -e "$filepath/list/$id/$index"){
open(TITLES,"$filepath/list/$id/$index");
@a=<TITLES>;
close(TITLES);
foreach $m (@a){
$m=~ s/\n//g;
if($m ne ""){
($rtitles,$rthistime,$rusername,$nr,$rfrom,$rhasreply,$remote,$rlastname,$rlasttime,$re,$rhassee,$jing,$lock)=split(/\t/,$m);
}
}
}
if (($rusername =~ /$search/gi)||($nr=~ /$search/gi)||($rtitles=~ /$search/gi)||($rlastname=~ /$search/gi) ||($rlasttime=~ /$search/gi)   ){  
$size=$size+1;
$newtitle=$rtitles."\t".$index."\t".$rusername."\t".$nr."\t".$rfrom."\t".$rhasreply."\t".$remote."\t".$rlastname."\t".$rlasttime."\t".$re."\t".$rhassee."\t".$jing."\t".$lock;
print TMP $newtitle."\n";
}
}
}
close(TMP);
open(PSD,"$filepath/list/bbs");
$index=<PSD>;
close(PSD);
open(PSD,"$filepath/list/$index");
$line=<PSD>;
close(PSD);
($index)=split(/\t/,$line);
if (length($index) > 22) {$index = substr($index,0,22);$index.="...";} 
open(TITLES,"$findtmp");
@hastitles=<TITLES>;
close(TITLES);
&send_html;
print <<EOF;
<html>
<head>
<title>$bbsname</title>
<style type=text/css>
a:link {  font-family: 宋體, serif; font-size: 9pt; color: #004080; text-decoration: none}
a:hover {  color: #004080; text-decoration: underline; background-color: #CCCC99}
a:visited {  text-decoration: none}
td {  font-family: 宋體, serif; font-size: 9pt}
body {  font-family: 宋體,serif; font-size: 9pt}
</style>
</head>
<SCRIPT language=JavaScript>
function openWindow(url) {
  popupWin = window.open('guest.cgi?guest=$username&password=$userpsd','','resizable,scrollbars')
}
function New(para_URL)
{var URL =new String(para_URL)
window.open(URL,'','resizable,scrollbars')}
</SCRIPT>
<body topmargin=0>
$htmlt
<table width="100%" border="0" cellpadding="4" cellspacing="0" background=$imagurl/tablebg.gif>
<tr>
<td><font color="#FFFFFF">論壇名稱：<a href="$cgiurl?id=$id"><font color="#FFFFFF">$bbsname</a></font>　　版主：<a href=yhreg.cgi?menu=viewuser&username=$admname target=_blank><font color=#FFFFFF>$admname</a></font> <a href=yhreg.cgi?menu=viewuser&username=$fbzmc target=_blank><font color=#FFFFFF>$fbzmc</a></font></td>
<td><font color=#ffffff><marquee width=300>$jj</marquee></font></td>
<td align=right>
EOF
if(($outurl ne "")&&($outurl ne "http://")){
print "<a href=$outurl target=_blank><font color=#FFFFFF>$outurl</font></a></td>";
}else{print "<a href=list.cgi target=_top><font color=#FFFFFF>$cityname</font></a></td>";}
print <<EOF;
</tr>
</table>
<table border="0" cellPadding="0" cellSpacing="0" height="16" style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px">
<br>
<tr>
<td><div align="left"><left><table border="0" borderColor="#008000"
borderColorDark="#9EC49D" borderColorLight="#65A264" cellPadding="0" cellSpacing="1"
height="19">
<TBODY>
</TBODY>
<tr>
<td><a href="$cgiurl?menu=fabiao&id=$id"><img src="$imagurl/sbutton-post2.gif"  border="0"></a></td>
</tr>
</center></div></td>
</tr>
</table>
</td>
<td width=100% align=right><span style=font-size: 9pt><a href=$cgiurl?menu=findtitle&search=$lasttime&id=$id>查看今天的文章</a><font color=#FF0000>>></font><font color=#FF0000>>></font><a href=xiu.cgi target=_blank>版主資料修改</a><font color=#FF0000>>></font><a href=yhreg.cgi target=_blank>用戶資料註冊</a><font color=#FF0000>>></font><a href=yhxiu.cgi target=_blank>用戶資料修改</a><font color=#FF0000>>></font><a href=yhreg.cgi?id=$id&menu=guoke target=_blank>用戶排行榜</a><font color=#FF0000>>></font><a href=$cgiurl?menu=viewjh&id=$id>精華區</a><font color=#FF0000>>></font><a href=$imagurl/help.htm target=_blank>使用幫助</a><br><img src=$imagurl/caution.gif><a href=affiche.cgi target=_blank>$index</a>　
EOF
if ($username ne ""){
print "<img src=$imagurl/101.gif><a href=javascript:openWindow()>$username的留言本</a>　";
}
print <<EOF;
<img src=$imagurl/101.gif><a href=yhreg.cgi?menu=online>線上人數: <font color=#FF0000>$people</font></a>　<img src=$imagurl/101.gif>找到相關文章: <font color=#ff0000>$size</font></span></td>
</tr>
</table>
<table width=100% cellspacing=1 bgcolor=$bgcolor>
<tr align=center>
<td width=4% background=$imagurl/tablebg.gif>　</td>
<td width=3% background=$imagurl/tablebg.gif>　</td>
<td width=38% background=$imagurl/tablebg.gif>文章標題</td>
<td width=7% background=$imagurl/tablebg.gif>新窗口</td>
<td width=8% background=$imagurl/tablebg.gif>作者</td>
<td width=7% background=$imagurl/tablebg.gif>字[回]</td>
<td width=8% background=$imagurl/tablebg.gif>最後回覆</td>
<td width=19% background=$imagurl/tablebg.gif>最後更新時間</td>
<td width=6% background=$imagurl/tablebg.gif>參訪</td>
</tr>
</table>
EOF
for ($i=$page; $i<$page+20; $i++){
$hastitle=@hastitles[$i];
$hastitle=~ s/\n//g;
if($hastitle ne ""){
($rtitles,$rthistime,$rusername,$rcomment,$rfrom,$rhasreply,$emote,$lastname,$rlasttime,$re,$rhassee,$jing,$lock)=split(/\t/,$hastitle);
if (length($rtitles) > 40) {$rtitles = substr($rtitles,0,40);$rtitles.="...";} 
if($rhasreply<15){$hot="closed.gif";}
if($rhasreply>=15){$hot="hot.gif";}
if($rhasreply<=0){$hot="closedb.gif";}
if ($lock eq "1"){$hot="lock.gif";}
($oldday)=split(/\./,$rlasttime);
$new="";
if(($rhassee<=10)&&($oldday eq $lasttime)){$new="new.gif";}
if ($rusername eq $username){$my="my.gif";}else{$my="";}
if ($jing eq "1"){$my="jh.gif";}
print <<EOF;
<table width=100% cellspacing=1 bgcolor=$bgcolor>
<tr align="center">
<td width=4% bgcolor=$bgcolor2>
<img src=$imagurl/$hot>
</td>
EOF
if ($my ne ""){
print <<EOF;
<td bgcolor=$bgcolor1 width=3%><img src=$imagurl/$my></td>
EOF
}else{
print <<EOF;
<td bgcolor=$bgcolor1 width=3%>　</td>
EOF
}
print <<EOF;
<td bgcolor=$bgcolor2 align=left width=38%><img src="$imagurl/$emote.gif"> <a href="$cgiurl?menu=show&slttitle=$rthistime&id=$id">$rtitles</a>
EOF
if(($new ne "")){
print "<img src=$imagurl/$new>";
}
if($rhasreply eq 0){$rhasreply=length($rcomment);}else{$rhasreply="<font color=#FF0000>[$rhasreply]</font>";}
print <<EOF;
</td>
<td bgcolor=$bgcolor1 width=7%><a href="JavaScript:New('$cgiurl?menu=show&slttitle=$rthistime&id=$id')"><img border=0 src="$imagurl/newwin.gif"></a></td>
<td bgcolor=$bgcolor2 width=8%><a href="yhreg.cgi?menu=viewuser&username=$rusername" target=_blank>$rusername</a></td>
<td bgcolor=$bgcolor1 width=7%>$rhasreply</td>
<td bgcolor=$bgcolor2 width=8%><a href="yhreg.cgi?menu=viewuser&username=$lastname" target=_blank>$lastname</a></td>
<td bgcolor=$bgcolor1 width=19%><a href=$cgiurl?menu=show&slttitle=$rthistime&id=$id#$rlasttime><img src=$imagurl/lastpost.gif border=0 alt=到最後發表的文章上></a> $rlasttime</td>
<td bgcolor=$bgcolor2 width=6%>$rhassee</td>
</tr>
</table>
EOF
}
}
print <<EOF;
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align=left valign=baseline>所有時間為 台北中正機場時間. 格式: 年-月-日.</td>
<td align="right">
EOF
if($syy>-1){
print "<a href=$cgiurl?menu=findtitle&id=$id&search=$search&page=$syy><img src=$imagurl/sbutton-backpage.gif  border=0></a>";
}else{
print "<img src=$imagurl/sbutton-backpage.gif>";
}
if(($size>20)&&($i<$size)){
print "<a href=$cgiurl?menu=findtitle&id=$id&search=$search&page=$i><img src=$imagurl/sbutton-nextpage.gif  border=0></a>";
}else{
print "<img src=$imagurl/sbutton-nextpage.gif  border=0>";
}
if(($outurl ne "")&&($outurl ne "http://")){
print "<a href=$outurl><img src=$imagurl/sbutton-back.gif  border=0></a>";
}else{
print "<a href=javascript:history.back(1)><img src=$imagurl/sbutton-back.gif  border=0></a>";
}
print <<EOF;
</td>
</tr>
</table>
<table border="0" width="100%">
<tr valign="top">
<td width="100%" valign="middle" align="center">
<table width="350" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#008000" bordercolordark="#FFFFFF">
<tr bgcolor="#CFE3FE">
<form method="post" action="$cgirul">
<td background=$imagurl/tablebg.gif width="100%" align="center" colspan="2"> <input type="hidden" name="menu" value="findtitle"><font color=white>輸入您要搜尋的字符  </font><input type="hidden" name="id" size="28" value="$id"><input type="hidden" name="userpsd" value="$userpsd"><input type="hidden" name="username" value="$username"><input type="text" name="search" size="20" value=""> <input name="submit" type="submit" style="background-image: url('$imagurl/tablebg.gif'); border: 0px" value=" 搜 尋 ">
</td>
</form>
</tr>
<tr bgcolor="#CFE3FE">
<form method="post" action="$cgiurl">
<td background=$imagurl/tablebg.gif width="100%" align="center" colspan="2"> <input type="hidden" name="menu" value="win"><font color=white>您的姓名 </font><input type="text" name="username" size="9" value=""><font color=white> 您的密碼 </font><input type="password" name="userpsd" size="9" value=""><input type="hidden" name="id" size="28" value="$id" maxlength="46"> <input name="submit" type="submit" style="background-image: url('$imagurl/tablebg.gif') ; border: 0px" value=" 登 陸 ">
</td>
</form>
</tr>
</table>
</td>
</tr>
</table><br>
<center>$htmlw
<hr noShade SIZE=1 width=450>
<div align=center>
<table border=0 cellSpacing=4 width=545>
<tbody>
<tr align=middle>
<td width=533>討論區純屬發表者個人意見，與飛喵喵立場無關</td>
</tr>
<tr align=middle>
<td width=533>免費交流區服務由飛喵喵空服網提供：<b></td>
</tr>
</tbody>
</table>
</html>
EOF
exit;
}
######################### END OF SCRIPT #########################
