#!/usr/local/bin/perl ################################################## # Copyright 1999 Thailand Miscellaneous. # #Allrights reserved. webmaster@thaimisc.com # # This Program is Free Only !!!! Don't Sale # # โปรแกรมนี้เป็นโปรแกรมแจกฟรี เพื่อนนำไปพัฒนาต่อ หรือศึกษาเท่านั้น # # หามนำไปเพื่อการค้าขาย หรือหวังผลตอบแทน หากต้องการจะทำ # # กรุณาติดต่อเรา http://www.thaimisc.com # # webmaster@thaimisc.com # # หากใครที่ จะมีความกรุณาสนับสนุนเราทางด้านการเงินและการพัฒนาเวบ # # นี้ต่อไป กรุณาติดต่อ 162-301948 หรือ choo@thaimisc.com # # ด้วยนะครับ :) เนื่องจากเรายังเป็นเยาว์ชนและยังอยู่ในวัยเรียนจึงยังต้องการ # #เงินสนับสนุนบางส่วน ขอบคุณครับ # ################################################### require "config.pl"; print "Content-type:text/html\n\n"; &FormInput(*input); $list = $input{'list'}; $page = $input{'page'}; $date_del = `date +"%D"`; chop($date_del); open( DATEFILE , "$Msg_Dir/date.dat" ); $datefile = ; close( DATEFILE ); if ($date_del ne $datefile) { unlink<$Msg_Dir/ipreply/*.dat>; unlink<$Msg_Dir/ip/*.dat>; open (addnew,">$Msg_Dir/new.html"); close(addnew); open (DATEFILE,">$Msg_Dir/date.dat"); print DATEFILE "$date_del"; close(DATEFILE); } &HTML_HEADER; open( MSGFILE ,"$Topic_Dir/topic.dat"); @msgdata = ; close( MSGFILE ); @msgdata=reverse( @msgdata ); $size = @msgdata; $numtopic = $size + 1; $sum=$size/$limitpage; #ตรวจสอบคำสั่งเลื่อนหน้า if ($size>$limitpage) { print "
แสดงกระทู้หน้าล่ะ $limitpage >> "; for($i=0; $i<$sum; $i++) { $j=$i; $j++; if ($i<1) { print "[ หน้าแรก ]"; } else { print "[ "; print "$j ]"; } } print "
"; } if ($page) { $limitpage2=$limitpage*$page; $_=$limitpage2+$limitpage; for($i=0; $i<$size; $i++){ $numtopic--; if (($i>=$limitpage2) && ($i<$_)){ print "$msgdata[$i]"; &checknum; }} } else { for($i=0; $i<$limitpage; $i++){ $numtopic--; print "$msgdata[$i]"; &checknum; } } ######################## sub checknum{ if ($numtopic< 10) {$numtopic = "0000$numtopic";} elsif ($numtopic < 100){$numtopic = "000$numtopic";} elsif ($numtopic < 1000){$numtopic = "00$numtopic";} else {$numtopic = "0$numtopic";} $FNAME = "$Topic_Dir/$numtopic.dat"; $FILE_NAME="$FNAME"; open (NUMMSG,"$FILE_NAME") ; $nummsg = ; close(NUMMSG); if ($nummsg ne ""){ print "\($nummsg\)"; open (newfile,"$Msg_Dir/new.html") ; @new1 = ; close(newfile); $new11 = "no"; foreach $new (@new1){ if ( ($numtopic == $new) && ($new11 ne "yes") ){ print " new"; $new11 = "yes"; } } #if ($new11 eq "yes") { #print " new"; #$new11 = "no"; #} } } &HTML_FOOTER; sub FormInput { local (*qs) = @_ if @_; if ($ENV{'REQUEST_METHOD'} eq "GET") { $qs = $ENV{'QUERY_STRING'}; } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN,$qs,$ENV{'CONTENT_LENGTH'}); } @qs = split(/&/,$qs); foreach $i (0 .. $#qs) { $qs[$i] =~ s/\+/ /g; $qs[$i] =~ s/%(..)/pack("c",hex($1))/ge; ($name,$value) = split(/=/,$qs[$i],2); if($qs{$name} ne "") { $qs{$name} = "$qs{$name}:$value"; } else { $qs{$name} = $value; } } }