boardread.pl
#!/usr/local/bin/perl
# ปรับปรุง 28 กรกฎาคม 2545
# Version สำหรับ lovelampang.com และเปิดให้คนลำปางนำไปใช้ได้
############################################################
# เพื่อนำ 10 กะทู้ล่าสุดไปแสดง
# <iframe src=http://www.thaiall.com/lovelampang/board/board10.pl height="205" width="500" marginwidth="0" marginheight="0" vspace="0" hspace="0" frameborder="0"></iframe>
# เพิ่มข่าว หรือแสดงความเห็น
# <a href=http://www.lovelampang.com/board>http://www.lovelampang.com/board</a>
############################################################
require 'parse.pl';
&parse_form;
$fnx = "$v{'r'}/.";
print "Content-type:text/html\n\n";
&headers;
if (!$v{'id'}) { &breakerror('ข้อมูลผิดพลาด โปรดกลับไปตรวจสอบ'); }
$filename = join '',$v{'id'},'.txt';
open(myfile,"$v{'r'}/$filename");
@r = <myfile>;
close(myfile);
$r[0] =~ s/</</g;
$r[0] =~ s/>/>/g;
@rec = split (/:/,$r[0]);
print "<table width=100% border=0 cellpadding=0 cellspacing=0><td bgcolor=#dddddd>";
print "<font size=4>$rec[1]</font><div align=right>";
print "โดย: $rec[2] ($rec[5])";
if ($rec[4] eq "on") { print " [ans]"; }
@stat = stat "$v{'r'}/$filename";
@t = localtime($stat[9]+50000);
print " $stat[7] Byte<br>สร้าง: $t[3]/",$t[4]+1,"/",$t[5]+2443;
print " เวลา: $t[2]:$t[1]:$t[2]";
if ($rec[3] > "0") { print "<img src=http://online.mirabilis.com/scripts/online.dll?icq=$rec[3]&img=5>"; }
print "</div></td></table><br>";
$tot = @r;
print "<center><table width=95% cellpadding=1 cellspacing=1 border=0 bgcolor=black><td bgcolor=white><br>";
for $i (1..$tot-1) { print $r[$i],"<br>"; }
print "</td></table></center>";
opendir(flist,"$fnx");
@allf = readdir flist;
closedir(flist);
@allf = reverse sort @allf;
foreach $r (@allf) {
if (length($r) eq "17" && substr($filename,0,10) eq substr($r,0,10)) {
push @ar,$r;
}
}
$tot = @ar - 1;
print'<ul><b>กะทู้ที่เกี่ยวกับหัวเรื่อง:</b><br>';
for $i (0..$tot) {
open(myfile,"$v{'r'}/$ar[$i]");
@ra = <myfile>;
close(myfile);
$ra[0] =~ s/</</g;
$ra[0] =~ s/>/>/g;
@rec = split (/:/,$ra[0]);
if (substr($ar[$i],10,3) eq "999") { print "<img src=f.gif> "; }
else { print "<img src=l.gif> "; }
if ($rec[0] eq $v{'id'}) {
print "$rec[1] $rec[2]";
} else {
print "<a href=boardread.pl?id=$rec[0]&r=$v{'r'}>$rec[1]</a> ";
print "<font color=blue>$rec[2]</font>";
}
print "<br>";
}
print'</ul><center>';
print "<table width=95% bgcolor=#000000 cellpadding=1 cellspacing=1 border=0>";
print "<form action=boardreply.pl method=post><td bgcolor=#ddffdd><b>ตอบกะทู้นี้</b><br>";
print "<input type=hidden name=idstart value=$rec[0]>\n";
print "<input type=hidden name=r value=$v{'r'}>\n";
print "หัวเรื่อง <input name=subj size=60 maxlength=80><br>Your E-Mail <input name=email size=20 maxlength=40>";
print 'ICQ <input name=icq size=10 maxlength=10> <input type=submit value="Send Opinion">';
print "<textarea name=message rows=3 cols=100></textarea>";
print "</td></form></table>";
&footer;
|