#! /usr/bin/perl #e:/web/perl/bin/perl.exe #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++ [ Motto Kakikomitai 多功能晉級留言板 Ver0.864 ] 原程式更新於 2001.02.04 / 中文版更新於 2001.03.04 (二版) #+++ >>> Copyright (c) 1999.10 Tacky's Room. All rights reserved. #+++ 原作者: Tacky   電子郵箱 >>> tacky2@ops.dti.ne.jp 個人網站 >>> http://tackysroom.com #+++ 中文化: 驚直   電子郵箱 >>> kxxk@pacific.net.hk 個人網站 >>> http://home.pacific.net.hk/~kxxk #+++ ※由於小弟不懂日文,所以程式裡很多地方都是猜出來翻的!如果有什麼地方是誤翻的,請你寫信或在留言板告訴我吧! #+++ #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ $ver = '0.864'; #(驚直修改 - 加入程式版本編號) #─<基本設定開始>──────────────────────────────────────────────────────── 'http://netcity6.web.hinet.net/userdata/cc520/d3e/whois.htm'; #暱稱查詢網頁的位址 $url = '#here'; #連結到發表留言 $d3eall = './myimg/login.php'; #大頭照設置 $script = './mkaki.cgi'; #主程式檔名 $logfile = './mkakikomitai.txt'; #留言記錄檔名 $lockfile = './mkakikomitai.lock'; #鎖定檔檔名 $cntfile = './mkakikomitai.cnt'; #計數器記錄檔名 (不使用則改為'') $logfile2 = './mkakikomitai_cnt.txt'; #設定記錄留言者留言篇數的晉級狀態記錄檔。(使用晉級制度必須有此檔案,不使用則改為'') #要使用計數器的功能,必須設定每個計數器圖檔的語法。src=之後的是圖檔路徑。如果你知道每個圖檔的大小,最好也加入闊度(width)和高度(height)的數值。 #設定圖檔路徑時,也可以用類似src=http://www.∼/xxx.gif的語法來指定存在於主機伺服器以外其他位置的圖檔。 #如果不指定計數器圖檔,請改為'',便會使用純文字形式表示。 $cnt_gif[0] = ''; $cnt_gif[1] = ''; $cnt_gif[2] = ''; $cnt_gif[3] = ''; $cnt_gif[4] = ''; $cnt_gif[5] = ''; $cnt_gif[6] = ''; $cnt_gif[7] = ''; $cnt_gif[8] = ''; $cnt_gif[9] = ''; $cnt_keta = 0; #計數器要顯示幾多位數字? $title = '電三乙自用留言板'; #留言板的標題 $titlelogo = '  '; #留言板標題圖檔IMG語法 (不使用則改為'') $backpicture = './img/bg.gif'; #背景圖檔 $bgcolor = 'white'; #背景顏色 $tbgcolor = ''; #填寫留言表格的背景顏色 $tcolor = 'gray'; #文字顏色 $linkcolor = 'dimgray'; #連結顏色 (從未到訪) $vlinkcolor = 'dimgray'; #連結顏色 (曾經到訪) $alinkcolor = 'firebrick'; #連結顏色 (正在到訪) $hovercolor = 'red'; #連結顏色 (滑鼠經過時) #i000331 $pt = '10pt'; #整體字形大小,建議:9,10,11,12 #i000331 $pt_mini = '9pt'; #微縮字形大小,建議:8,9,10 (驚直加入 - 套用於"圖檔一覽表"連結、顏色方塊、使用者晉級資訊及留言資訊) $e_font = "Tahoma, Verdana, Arial"; #英文專屬字形集 (驚直加入) $res_gif = './img/res.gif'; #設定讓訪客「回覆留言」的圖檔。(不使用則改為'',便會以純文字形式表示) $gif_spacer = './img/spacer.gif'; #調整空位的DUMMY圖檔 $link_color ='#ff0000'; #連結字體顏色 $look ='最新功能:按下面的大頭照設置可以設定只有在用你的暱稱留言時才會出現的專屬大頭照'; #跑馬燈顯示公告 $name_color = 'white'; #每篇留言之中,留言者名字等資訊的顏色 $msg_color = 'white'; #每篇留言之中,留言內容的背景顏色 $name_size ='4'; #標題姓名字體大小 $titleset = 1; #每篇留言都要有標題嗎?(0:不要 1:要) $homelinklogo = 'img/homepage.gif'; #留言者個人網站連結圖檔IMG語法 (不使用則改為'') $maillinklogo = 'img/email.gif border=0'; #留言者電子郵箱連結圖檔IMG語法 (不使用則改為'') $top_l = ''; #造成留言框圓角效果的圖檔IMG語法 (左上角) (不使用則改為'') $top_r = ''; #造成留言框圓角效果的圖檔IMG語法 (右上角) (不使用則改為'') $bottom_l = ''; #造成留言框圓角效果的圖檔IMG語法 (左下角) (不使用則改為'') $bottom_r = ''; #造成留言框圓角效果的圖檔IMG語法 (右下角) (不使用則改為'') $datamax = 90 ; #最新的留言集,保留的留言篇數 (只要留言達到這個數目,最原先的留言便會存入舊留言集) $pagemax = 5 ; #1頁可顯示之留言篇數 $password = 'dp4e4eji'; #管理者密碼 $tag = 'yes'; #允許使用HTML碼?(yes,no) $resflag = 'yes'; #最新回覆的留言搬到最頂?(yes,no) $hostflag = 'yes'; #顯示留言者的HOST位址?(yes,no) $row = 5; #輸入留言內容方塊的列數(高度) $col = 57; #輸入留言內容方塊的欄數(闊度) $t_width = 658; #每篇留言的闊度(以像素計) #設定留言可用之背景顏色.原作者的設定:@COLORS_B = ('#666666','#003399','#990000','#669900','#cc3399','#ff6633','#cccc00'); @COLORS_B = ('img/usebg01.gif','img/usebg02.gif','img/usebg03.gif','img/usebg04.gif','img/usebg05.gif','img/usebg06.gif','img/usebg07.gif'); #(驚直修改 - 使用文字顏色碼並加入更多顏色) $colb_use = 0; #(0:顏色由留言者選擇 1:顏色由管理者指定) $colb = 'silver' ; #如果上面的值是'1',全部留言都使用這個指定的背景顏色 #設定留言可用之文字顏色.原作者的設定:@COLORS_F = ('#666666','#003399','#990000','#669900','#cc3399','#ff6633','#cccc00','#000000'); @COLORS_F = ('#0000ff','#00cc00','#cc0000','#669900','#cc3399','#ff6633','#cccc00','#666666','#000000'); #(驚直修改 - 使用文字顏色碼並加入更多顏色) $colf_use = 0; #(0:顏色由留言者選擇 1:顏色由管理者指定) $colf = 'black' ; #如果上面的值是'1',全部留言都使用這個指定的文字顏色 #留言表格的各個欄目(名字、電子郵箱、個人網站、標題等)可以使用一套圖檔顯示出來 $gif_flg = 0; #想要使用留言表格欄目圖檔嗎?(0:不使用 1:使用) #設定留言表格的各個欄目圖檔 $gif_name = './img/kakikomitai_name.gif'; #(名字) $gif_email = './img/kakikomitai_email.gif'; #(電子郵箱) $gif_home = './img/kakikomitai_homepage.gif'; #(個人網站) $gif_title = './img/kakikomitai_title.gif'; #(標題) $gif_message = './img/kakikomitai_message.gif'; #(留言內容) $icon_use = 'yes'; #留言內容使用圖檔嗎?(yes,no) #↓設定管理者專用圖檔。除了管理者以外,沒有其他人可以使用這個圖檔。 #你可以在$oiconpass為這個屬於你的專用圖檔設定一個密碼,留言內容掃出來的時候驗證密碼&名字如果跟記錄所載相同才會顯示出來,否則會使用一般圖檔。 #醬子就算有人要冒充你來寫留言,也必須知道你的專用圖檔密碼才能夠成功盜用你的身份。(不使用則改為$oiconpass = '';) $oicon_gif = './icon/d_ahiru.gif' ; $oiconpass = 'opass'; $oicon_gif_w = 32 ; $oicon_gif_h = 32 ; #↓設定常連者專用圖檔。你可以為你的朋友或經常上來寫留言的網友(常連者)增加其他圖檔如$jicon_gif[2]...[5]等,餘此類推。 #留言內容掃出來的時候,會驗證留言者的名字是否跟這裡所設定的$jiconnm一樣,如是者便會出現對應的個人圖檔,不受自行選擇之圖檔影響。 #$jicon_gif[1] = './icon/ele041.gif' ; $jiconnm[1] = 'cc' ; $jicon_gif_w[1] = 70 ; $jicon_gif_h[1] = 61; #$jicon_gif[2] = './icon/ele044.gif' ; $jiconnm[2] = '張佑赫' ; $jicon_gif_w[2] = 58 ; $jicon_gif_h[2] = 84 ; #$jicon_gif[3] = './icon/ele023.gif' ; $jiconnm[3] = '〝~♥~〞暗夜銀蝠〝~♥~〞' ; $jicon_gif_w[3] = 55 ; $jicon_gif_h[3] = 78 ; #$jicon_gif[4] = './icon/ele036.gif' ; $jiconnm[4] = '老而不死是謂賊' ; $jicon_gif_w[4] = 50 ; $jicon_gif_h[4] = 100 ; #$jicon_gif[5] = './icon/ele038.gif' ; $jiconnm[5] = 'SUPER MAN' ; $jicon_gif_w[5] = 65 ; $jicon_gif_h[5] = 65 ; #$jicon_gif[6] = './icon/ele022.gif' ; $jiconnm[6] = '黑輪大ㄟ' ; $jicon_gif_w[6] = 63 ; $jicon_gif_h[6] = 75 ; #$jicon_gif[7] = './icon/ele019.gif' ; $jiconnm[7] = '久利生公平' ; $jicon_gif_w[7] = 57 ; $jicon_gif_h[7] = 93 ; #$jicon_gif[8] = './icon/ele010.gif' ; $jiconnm[8] = '孰能無過' ; $jicon_gif_w[8] = 59 ; $jicon_gif_h[8] = 100 ; #$jicon_gif[9] = './icon/ele026.gif' ; $jiconnm[9] = '最愛小電影' ; $jicon_gif_w[9] = 100 ; $jicon_gif_h[9] = 56 ; open(IN,"./myimg/reg.txt"); @LOG = ; close(IN); $Icnt=0; foreach ( @LOG ) { ($Iuser,$Ipswd,$F) = split(/∥/,$_); open(IN2,"./myimg/upload/$F/list.txt"); @LOG2 = ; close(IN2); foreach ( @LOG2 ) { ($no,$img,$file,$cnt) = split(/∥/,$_); # if ($cnt < 20) # { # $jicon_style[$Icnt] = "filter:gray" ; # } if ($img ne '' && $F ne '') { $jicon_gif[$Icnt] = "./myimg/upload/$F/$img" ; if ($no eq 0) { $jiconnm[$Icnt] = "$Iuser" ; }else{ $jiconnm[$Icnt] = "$Iuser~$no" ; } $Icnt++; } } } #↓設定留言者一般可選擇之圖檔。可以依個人需要增加其他圖檔如$icon_gif[11]...[20]等,餘此類推。 $icon_gif[0] = './icon/h_ball.gif' ; $iconnm[0] = '可愛-皮球' ; $icon_gif_w[0] = 32 ;$icon_gif_h[0] = 32 ; $icon_gif[1] = './icon/h_corgi.gif' ; $iconnm[1] = '可愛-狐狸' ; $icon_gif_w[1] = 32 ;$icon_gif_h[1] = 32 ; $icon_gif[2] = './icon/h_cow.gif' ; $iconnm[2] = '可愛-乳牛' ; $icon_gif_w[2] = 32 ;$icon_gif_h[2] = 32 ; $icon_gif[3] = './icon/h_denchi.gif' ; $iconnm[3] = '可愛-電池' ; $icon_gif_w[3] = 32 ;$icon_gif_h[3] = 32 ; $icon_gif[4] = './icon/h_dorayaki.gif' ; $iconnm[4] = '可愛-燒餅' ; $icon_gif_w[4] = 32 ;$icon_gif_h[4] = 32 ; $icon_gif[5] = './icon/h_duck.gif' ; $iconnm[5] = '可愛-鴨子' ; $icon_gif_w[5] = 32 ; $icon_gif_h[5] = 32 ; $icon_gif[6] = './icon/h_bambi.gif' ; $iconnm[6] = '可愛-松鼠' ; $icon_gif_w[6] = 32 ; $icon_gif_h[6] = 32 ; $icon_gif[7] = './icon/h_bear.gif' ; $iconnm[7] = '可愛-米熊' ; $icon_gif_w[7] = 32 ; $icon_gif_h[7] = 32 ; $icon_gif[8] = './icon/h_kaeru.gif' ; $iconnm[8] = '可愛-青蛙' ; $icon_gif_w[8] = 32 ; $icon_gif_h[8] = 32 ; $icon_gif[9] = './icon/h_momo.gif' ; $iconnm[9] = '可愛-momo' ; $icon_gif_w[9] = 32 ; $icon_gif_h[9] = 32 ; $icon_gif[10] = './icon/h_saru.gif' ; $iconnm[10] = '可愛-猴子' ; $icon_gif_w[10] = 32 ; $icon_gif_h[10] = 32 ; $icon_gif[11] = './icon/h_monkey1.gif' ; $iconnm[11] = '可愛-猴子2' ; $icon_gif_w[11] = 32 ; $icon_gif_h[11] = 32 ; $icon_gif[12] = './icon/h_ahiru.gif' ; $iconnm[12] = '可愛-小雞' ; $icon_gif_w[12] = 32 ; $icon_gif_h[12] = 32 ; $icon_gif[13] = './icon/h_usagi.gif' ; $iconnm[13] = '可愛-兔子' ; $icon_gif_w[13] = 32 ; $icon_gif_h[13] = 32 ; $icon_gif[14] = './icon/h_kappa.gif' ; $iconnm[14] = '可愛-河童' ; $icon_gif_w[14] = 32 ; $icon_gif_h[14] = 32 ; $icon_gif[15] = './icon/h_mail.gif' ; $iconnm[15] = '可愛-信箱' ; $icon_gif_w[15] = 32 ; $icon_gif_h[15] = 32 ; $icon_gif[16] = './icon/h_nachan.gif' ; $iconnm[16] = '可愛-汽水' ; $icon_gif_w[16] = 32 ; $icon_gif_h[16] = 32 ; $icon_gif[17] = './icon/h_oyaji.gif' ; $iconnm[17] = '可愛-阿婆' ; $icon_gif_w[17] = 32 ; $icon_gif_h[17] = 32 ; $icon_gif[18] = './icon/h_panda.gif' ; $iconnm[18] = '可愛-熊貓' ; $icon_gif_w[18] = 32 ; $icon_gif_h[18] = 32 ; $icon_gif[19] = './icon/h_risu.gif' ; $iconnm[19] = '可愛-田鼠' ; $icon_gif_w[19] = 32 ; $icon_gif_h[19] = 32 ; $icon_gif[20] = './icon/h_poch.gif' ; $iconnm[20] = '可愛-小狗' ; $icon_gif_w[20] = 32 ; $icon_gif_h[20] = 32 ; $icon_gif[21] = './icon/h_usa2.gif' ; $iconnm[21] = '可愛-小狗2' ; $icon_gif_w[21] = 32 ; $icon_gif_h[21] = 32 ; $icon_gif[22] = './icon/h_ebi.gif' ; $iconnm[22] = '可愛-海老' ; $icon_gif_w[22] = 32 ; $icon_gif_h[22] = 32 ; $icon_gif[23] = './icon/h_tamago.gif' ; $iconnm[23] = '可愛-玉子' ; $icon_gif_w[23] = 32 ; $icon_gif_h[23] = 32 ; $icon_gif[24] = './icon/h_takoyaki.gif' ; $iconnm[24] = '可愛-串燒' ; $icon_gif_w[24] = 32 ; $icon_gif_h[24] = 32 ; $icon_gif[25] = './icon/h_tulip.gif' ; $iconnm[25] = '可愛-花朵' ; $icon_gif_w[25] = 32 ; $icon_gif_h[25] = 32 ; $icon_gif[26] = './icon/h_volley.gif' ; $iconnm[26] = '可愛-排球' ; $icon_gif_w[26] = 32 ; $icon_gif_h[26] = 32 ; $icon_gif[27] = './icon/no.gif' ; $iconnm[27] = '可愛-暫缺' ; $icon_gif_w[27] = 32 ; $icon_gif_h[27] = 32 ; $icon_gif[28] = './icon/q-bear.gif' ; $iconnm[28] = '動畫-小熊' ; $icon_gif_w[28] = 32 ; $icon_gif_h[28] = 32 ; $icon_gif[29] = './icon/q-cat.gif' ; $iconnm[29] = '動畫-小貓' ; $icon_gif_w[29] = 32 ; $icon_gif_h[29] = 32 ; $icon_gif[30] = './icon/q-dog.gif' ; $iconnm[30] = '動畫-小狗' ; $icon_gif_w[30] = 32 ; $icon_gif_h[30] = 32 ; $icon_gif[31] = './icon/q-master.gif' ; $iconnm[31] = '動畫-娃娃' ; $icon_gif_w[31] = 32 ; $icon_gif_h[31] = 32 ; $icon_gif[32] = './icon/q-orange.gif' ; $iconnm[32] = '動畫-包子' ; $icon_gif_w[32] = 32 ; $icon_gif_h[32] = 32 ; $icon_gif[33] = './icon/q-penguin.gif' ; $iconnm[33] = '動畫-企鵝' ; $icon_gif_w[33] = 32 ; $icon_gif_h[33] = 32 ; $icon_gif[34] = './icon/q-rabbit.gif' ; $iconnm[34] = '動畫-兔子' ; $icon_gif_w[34] = 32 ; $icon_gif_h[34] = 32 ; $icon_gif[35] = './icon/q-robot.gif' ; $iconnm[35] = '動畫-機器人' ; $icon_gif_w[35] = 32 ; $icon_gif_h[35] = 32 ; $icon_gif[36] = './icon/b01.gif' ; $iconnm[36] = '表情-高興' ; $icon_gif_w[36] = 44 ; $icon_gif_h[36] = 44 ; $icon_gif[37] = './icon/b02.gif' ; $iconnm[37] = '表情-尷尬' ; $icon_gif_w[37] = 44 ; $icon_gif_h[37] = 44 ; $icon_gif[38] = './icon/b03.gif' ; $iconnm[38] = '表情-難過' ; $icon_gif_w[38] = 44 ; $icon_gif_h[38] = 44 ; $icon_gif[39] = './icon/b04.gif' ; $iconnm[39] = '表情-喜歡' ; $icon_gif_w[39] = 44 ; $icon_gif_h[39] = 44 ; $icon_gif[40] = './icon/b05.gif' ; $iconnm[40] = '表情-不懂' ; $icon_gif_w[40] = 44 ; $icon_gif_h[40] = 44 ; $icon_gif[41] = './icon/b06.gif' ; $iconnm[41] = '表情-驚訝' ; $icon_gif_w[41] = 44 ; $icon_gif_h[41] = 44 ; $icon_gif[42] = './icon/b07.gif' ; $iconnm[42] = '表情-超愛' ; $icon_gif_w[42] = 44 ; $icon_gif_h[42] = 44 ; $icon_gif[43] = './icon/b08.gif' ; $iconnm[43] = '表情-生氣' ; $icon_gif_w[43] = 44 ; $icon_gif_h[43] = 44 ; $icon_gif[44] = './icon/b09.gif' ; $iconnm[44] = '表情-想睡' ; $icon_gif_w[44] = 44 ; $icon_gif_h[44] = 44 ; $icon_gif[45] = './icon/b10.gif' ; $iconnm[45] = '表情-普通' ; $icon_gif_w[45] = 44 ; $icon_gif_h[45] = 44 ; $icon_line = 4 ; #顯示圖檔一覽表時,每行顯示幾多個圖檔? $method = 'POST'; #METHOD方式(POST或GET) #設定有問題的網域清單。只要符合這清單的網域都會被攔截(禁止寫入留言)。 # 設定 "xxx?.com" 即包括了 "xxx1.com","xxx2.com" 等,「?」可以是任何1個字元。 # 設定 "xxx*.com" 即包括了 "xxx1.com","xxx12345.com" 等,「*」可以是0個或以上的任何字元。 @DANGER_LIST=("xxx.com","yyy.com","zzz*.org.tw"); #設定留言內容的最高字數(以字元計算)。如果不設定最高字數,改為''即可。這個數值不能夠設得太大,最好是5000或以下,否則可能會出現錯誤信息。 $maxword = '4000'; #2000個字元即代表1000個中文字。 #設定晉級制度的每個類別。 @rank = ('等級1俠客','等級2騎士','等級3聖騎士', '等級4精靈','等級5精靈王','等級6風雲使者','等級7光明使者', '等級8天使','等級9大天使','等級10精靈使','等級11法師', '等級12大法師','等級13法王','等級14法老','等級15戰神', '等級16天神','等級17天王','等級18終極天王','等級19究級天王'); #設定每個類別的晉級資格,數目為留言篇數。 @rankno = ('0','5','10','15','20','25','30','40','50','60','70','80','100','150','200','250','300','400','500'); #你想要根據各人的晉級狀態來指定圖檔嗎?如果你使用這個模式,留言者在留言時毋須選擇圖檔。 #此外,圖檔的數目須與晉級制度的級數互相對應。(註:除管理者專用圖檔外,其餘常連者專用圖檔會失效) #例: # $icon_gif[0] = 'xx1.gif'; $iconnm[0] = '第一級'; # $icon_gif[1] = 'xx2.gif'; $iconnm[1] = '第二級'; # $icon_gif[2] = 'xx3.gif'; $iconnm[2] = '第三級'; # @rank = ('第一級','第二級','第三級'); # @rankno = ('0','10','100'); ※設定3個晉級類別,便要設定3個圖檔,而每個圖檔分別代表這3個類別。 $icon_rank = 0; #0:不要根據晉級狀態指定圖檔(留言時自行選擇圖檔) 1:根據晉級狀態指定圖檔 #設定sendmail程式的路徑。此項資料可向網路管理者查詢。(一般是/usr/sbin/sendmail或/usr/lib/sendmail) #如果你想要在有新留言的時候把留言資料寄到你的電子郵箱,便要設定,否則可保留為$sendmail = ""; $sendmail = ""; #設定寄發郵件通知時,要收件的電子郵箱。「@」之前的一個「\」符號是必須加上的。如果沒有了「\」這符號,會出現Internal Server Error錯誤訊息。 #(使用sendmail程式送信才需要設定) $smail_address = "xxx\@xxx.com.tw"; $sendsw = 1; #當使用寄發郵件通知功能時,連你自己寫入的留言記錄(以上面的郵箱作對照)也要利用郵件通知嗎?(0:忽略 1:全部都要通知) $hiho = 0; #設為「1」即可使用「hi-ho」形式傳送郵件。某些伺服器不支援。 ※使用sendmail程式送信才需要設定 #留言密碼的加密程序(使用crypt函數將密碼暗號化) $ango = 1; #0: 不使用 1:使用 (建議使用) #舊留言集的設定…指定一個資料夾($olddir)存放"01.txt".."10.txt"等等的舊留言記錄檔。 $olddir = './old/'; #保存舊留言集的資料夾所在。(不使用則改為'') $oldmax = 100; #每個舊留言集可容納之留言串列數。每當超過這個串列數後,會建立另一個舊留言集。 #你想要使用像『nyaponika學習帳』留言板的「橫線隔行」功能嗎? $nya = 0 ; #留言內容的換行符號(
)要用橫線(
)取代嗎?(0:否 1:是) $maru = 1 ; #留言框要使用圓角嗎?(0:否 1:是)…如果「否」,則可以不要$top_l,r,$bottom_l,r這些圖檔。 #============================================================================================================================================================================================= #設定CSS樣式表 ※如果不使用,請改為 $css_style = ""; 有需要的話,可以輸入2行或以上的文字(只要設定在兩個EOM標記之間就可以)。 $css_style = <<"EOM"; #(一般輸入欄位的樣式表設定,套用於表單中的textarea及input type=text,password) style="font-size:$pt; font-family:'新細明體','PMingLiU'; color:dimgray; background-color:white; border-width:1px; border-style:solid; border-color:lightgrey;" onFocus="this.style.backgroundColor='ivory'" onBlur="this.style.backgroundColor='white'" EOM $css_style_e = <<"EOM"; #(驚直加入 - 英數文字輸入欄位的樣式表設定,套用於表單中的[電子郵箱/個人網站/留言編號]欄位) style="font-size:$pt; font-family:$e_font; color:dimgray; background-color:white; border-width:1px; border-style:solid; border-color:lightgrey;" onFocus="this.style.backgroundColor='ivory'" onBlur="this.style.backgroundColor='white'" EOM $css_button = <<"EOM"; #(驚直加入 - 按鈕專用的樣式表設定,套用於表單中的input type=submit,reset,button) style="font-size:$pt; font-family:'新細明體','PMingLiU'; line-height:12pt; color:gray; background-color:white; border-width:1px; border-style:solid; border-color:lightgrey;" onMouseOver="this.style.color='dimgray';this.style.backgroundColor='ivory'" onMouseOut="this.style.color='gray';this.style.backgroundColor='white'" EOM $css_select = <<"EOM"; #(驚直加入 - 下拉選單專用的樣式表設定,套用於表單中的select) style="font-size:$pt; font-family:'新細明體','PMingLiU'; color:gray; background-color:white;" onFocus="this.style.backgroundColor='ivory'" onBlur="this.style.backgroundColor='white'" EOM $css_style_ = <<"EOM"; #(驚直加入 - 針對非IE瀏覽器的一般輸入欄位的樣式表設定) style="font-size:$pt; font-family:'新細明體','PMingLiU'; color:dimgray; background-color:white; padding-left:2px;" onFocus="this.style.backgroundColor='ivory'" onBlur="this.style.backgroundColor='white'" EOM $css_style_e_ = <<"EOM"; #(驚直加入 - 針對非IE瀏覽器的英數文字輸入欄位的樣式表設定) style="font-size:$pt; font-family:$e_font; color:dimgray; background-color:white; padding-left:2px;" onFocus="this.style.backgroundColor='ivory'" onBlur="this.style.backgroundColor='white'" EOM $css_button_ = <<"EOM"; #(驚直加入 - 針對非IE瀏覽器的按鈕專用的樣式表設定) style="font-size:9pt; font-family:'新細明體','PMingLiU'; color:gray; background-color:white;" onMouseOver="this.style.color='dimgray';this.style.backgroundColor='ivory'" onMouseOut="this.style.color='gray';this.style.backgroundColor='white'" EOM #■↓以下這個功能目的是要惡作劇留言者,使用隨機數目回扣留言者的留言篇數,如果不想使用請設為「$rdm = 0;」。 $rdm = 0; #數值範圍是0∼30,隨機變化。 @DOWN = (1,2,3,5,7,10); #隨機回扣留言篇數的數目,建議數值在15以下。 $kaisu_disp = 1; #留言內容顯示留言者的最新留言篇數?(0:否 1:是) $ikkiflg = 0 ; #你想要使用「一氣回覆模式」嗎?(0:否 1:是) #當留言板轉換到「一氣回覆模式」的時候,在留言輸入表單與留言內容之間會出現以下文字,提醒使用者要注意的事情。 $ikkimsg = <<"EOM";
■現在你進入了「一氣回覆模式」,你可以同時回覆多篇留言。只要在想要回覆的留言串列下面的留言框,把對應的留言分別填寫好,然後再按上面表單的「一氣回覆」按鈕即可。(注意:你只可以選擇一個圖檔。)如果你按下「關閉一氣回覆」,即可回到正常模式,所有留言串列下面的留言框隨即消失。
EOM #檢查留言內容的危險語法標籤 @errtag = ('table','meta','form','!--','embed','html','body','tr','td','th','a'); #危險語法標籤 #─<基本設定結束>──────────────────────────────────────────────────────── ############################################################################### #### Main Process START ##################################################### ############################################################################### $agent = $ENV{'HTTP_USER_AGENT'}; $agent =~ s/,/./g; $col2 = 1; $col2e = 1; #(驚直加入 - 調整英數欄位在Netscape瀏覽器的闊度) if ($agent =~ /Mozilla/i && $agent !~ /compatible/i && $agent !~ /Opera/i) { $col2 = 0.8; $col2e = 0.6; } #(驚直修改 - 不套用於Opera瀏覽器) $ENV{'TZ'} = "CST-8"; #(驚直修改 - 使用中國及台灣地區時間) ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); #取得系統時間 $year = sprintf("%02d",$year + 1900); $month = $mon + 1; #(驚直修改 - 月日不前置0或空白) $hour = sprintf("%02d",$hour); $min = sprintf("%02d",$min); $week = ('星期日','星期一','星期二','星期三','星期四','星期五','星期六') [$wday]; $today = "$year年$month月$mday日($week) $hour:$min"; #(驚直修改 - 加入年份顯示) if ($agent !~ /MSIE/i || $agent =~ /Opera/i) { #(驚直修改 - 非IE瀏覽器使用特別樣式表) $css_style = $css_style_; $css_style_e = $css_style_e_; $css_button = $css_button_; } &logchk ; &cookieget; #取得COOKIE資訊 &decode ; #過濾留言內容 if ( $FORM{'action'} eq 'icondisp' ) { &icondisp ; } #顯示圖檔一覽表 if ( $FORM{'action'} eq 'maintenance' ) { #進入管理模式 &Maintenance; &dataread ; #讀取記錄檔 } if ( $FORM{'action'} eq 'update' ) { #更新記錄檔(編輯時) &update ; &cookieget; #取得COOKIE資訊 &dataread ; #讀取記錄檔 } if ( $FORM{'action'} eq 'regist' ) { #寫入留言記錄 ®ist ; &cookieget; #取得COOKIE資訊 &dataread ; #讀取記錄檔 &logchk ; $FORM{'action'} = "" ; } if ( $FORM{'action'} eq 'info' ) { &info ; } #顯示晉級資格說明 if ( $FORM{'action'} eq 'download' ) { &dataread ; &download ; } #下載留言記錄 #i001112 if ( $FORM{'action'} eq 'rankdisp' ) { &rankdisp ; } #顯示各人晉級狀態 &dataread ; #讀取記錄檔 &header ; #顯示HTML頁首 &header2 ; ($name,$use) = split(/~/,$FORM{'name'}); #tabcc if ($use eq '0'){$use='';} open(IN,"./myimg/reg.txt"); @LOG = ; close(IN); $F=''; foreach ( @LOG ) { ($Iuser,$Ipswd,$If) = split(/∥/,$_); if ($Iuser eq $name) { $F=$If; } } if ($F ne '') { print ""; } &view ; #顯示留言記錄 &forminput if ( $FORM{'action'} ne 'oldlogfind' || $FORM{'oldlogno'} == 0 ) ; #輸入留言內容 &footer ; #顯示HTML頁尾 exit; ############################################################################### #### Main Process END ####################################################### ############################################################################### ###<-------------------------------------------------------------- ###<--- 過濾留言內容&代入變數 ###<-------------------------------------------------------------- sub decode{ 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; if ($tag eq 'yes') { #禁止使用危險語法!!! foreach ( @errtag ) { if ($value =~ /<$_(.|\n)*/i) { &error("抱歉,留言板禁止使用危險語法!"); } #(驚直修改 - 針對"\n"; print "\n"; #<<表情符號結束>> print "表情符號:\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "微笑的臉\n"; print "開懷大笑的臉\n"; print "眨眼的笑臉\n"; print "驚訝的臉\n"; print "吐舌頭的臉\n"; print "熱情的笑臉\n"; print "生氣的臉\n"; print "尷尬的臉\n"; print "疑惑的臉\n"; print "悲傷的臉\n"; print "哭泣的臉\n"; print "目瞪口呆的臉\n"; print "天使\n"; print "魔鬼\n"; print "紅心\n"; print "破碎的心\n"; print "MSN線上交談\n"; print "貓臉\n"; print "狗臉\n"; print "
\n"; print "彎月\n"; print "星星\n"; print "影片膠捲\n"; print "八分音符\n"; print "紅玫瑰\n"; print "枯萎的玫瑰\n"; print "紅唇\n"; print "綁蝴蝶結的禮物\n"; print "生日蛋糕\n"; print "相機\n"; print "電燈泡\n"; print "電話聽筒\n"; print "咖啡杯\n"; print "向右擁抱\n"; print "向左擁抱\n"; print "啤酒杯\n"; print "馬丁尼杯\n"; print "男孩\n"; print "女孩\n"; print "
\n"; print "豎起大拇指\n"; print "大拇指朝下\n"; print "時鐘\n"; print "吸血蝙蝠\n"; print "手銬\n"; print "太陽\n"; print "彩虹\n"; print "電子郵件\n"; print "
\n"; print "使用方法:正在輸入留言內容的時候,點選一下想要插入的表情符號,該語法
\n"; print "便會貼在留言內容裡面。真正的表情圖片會在送出留言後才會顯示出來。
\n"; #窗框顏色 if ( $colb_use != 1 && $FORM{'action'} ne 'res' && $c_resno eq '') { print "留言背景:\n"; print "\n"; foreach (0 .. $#COLORS_B) { if ( $c_color == $_ || ($c_color eq '' && $_ == 0)) { $dmy = "checked"; } else { $dmy = "" ; } print ""; print "\n"; #(驚直修改 - 改以微縮字形大小顯示) } print "\n"; } } #文字顏色 if ( $colf_use != 1 ) { print "文字顏色:\n"; print "\n"; foreach (0 .. $#COLORS_F) { if ( $c_color_f == $_ || ($c_color_f eq '' && $_ == 0)) { $dmy = "checked"; } else { $dmy = "" ; } print ""; print "\n"; #(驚直修改 - 改以微縮字形大小顯示) } print "\n"; } print "\n"; #圖檔選擇 if ( $icon_rank == 0 && $icon_use eq 'yes') { print "\n"; print "圖檔選擇:\n"; print ""; print "\n"; print "  [ 瀏覽圖檔 ]\n"; #(驚直修改 - 改以新視窗方式開啟,以微縮字形大小顯示) #留言密碼 print "    編輯留言-密碼:\n"; print "  (可不填)\n"; print "

"; if ( $FORM{'action'} ne 'res' && $c_resno eq '' ) { if ( $FORM{'kflg'} ) { $k = "一氣回覆"; } else { $k = "送出留言" } #(驚直加入 - 判別一氣回覆模式時,送出按鈕上的文字) print "\n"; #i000714 } else { print "\n"; print "\n"; } print "
"; print "" if ( $FORM{'kflg'} eq '' ); #i001103 if ( $FORM{'kflg'} ne '' ) { print "
$ikkimsg
" ; } return ; } } ###<-------------------------------------------------------------- ###<--- HTML表頭部份 ###<-------------------------------------------------------------- sub header { print "Content-type: text/html; charset=big5\n\n"; print "\n\n"; print "\n"; if ( $FORM{'action'} eq 'icondisp' ) { print "$title【圖檔一覽表】\n"; } elsif ( $FORM{'action'} eq 'rankdisp' ) { print "$title【各人晉級狀態】\n"; } elsif ( $FORM{'action'} eq 'info' ) { print "$title【晉級資格說明】\n"; } else { print "$title\n"; } #(驚直修改 - 判別其他新頁面的名稱來定義標題) #<<>> print "\n"; #<<>> print "\n"; print "\n"; if ($backpicture) { $set = "background=\"$backpicture\" bgproperties=fixed"; if ( $bgcolor ) { $set .= " bgcolor=\"$bgcolor\"" ; } } elsif ($bgcolor ) { $set = "bgcolor=\"$bgcolor\""; } print "\n"; } ###<-------------------------------------------------------------- ###<--- 顯示HTML頁首 ###<-------------------------------------------------------------- sub header2 { print "
\n"; print "\n"; if ( $cntfile ) { #顯示計數器 $edt = "%0" .$cnt_keta . "d" ; $COUNT = sprintf("$edt",$COUNT) ; if ( $cnt_gif[0] ) { for ( $i = 1 ; $i <= $cnt_keta ; $i++ ) { $c = substr($COUNT,$i - 1 , 1 ) ; print "$cnt_gif[$c]"; } } else { print "瀏覽人次 → $COUNT"; #(驚直修改 - 使用英文字形顯示純文字計數器) } } else { print " "; } print "
\n"; print "

\n"; if ( $titlelogo ) { print "$titlelogo
\n"; } else { print "$title
\n"; } print "$look"; print "
\n"; print "
\n"; #(驚直修改 - 改以全視窗方式開啟) if ( $logfile2 && $FORM{'action'} ne 'download') { print "\n"; #(驚直修改 - 改以新視窗方式開啟) print "\n"; #(驚直修改 - 改以新視窗方式開啟) } print "\n"; if ( $ikkiflg == 1 ) { print "\n"; #(驚直修改 - 改以同一視窗方式開啟) } else { print "\n"; #(驚直修改 - 改以同一視窗方式開啟) } } if ( $#oldcnt >= 0 ) { print "\n"; } print "
"; #(驚直修改 - 外加表格) print " 
 
 
 
\n"; if ( $FORM{'kflg'} eq '' ) { print " 
\n"; #(驚直修改 - 加入空白表格欄) print "  \n"; print "\n"; print "
"; # print "\n"; } ###<-------------------------------------------------------------- ###<--- 顯示HTML頁尾 ###<-------------------------------------------------------------- sub footer { #<<<↓以下版權宣告部份不得刪除,但可略作修改。(尊重智慧財產權 — 請勿將中文化作者刪掉或改為你自己的名字) print "
\n"; print "mkakikomitai Ver$ver Created by Tacky\'s Room
\n"; print "中文化及其他修改:天真的驚直 [2001.3.4]
\n"; print "技術分享:Alan資訊天地 朝鳳~伊索蓓源
\n"; print "微幅修改及版面美化:cc[2002.6.1]
\n"; #如果你將留言板安裝在HyperMart或Virtual Avenue的主機伺服器上,你可以拿掉下面的#號直接在留言板掃出廣告,避免再彈出來令人厭惡的廣告。 (驚直加入) # print "
\n"; #HyperMart/VirtualAve廣告語法 print "\n"; } ###<-------------------------------------------------------------- ###<--- 讀取記錄檔 ###<-------------------------------------------------------------- sub dataread { #讀取記錄檔 if ( ( $FORM{'action'} ne 'oldlogfind' && $FORM{'action'} ne 'download' ) || $FORM{'oldlogno'} == 0 ) { if ( !(open(IN,"$logfile"))) { &error("記錄檔 ($logfile) 讀取失敗。"); } } else { $wk = $olddir . $FORM{'oldlogno'} . ".txt" ; if ( !(open(IN,"$wk"))) { &error("記錄檔 ($wk) 讀取失敗。"); } } @LOG = ; close(IN); @RESLOG = () ; @MAINLOG = () ; $MAXNO = ''; @SVLOG = () ; foreach ( @LOG ) { ($no,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$_); if ( $resno eq '' ) { push(@MAINLOG,$_) ; } else { push(@RESLOG,$_) ; } push(@SVLOG,"$_"); if ( $no >= $MAXNO ) { $MAXNO = $no ; } } if ( $FORM{'action'} ne 'oldlogfind' || $FORM{'oldlogno'} == 0 ) { #I991220 @RESLOG = reverse @RESLOG ; } #I991220 #<<<讀取計數器記錄檔 if ( $cntfile && $FORM{'action'} ne 'download' ) { #u001112 if ( !(open(IN,"$cntfile"))) { &error("計數器記錄檔 ($cntfile) 讀取失敗。"); } $COUNT = ; close(IN); if ( $FORM{'action'} eq '') { $COUNT++ ; if ( !(open(OUT,">$cntfile"))) { &error("計數器記錄檔 ($cntfile) 讀取失敗。"); } print OUT $COUNT; close(OUT); } } } ###<-------------------------------------------------------------- ###<--- 顯示留言記錄 ###<-------------------------------------------------------------- sub view { print "
\n"; #計算留言記錄所需之頁數 $dm = @MAINLOG; if ( $dm % $pagemax == 0) { $p = $dm / $pagemax ; } else { $p = $dm / $pagemax + 1; } $p = sprintf("%3d",$p); for ( $k = 1 ; $k <= $p ; $k++ ) {if ( $FORM{'page'} eq $k ) { $FORM{'disppage'} = $k ; $d = ($k) * $pagemax - $pagemax ; }} if ( $FORM{'page'} eq "下一頁" ) { if ( $FORM{'disppage'} == 0 ) { $FORM{'disppage'} = 1 } ; $d = ($FORM{'disppage'} + 1) * $pagemax - $pagemax ; $FORM{'disppage'} = $FORM{'disppage'} + 1 ; } elsif ( $FORM{'page'} eq "上一頁" ) { $d = ($FORM{'disppage'} - 1) * $pagemax - $pagemax ; $FORM{'disppage'} = $FORM{'disppage'} - 1 ; } elsif ( $FORM{'disppage'} ne "" ) { #I991123 $d = $FORM{'disppage'} * $pagemax - $pagemax ; #I991123 } else { $d = 0 ; $FORM{'disppage'} = 1 ; } if ( $msg_color ) { $tbbg = "bgcolor=\"$msg_color\"" ; } else { $tbbg = "" ; } $z = 1 ; if ( $FORM{'action'} eq 'download' ) { #i001112 $d = 0 ; $pagemax = $dm ; $maru = 0 ; $maillinklogo=""; $homelinklogo=""; $icon_use = "no"; print "
$title
\n"; } for ( $i = $d ; ( $z <= $pagemax ) && ( $i < $dm ); $i++ ) { ($no,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$host,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$MAINLOG[$i]); $nameall=$name; $namefull=$name; ($name,$use) = split(/~/,$name); #tabcc if ($use eq '' || $use eq '0'){$namefull=$name;} if ( ($FORM{'action'} ne 'res' || ($FORM{'action'} eq 'res' && $FORM{'no'} eq $no)) || $FORM{'action'} eq 'download' ) { #u001112 if ( $FORM{'action'} ne 'res' && $FORM{'kflg'} eq '' ) { #i001103 print "
"; print ""; print ""; print "\n"; #I991123 } if ( $nya == 0 ) { $comment =~ s/([^=^\"]|^)(http|ftp)([\w|\!\#\&\=\-\%\@\~\;\+\:\.\?\/]+)/$1按此連結<\/b><\/font><\/a>/g; #(驚直修改 - 改為LINK HERE英文字樣及開新視窗) $comment =~ s/(\[)([a-z]+)(\])//g; } else { $comment =~ s/
/

/g; } if ( $colf_use != 1 ) { $color_f = $COLORS_F[$color_f] ; } #留言者選擇的文字顏色 else { $color_f = $colf ; } #管理者指定的文字顏色 if ( $colb_use != 1 ) { $color = $COLORS_B[$color] ; } #留言者選擇的背景顏色 else { $color = $colb ; } #管理者指定的背景顏色 print "
\n"; print "\n"; if ( $maru == 1 ) { #使用圓角留言框的場合 print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } else { print "\n"; if ( $FORM{'action'} ne 'download' ) { #kxxk20010217 print "\n"; } else { print "\n"; } print "\n"; } print "\n"; if ( $FORM{'action'} ne 'download' ) { #kxxk20010217 print "\n"; } else { print "\n"; } print "\n"; if ( $FORM{'action'} ne 'download' ) { #kxxk20010217 print "\n"; } else { print "\n"; } print "\n"; if ( $FORM{'action'} ne 'download' ) { #kxxk20010217 print "\n"; } else { print "\n"; } print "\n"; if ( $FORM{'action'} ne 'download' ) { #kxxk20010217 print "\n"; } else { print "\n"; } print "\n"; if ( $maru == 1 ) { #使用圓角留言框的場合 print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } else { print "\n"; if ( $FORM{'action'} ne 'download' ) { #kxxk20010217 print "\n"; } else { print "\n"; } print "\n"; } print "
$top_l$top_r
 
 "; print ""; if ( $logfile2 ne '' ) { $ranking = &rankget($ksu) ; print ""; #(驚直修改 - 以微縮字形大小顯示) print "\n"; } print ""; if ( $titleset == 1 ) { if ( !($ttl) ) { $ttl = ""; } else { print ""; } } print "
  $ranking     "; print "$name 
主旨: $ttl "; print "   "; #(驚直修改 - 修正原程式語法錯誤) print "
 
 \n"; print "
"; print "\n"; #(驚直修改 - 刪除原程式多餘的
語法) print "
\n"; #(驚直修改 - 美化留言內容排列) #顯示圖檔 if ( $icon_use eq 'yes' ) { &icon_set($namefull) ; } else { print " "; } print "\n"; #(驚直修改 - 留言內容靠上顯示) print "
$comment\n"; #(驚直修改 - 修正原程式語法位置錯誤) print "
"; #(驚直修改 - 留言資訊靠下顯示) $no = sprintf("%d",$no); print "
"; #(驚直修改 - 改用span語法,自定英文字形集,以微縮字形大小顯示) if ( $email ne '' ) { if ( $maillinklogo ) { print "寫封信給 $name\n"; } else { print "[ MAIL ]\n"; } #(驚直修改 - 美化字形) } if ( $hp ne '' ) { if ( $homelinklogo ) { print "前往 $name 的個人網站\n"; } else { print "[ HP ]\n"; } #(驚直修改 - 美化字形) } print " 完整暱稱: $nameall"; if ( $kaisu_disp == 1 ) { print " $name 的第$ksu篇留言"; } #(驚直修改 - 留言篇數用英文字形顯示) if ( $hostflag eq 'yes') { print " \"IP: $host\""; } print " \"發表時間: $regdate\" \"留言編號: $no\"

"; #kxxk20010130 #顯示訪客回應的留言 $j = 0 ; foreach $buf ( @RESLOG ) { ($no2,$name,$email,$hp,$ttl,$comment,$regdate,$col_f,$col_b,$resno,$host,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$buf); #u001103 $nameall=$name; $namefull=$name; ($name,$use) = split(/~/,$name); #tabcc if ($use eq '' || $use eq '0'){$namefull=$name;} if ( $no eq $resno ) { if ( $colf_use != 1 ) { $col_f = $COLORS_F[$col_f] ; } #留言者選擇的文字顏色(背景顏色與原留言者相同) else { $col_f = $colf ; } #管理者指定的文字顏色 print "
\n"; print "
\n"; print "\n"; print "
\n"; print ""; if ( $logfile2 ne '' ) { $ranking = &rankget($ksu) ; print ""; #(驚直修改 - 以微縮字形大小顯示) print "\n"; } print "\n"; print "
  $ranking     "; print "$name 
"; print "   "; #(驚直修改 - 修正原程式語法錯誤) print "
"; print "
\n"; #(驚直修改 - 美化留言內容排列) #顯示圖檔 if ( $icon_use eq 'yes' ) { &icon_set($namefull) ; } else { print " "; } print "\n"; #(驚直修改 - 留言內容靠上顯示) if ( $nya == 0 ) { $comment =~ s/([^=^\"]|^)(http|ftp)([\w|\!\#\&\=\-\%\@\~\;\+\:\.\?\/]+)/$1按此連結<\/b><\/font><\/a>/g; #(驚直修改 - 改為LINK HERE英文字樣及開新視窗) $comment =~ s/(\[)([a-z]+)(\])//g; } else { $comment =~ s/
/

/g; } print "
$comment

\n"; print "
"; #(驚直修改 - 留言資訊靠下顯示) $no2 = sprintf("%d",$no2); print ""; #(驚直修改 - 改用span語法,自定英文字形集,以微縮字形大小顯示) if ( $email ne '' ) { if ( $maillinklogo ) { print "寫封信給 $name\n"; } else { print "[ MAIL ]\n"; } #(驚直修改 - 美化字形) } if ( $hp ne '' ) { if ( $homelinklogo ) { print "前往 $name 的個人網站\n"; } else { print "[ HP ]\n"; } #(驚直修改 - 美化字形) } if ( $hostflag eq 'yes') { print " \"完整暱稱: $nameall\""; if ( $kaisu_disp == 1 ) { print " $name 的第$ksu篇留言"; } #(驚直修改 - 留言篇數用英文字形顯示) print " \"IP: $host\""; } print " \"發表時間: $regdate\" \"留言編號: $no2\"
"; #kxxk20010130 print "
\n"; $j++; } } print "
"; if ( $FORM{'action'} ne 'res' && $FORM{'oldlogno'} == 0 && $FORM{'kflg'} eq '' && $FORM{'action'} ne 'download' ) { #i001103 print "移到頂部移到頂部 "; print "發表新的留言發表新的留言 "; print ""; if ( $res_gif ) { print "
回覆此篇留言
\n"; } else { print "   \n"; } } print "
"; print "
 
$bottom_l$bottom_r
 
"; #u001103 if ( $FORM{'kflg'} == 1 && $FORM{'action'} ne 'download' ) { #i001112 print "
\n"; #i001103 print "▲請把回覆上面的留言內容寫在下面這個留言框▼\n"; #i001103 print "

\n"; #i001103 } #i001103 print "\n" if ( $FORM{'kflg'} eq '' ) ; #i001103 } $z++; } print "\n" if ( $FORM{'kflg'} == 1 ) ; #i001112 if ( $FORM{'action'} ne 'res' && $FORM{'action'} ne 'download') { $dm = @MAINLOG; if ( $dm % $pagemax == 0) { $p = $dm / $pagemax ; } else { $p = $dm / $pagemax + 1; } $p = sprintf("%3d",$p); print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; #i001103 if ( $FORM{'disppage'} != 0 && $FORM{'disppage'} !=1) { print "\n"; } for ( $k = 1 ; $k <= $p ; $k++ ) { if($k==$FORM{'disppage'}){print "$k\n";} else{ print "\n";} } if ( $FORM{'disppage'} + 1 <= $p ) { print "\n"; } print "
\n"; } if ( $FORM{'action'} eq 'download' ) { return; } #i001112 #print "
\n" ; #print "
\n"; #print "\n"; #print "\n"; #print "\n"; #print "
下載時,請把檔案的延伸檔名改為 htm / html。"; #print "
\n"; if ( $FORM{'oldlogno'} == 0 ) { print "
"; #(驚直修改 - 修正原程式語法位置錯誤) print "
\n"; print "留言編號:\n"; #(驚直修改 - 使用英數欄位樣式表) print "密碼:\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; } } ###<-------------------------------------------------------------- ###<--- 寫入記錄檔 ###<-------------------------------------------------------------- sub regist { return; #取得留言者的伺服器名稱 $host = $ENV{'REMOTE_HOST'}; $addr = $ENV{'REMOTE_ADDR'}; if ($host eq "" || $host eq "$addr") { ($p1,$p2,$p3,$p4) = split(/\./,$addr); $temp = pack("C4",$p1,$p2,$p3,$p4); $host = gethostbyaddr("$temp", 2); if ($host eq "") { $host = $addr; } } #檢查危險語法標籤 foreach $buf(@DANGER_LIST){ if ( $buf ) { $buf=~ s/\./\\./g; $buf=~ s/\?/\./g; $buf=~ s/\*/\.\*/g; if ($host =~ /$buf/gi) { &error("抱歉,你所屬的網域名稱已被禁止在這個留言板使用。"); } } } if ( $FORM{'name'} eq '') { &error("你還沒有填入你的名字喔!"); } if ( $FORM{'kflg'} eq '' ) { #i001103 if ( $FORM{'comment'} eq '') { &error("為什麼留言內容是空的呢?"); } if ( $maxword ne '' && (length($FORM{'comment'}) > $maxword)) { &error("你的留言內容太長了。留言內容不可超過 $maxword 個字元!"); } } #i001103 for ( $i = $pagemax ; $i >= 1 ; $i-- ) { $wk = "resno" . $i ; $rno = $FORM{$wk} ; $wk = "rescomment" . $i ; $rcom = $FORM{$wk} ; if ( $rno ne '' && $rcom ne '' ) { if ( $maxword ne '' && (length($rcom) > $maxword)) { &error("你的留言內容太長了。留言內容不可超過 $maxword 個字元!"); } } } &filelock ; #檔案鎖定 &dataread ; #讀取記錄檔 if ( $FORM{'kflg'} eq '' ) { #i001103 ($oyano,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$SVLOG[0]); if ( $name eq $FORM{'name'} && $ttl eq $FORM{'title'} && $comment eq $FORM{'comment'} ) { &fileunlock ; &error("不能再次寫入一模一樣的留言。可能你重複按了兩次按鈕嘍!") ; } if ( $logfile2 ne '' && ( $FORM{'action'} ne 'oldlogfind' || $FORM{'oldlogno'} == 0 )) { if ( !(open(IN2,"$logfile2"))) { &fileunlock ; &error("晉級狀態記錄檔 ($logfile2) 讀取失敗。"); } $flg = 0 ; while ( ) { ($n,$k) = split(/,/,$_); $k =~ s/\n//; ($name,$use) = split(/~/,$FORM{'name'}); #tabcc if ( $name eq $n ) { #tabcc if ( $rdm != 0 ) { #■隨機回扣留言篇數 srand(time ^ ($$ + ($$ << 15))); $w = int(rand(30)) ; $p = 0 ; #■根據$rdm的設定回扣留言篇數 if ( $w % $rdm == 0 ) { $k = $k - $DOWN[int(rand($#DOWN))] ; if ( $k < 0 ) { $k = 0 ; } } else { $k++; } } else { $k++ ; } $dcnt = $k ; $flg = 9; } if ( $maxword ne '' ) { if ( length($rcom) > '400' ) {$k = '500';} if ( length($rcom) > '1000' ) {$k = '500';} } push(@sv,"$n,$k\n"); } if ( $flg == 0 ) { push(@sv,"$name,1\n"); #tabcc $dcnt = 1; } close(IN2); if ( !(open(OUT2,">$logfile2"))) { &fileunlock ; &error("晉級狀態記錄檔 ($logfile2) 讀取失敗。"); } print OUT2 @sv; close(OUT2); } $dcnt2 = @SVLOG; if ( $dcnt2 < 1 ) { $no = 1; #第1篇留言 } else { $no = $MAXNO + 1; } #寫入訪客回覆的留言記錄時,將該篇留言整串移回最頂端的處理 if ( $resflag eq 'yes' && $FORM{'resno'} ne '') { $cnt = 0 ; $oyacnt = 1 ; foreach $buf ( @SVLOG ) { ($oyano,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$buf); if ( $oyano eq $FORM{'resno'} ) { $sv_title = $ttl ; splice(@SVLOG,$cnt,1); $wk = "$oyano,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon"; unshift(@SVLOG,$wk); last ; } $cnt++ ; } } else { if ( $sendmail ) { foreach $buf ( @SVLOG ) { ($oyano,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$buf); if ( $oyano eq $FORM{'resno'} ) { $sv_title = $ttl ; last ; } } } } if ( $olddir ) { #舊留言集的處理 if ( !($FORM{'resno'}) && $#MAINLOG + 1 >= $datamax ) { ($oyano,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$MAINLOG[$#MAINLOG]); @OLD = () ; if ( $#oldcnt >= 0 ) { if ( !(open(IN,"$oldfile"))) { &fileunlock ; &error("過去記錄檔 ($oldfile) 讀取失敗。"); } @OLD = ; close(IN); if ( $#OLD + 1 >= $oldmax ) { $i = sprintf("%02d",$#oldcnt + 2) ; $oldfile = "$olddir$i" . ".txt" ; @OLD = () ; } } else { $oldfile = "$olddir" . "01.txt" ; } $cnt = 0 ; @SVLOG2 = @SVLOG ; @SVLOG = () ; foreach $buf ( @SVLOG2 ) { ($oyano2,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno2,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$buf); if ( $oyano == $oyano2 || $oyano == $resno2) { unshift(@OLD,$buf) ; } else { push(@SVLOG,$buf); } $cnt++ ; } if ( !(open(OUT,">$oldfile"))) { &fileunlock ; &error("過去記錄檔 ($oldfile) 讀取失敗。"); } print OUT @OLD; close(OUT); #更改檔案權限 (驚直提示 - 可設成更安全的0600) chmod(0600,"$oldfile"); } } else { if ( !($FORM{'resno'}) && $#MAINLOG + 1 >= $datamax ) { ($oyano,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$MAINLOG[$#MAINLOG]); @SVLOG2 = @SVLOG ; @SVLOG = () ; foreach $buf ( @SVLOG2 ) { ($oyano2,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno2,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$buf); if ( $oyano == $oyano2 || $oyano == $resno2) { } else { push(@SVLOG,$buf); } } } } #留言密碼的加密程序(將密碼暗號化) if ($FORM{'pass'} ne "") { &pass_enc($FORM{'pass'}); } else { $pass = '' ; } unshift(@SVLOG,"$no,$FORM{'name'},$FORM{'email'},$FORM{'hp'},$FORM{'title'},$FORM{'comment'},$today,$FORM{'color_f'},$FORM{'color'},$FORM{'resno'},$host,$dcnt,$pass,$dmy,$dmy,$FORM{'icon'}\n"); if ( !(open(OUT,">$logfile"))) { &fileunlock ; &error("記錄檔 ($logfile) 讀取失敗。"); } print OUT @SVLOG; close(OUT); &fileunlock ; #解除檔案鎖定 $wk = $smail_address ; $wk =~ s/\\//g; if ( $sendmail && ($sendsw == 1 || ( $sendsw == 0 && $FORM{'email'} ne $wk ) ) ) { &SMail ; } } else { #↓i001103 for ( $i = $pagemax ; $i >= 1 ; $i-- ) { $wk = "resno" . $i ; $rno = $FORM{$wk} ; $wk = "rescomment" . $i ; $rcom = $FORM{$wk} ; if ( $rno ne '' && $rcom ne '' ) { &dataread ; #讀取記錄檔 if ( $logfile2 ne '' ) { if ( !(open(IN2,"$logfile2"))) { &fileunlock ; &error("晉級狀態記錄檔 ($logfile2) 讀取失敗。"); } $flg = 0 ; @sv = (); while ( ) { ($n,$k) = split(/,/,$_); $k =~ s/\n//; if ( $FORM{'name'} eq $n ) { $k++ ; $dcnt = $k ; $flg = 9; } push(@sv,"$n,$k\n"); } if ( $flg == 0 ) { push(@sv,"$FORM{'name'},1\n"); $dcnt = 1; } close(IN2); if ( !(open(OUT2,">$logfile2"))) { &fileunlock ; &error("晉級狀態記錄檔 ($logfile2) 讀取失敗。"); } print OUT2 @sv; close(OUT2); } $dcnt2 = @SVLOG; if ( $dcnt2 < 1 ) { $no = 1; #第1篇留言 } else { ($no,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$SVLOG[0]); $no++; } #寫入訪客回覆的留言記錄時,將該篇留言整串移回最頂端的處理 if ( $resflag eq 'yes') { $cnt = 0 ; $oyacnt = 1 ; foreach $buf ( @SVLOG ) { ($oyano,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$buf); if ( $oyano eq $rno ) { splice(@SVLOG,$cnt,1); $wk = "$oyano,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$hst,$ksu,$pass,$dmy,$dmy,$icon"; unshift(@SVLOG,$wk); last ; } $cnt++ ; } } #留言密碼的加密程序(將密碼暗號化) if ($FORM{'pass'} ne "") { &pass_enc($FORM{'pass'}); } else { $pass = '' ; } unshift(@SVLOG,"$no,$FORM{'name'},$FORM{'email'},$FORM{'hp'},,$rcom,$today,$FORM{'color_f'},,$rno,$host,$dcnt,$pass,$dmy,$dmy,$FORM{'icon'}\n"); if ( !(open(OUT,">$logfile"))) { &fileunlock ; &error("記錄檔 ($logfile) 讀取失敗。"); } print OUT @SVLOG; close(OUT); &fileunlock ; #解除檔案鎖定 $wk = $smail_address ; $wk =~ s/\\//g; if ( $sendmail && ($sendsw == 1 || ( $sendsw == 0 && $FORM{'email'} ne $wk ) ) ) { &SMail ; } #(驚直修改 - 修正原程式的寄發郵件通知功能不支援一氣回覆) } } } #↑i001103 #COOKIE設定 &cookieset ; } ###<-------------------------------------------------------------- ###<--- 管理模式 ###<-------------------------------------------------------------- sub Maintenance { if ( $FORM{'pass'} eq "") { &error("必須輸入密碼。"); } @DELWORD = split(/ /,$FORM{'no'}); if ($FORM{'pass'} eq $password && $FORM{'proc'} eq 'delete' && @DELWORD > 1 ) { &update ; return ; } &dataread ; #讀取記錄檔 $found = 0 ; foreach ( @SVLOG ) { ($no,$c_name,$c_email,$c_hp,$c_title,$c_comment,$regdate,$c_color_f,$c_color,$c_resno,$host,$ksu,$passwd,$dmy,$dmy,$c_icon) = split(/,/,$_); if ( $FORM{'no'} eq $no ) { if ($FORM{'pass'} ne $password && (&pass_dec($passwd))) { &fileunlock ; #解除檔案鎖定 &error("密碼不正確!"); } $found = 1 ; if ( $FORM{'proc'} eq "delete" ) { $c_resno=""; #i010131 &update ; return; } &header ; $c_pass = $FORM{'pass'} ; $c_comment =~ s/
/\n/g; &forminput ; last; } } if ( $found == 0 ) { &fileunlock ; #解除檔案鎖定 &error("找不到這個留言編號的記錄!"); } &footer ; exit; } ###<-------------------------------------------------------------- ###<--- 更新記錄檔 ###<-------------------------------------------------------------- sub update { &filelock ; #檔案鎖定 &dataread ; #讀取記錄檔 $j = 0 ; @new = () ; foreach $buf (@SVLOG) { ($no,$name,$email,$hp,$ttl,$comment,$regdate,$color_f,$color,$resno,$host,$ksu,$pass,$dmy,$dmy,$icon) = split(/,/,$buf); if ( $FORM{'no'} eq $no || ( $FORM{'proc'} eq 'delete' && $FORM{'no'} eq $resno ) ) { #<<<符合進入管理模式的條件 if ( $FORM{'proc'} eq "edit" ) { #寫入留言密碼及加密程序(將密碼暗號化) if ($FORM{'pass'} ne "") { &pass_enc($FORM{'pass'}); } else { $pass = '' ; } if ( $rno eq '' ) { push(@new,"$no,$FORM{'name'},$FORM{'email'},$FORM{'hp'},$FORM{'title'},$FORM{'comment'},$regdate,$FORM{'color_f'},$FORM{'color'},$resno,$host,$ksu,$pass,$dmy,$dmy,$FORM{'icon'}\n"); } else { push(@new,"$no,$FORM{'name'},$FORM{'email'},$FORM{'hp'},$ttl,$FORM{'comment'},$regdate,$FORM{'color_f'},$FORM{'color'},$resno,$host,$ksu,$pass,$dmy,$dmy,$FORM{'icon'}\n"); } } } else { $found = 0 ; if ( $FORM{'proc'} eq 'delete' ) { @DELWORD = split(/ /,$FORM{'no'}); foreach $word ( @DELWORD ) { if ( $word && ( $no eq $word || $resno eq $word ) ) { $found = 1 ; last ; } #u000726 } } if ( $found == 0 ) { push(@new,$buf); } } } if ( !(open(OUT,">$logfile"))) { &fileunlock ; &error("記錄檔 ($logfile) 讀取失敗。"); } print OUT @new; close(OUT); &fileunlock ; #解除檔案鎖定 $FORM{'action'} = '' ; } ###<-------------------------------------------------------------- ###<--- 顯示圖檔一覽表 ###<-------------------------------------------------------------- sub icondisp { &header ; #<<關閉視窗

\n"; #(驚直修改 - 使用JavaScript連結關閉視窗) print "■■■ 圖檔一覽表 ■■■

\n"; print "\n"; $i = 0 ; $j = 0 ; while ( 1 ) { print "\n"; for ( $ln = 1 ; $j <= $#icon_gif && $ln <= $icon_line ; ) { print "\n"; print "\n"; $j++ ; $ln++ ; } if ( $j > $#icon_gif ) { if ( $ln < $icon_line ) { for ( ; $ln <= $icon_line ; ) { print "\n"; $ln++ ; } } print "\n"; last ; } print "\n"; $i++; } print "
$iconnm[$j]  
"; if ( $jiconnm[0] ne '' ) { print "
\n"; print "
▼專用照片使用方法▼
\n"; print "
姓名輸入以下這些字串,可免選圖片,直接使用對應的照片\n"; $i = 0 ; $j = 0 ; while ( 1 ) { print "\n"; for ( $ln = 1 ; $j <= $#jicon_gif && $ln <= $icon_line ; ) { print "\n"; $j++ ; $ln++ ; } if ( $j > $#jicon_gif ) { if ( $ln < $icon_line ) { for ( ; $ln <= $icon_line ; ) { print "\n"; $ln++ ; } } print "\n"; last ; } print "\n"; $i++; } print "
\n"; print "
$jiconnm[$j]
 
"; } print "


\n"; &footer ; #<<<顯示HTML頁尾 exit; } ###<-------------------------------------------------------------- ###<--- 顯示正確的圖檔 ###<-------------------------------------------------------------- sub icon_set { if ( $icon_rank == 0 ) { #不使用晉級模式的情況 #如果是常連者留言,使用常連者專用圖檔 $found = 0 ; for ( $k = 0 ; $k <= $#jiconnm ; $k++ ) { if ( $_[0] eq $jiconnm[$k] ) { $found = 1 ; #if ( $jicon_gif_w[$k] != 0 ) { $dmy = "width=\"$jicon_gif_w[$k]\" height=\"$jicon_gif_h[$k]\"" ; } else { $dmy = "" ; } print "\"$jicon_gif[$k]\""; last ; } } #如果是管理者留言,使用管理者專用圖檔 if ( $oiconpass ) { if ( $ango == 1 ) { $wpass = crypt($oiconpass, $oiconpass); } else { $wpass = $oiconpass ; } if ( $pass eq $wpass && $found == 0 ) { #(驚直修改 - 修正原作者一個不起眼的臭蟲:當常連者準確輸入管理者專用圖檔密碼留言的時候,會同時出現兩種專用圖檔) $found = 1 ; if ( $oicon_gif_w != 0 ) { $dmy = "width=\"$oicon_gif_w\" height=\"$oicon_gif_h\"" ; } else { $dmy = "" ; } print ""; } } if ( $found == 0 ) { if ( !($icon) ) { $icon = 0 ; } if ( $icon_gif_w[$icon] != 0 ) { $dmy = "width=\"$icon_gif_w[$icon]\" height=\"$icon_gif_h[$icon]\"" ; } else { $dmy = "" ; } print ""; } } else { #使用晉級模式的情況 #如果是管理者留言,使用管理者專用圖檔 $found = 0 ; if ( $oiconpass ) { if ( $ango == 1 ) { $wpass = crypt($oiconpass, $oiconpass); } else { $wpass = $oiconpass ; } if ( $pass eq $wpass && $found == 0 ) { #(驚直修改 - 修正原作者一個不起眼的臭蟲:當常連者準確輸入管理者專用圖檔密碼留言的時候,會同時出現兩種專用圖檔) $found = 1 ; if ( $oicon_gif_w != 0 ) { $dmy = "width=\"$oicon_gif_w\" height=\"$oicon_gif_h\"" ; } else { $dmy = "" ; } print ""; } } if ( $found == 0 ) { print ""; } } } ###<-------------------------------------------------------------- ###<--- 取得COOKIE資訊 ###<-------------------------------------------------------------- sub cookieget { $cookies = $ENV{'HTTP_COOKIE'}; @pairs = split(/;/,$cookies); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ s/ //g; $DUMMY{$name} = $value; } @pairs = split(/,/,$DUMMY{'mkakikomitai'}); foreach $pair (@pairs) { ($name, $value) = split(/\!/, $pair); $COOKIE{$name} = $value; } if ($FORM{'name'}) { $COOKIE{'nm'} = $FORM{'name'}; } if ($FORM{'email'}) { $COOKIE{'em'} = $FORM{'email'}; } if ($FORM{'hp'}) { $COOKIE{'hp'} = $FORM{'hp'}; } if ($FORM{'pass'}) { $COOKIE{'ps'} = $FORM{'pass'}; } if ($FORM{'icon'}) { $COOKIE{'icon'} = $FORM{'icon'}; } if ($FORM{'color'}) { $COOKIE{'cl'} = $FORM{'color'}; } if ($FORM{'color_f'}) { $COOKIE{'cl_f'} = $FORM{'color_f'}; } if ($FORM{'d3epass'}) { $COOKIE{'d3eps'} = $FORM{'d3epass'}; } } ###<-------------------------------------------------------------- ###<--- 設定COOKIE ###<-------------------------------------------------------------- sub cookieset { ($secg,$ming,$hourg,$mdayg,$mong,$yearg,$wdayg,$ydayg,$isdstg) =gmtime(time + 30*24*60*60); $yearg += 1900 ; if ($secg < 10) { $secg = "0$secg"; } if ($ming < 10) { $ming = "0$ming"; } if ($hourg < 10) { $hourg = "0$hourg"; } if ($mdayg < 10) { $mdayg = "0$mdayg"; } $mong = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mong]; $youbi = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')[$wdayg]; $date_gmt = "$youbi, $mdayg\-$mong\-$yearg $hourg:$ming:$secg GMT"; $cook="nm\!$FORM{'name'},em\!$FORM{'email'},hp\!$FORM{'hp'},cl_f\!$FORM{'color_f'},cl\!$FORM{'color'},ps\!$FORM{'pass'},icon\!$FORM{'icon'}"; print "Set-Cookie: mkakikomitai=$cook; expires=$date_gmt\n"; } ###<-------------------------------------------------------------- ###<--- 顯示錯誤訊息 ###<-------------------------------------------------------------- sub error { &header ; print "$_[0]

\n"; #(驚直修改 - 改以紅字顯示) &footer; exit; } ###<-------------------------------------------------------------- ###<--- 檔案鎖定程序 ###<-------------------------------------------------------------- sub filelock { if (-e $lockfile) { ($ftm) = (stat($lockfile))[9]; if ($ftm < time - 150) { unlink($lockfile); } } foreach (1 .. 5) { if (-e $lockfile) { sleep(1); } else { open(LOCK,">$lockfile"); close(LOCK); return; } } &error("同時有其他人正在寫入留言。請返回上一頁待稍後再試一次吧。
假如情況持續,可能因為留言板給鎖定了,請通知留言板管理者刪除鎖定檔 ($lockfile) 。"); } ###<-------------------------------------------------------------- ###<--- 解除檔案鎖定 ###<-------------------------------------------------------------- sub fileunlock { if (-e $lockfile) { unlink($lockfile); } } ###<-------------------------------------------------------------- ###<--- 取得留言者的留言篇數 ###<-------------------------------------------------------------- sub rankget { $set = 0 ; $tmax = $#rankno ; for ( $j = 0 ; $j <= $tmax ; $j++ ) { if ( $_[0] >= $rankno[$j] ) { $ranking = $rank[$j] ; $rank_idx = $j ; } } return ($ranking); } ###<-------------------------------------------------------------- ###<--- 顯示晉級資格說明 ###<-------------------------------------------------------------- sub info { &header ; #<<關閉視窗
\n"; #(驚直修改 - 改為關閉視窗) print "■■■ 晉級資格說明 ■■■

\n"; print "只要達到以下的留言篇數,你就可以晉級喔!

\n"; $i = 0; print "
\n"; print "\n"; $k = $#rank ; for ( @rank ) { print "\n"; print "\n"; $i++; } print "
$rank[$i]"; $j = $rankno[$i+1] - 1 ; if ( $i != $k ) { #(驚直修改 - 加入英文字形) print "$rankno[$i]$j 篇\n"; } else { print "$rankno[$i] 篇以上\n"; } print "


"; &footer ; #<<<顯示HTML頁尾 exit; } ###<-------------------------------------------------------------- ###<--- 寄發郵件通知 ###<-------------------------------------------------------------- sub SMail { $name = $FORM{'name'}; $email = $FORM{'email'}; $ttl = $FORM{'title'}; $ttl2 = $title; if ( $FORM{'kflg'} eq '' ) { #(驚直修改 - 修正原程式的寄發郵件通知功能不支援一氣回覆) $comment = $FORM{'comment'}; } else { $comment = "$rcom\n(留言編號#$rno之回覆)"; } $comment =~ s/
/\n/g; if ($FORM{'resno'} ne "") { $ttl = "$sv_title"; } elsif ($FORM{'resno'} eq "" && $ttl eq "") { $ttl = "(無題)"; } $comment =~ s/<//g; $comment =~ s/,/\,/g; #(驚直加入 - 轉換半形逗號) if ($ttl eq "") { $ttl = "(無題)"; } #(驚直修改 - 原程式漏寫的一行) #(驚直修改 - 加入$ttlsubj變數用來放在信件標題使之更清晰) if ( $FORM{'kflg'} ne '' ) { #(驚直加入 - 一氣回覆時顯示的信件標題) $ttlsubj = "有一篇訪客使用「一氣回覆模式」寫入的留言已經灌進留言板嘍"; } else { if ($FORM{'resno'} eq "") { if ($ttl eq "(無題)") {$ttlsubj = "有一篇沒有標題的新留言已經寫在留言板上嘍";} else {$ttlsubj = "有一篇新的留言「$ttl」已經寫在留言板上嘍";} } else { if ($ttl eq "(無題)") {$ttlsubj = "有一篇訪客回覆、沒有標題的留言已經寫在留言板上嘍";} else {$ttlsubj = "有一篇訪客回覆的留言「$sv_title」已經寫在留言板上嘍";} } } if ( !($email) ) { $email = $smail_address ; } if ( $hiho == 1 ) { open(MAIL,"| $sendmail -s \"$ttlsubj\" -f \"$email\" $smail_address") || &error("寄信程式出了問題!"); #(驚直修改 - 信件標題改用$ttlsubj變數) } else { open(MAIL,"| $sendmail -t") || &error("寄信程式出了問題!"); print MAIL "X-Mailer: mkakikomitai Ver$ver\n"; #(驚直修改 - 改為程式名稱) print MAIL "To: $smail_address\n"; if ($FORM{'email'} ne "") { print MAIL "Reply-to: $name <$email>\n"; } #(驚直修改 - 加入對方名字,無提供電子郵箱則忽略) print MAIL "Subject: $ttlsubj\n"; #(驚直修改 - 信件標題改用$ttlsubj變數) print MAIL "Content-Transfer-Encoding: 8bit\n"; #(驚直修改 - 改為8bit傳送) print MAIL "Content-type: text/plain; charset=big5\n"; #(驚直修改 - 改為繁體中文語系標籤) } print MAIL "<<< $ttl2 >>>\n\n"; print MAIL "────────────────────────────────────────\n"; print MAIL "留言時間: $today\n"; print MAIL "訪客名字: $name\n"; if ($FORM{'email'} ne "") { print MAIL "電子郵箱: $email\n"; } #(驚直修改 - 無提供電子郵箱則忽略) if ($FORM{'hp'} ne "") { print MAIL "個人網站: http://$FORM{'hp'}\n"; } if ($FORM{'kflg'} eq '') { print MAIL "留言標題: $ttl\n"; } #(驚直修改 - 一氣回覆時不顯示標題) print MAIL "────────────────────────────────────────\n"; #(驚直修改 - 加入分隔橫線) print MAIL "$comment\n"; print MAIL "────────────────────────────────────────\n"; close(MAIL); } ###<-------------------------------------------------------------- ###<--- 密碼加密程序 ###<-------------------------------------------------------------- sub pass_enc { if ( $ango == 1 ) { $pass = crypt($_[0], $_[0]); } else { $pass = $_[0]; } } ###<-------------------------------------------------------------- ###<--- 檢查密碼 ###<-------------------------------------------------------------- sub pass_dec { if ( $ango == 1 ) { if ($_[0] ne '' && ( crypt($FORM{'pass'}, $_[0]) eq $_[0]) ) { return 0 ; } } else { if ($FORM{'pass'} eq $_[0]) { return 0 ; } } return 1; } ###<-------------------------------------------------------------- ###<--- 檢查過去記錄檔 ###<-------------------------------------------------------------- sub logchk { if ( $olddir ) { #如果要保留舊留言集,此資料夾必須存在 if ( !(opendir(DIR,"$olddir"))) { &error("儲存過去記錄檔的資料夾 ($olddir) 並不存在,請立即建立此資料夾。"); } @oldcnt = grep(/\.txt/,readdir(DIR)); $i = sprintf("%02d",$#oldcnt + 1) ; $oldfile = "$olddir$i" . ".txt" ; closedir(DIR) ; } } ###<-------------------------------------------------------------- ###<--- 顯示各人晉級狀態 ###<-------------------------------------------------------------- sub rankdisp { if ( !(open(IN,"$logfile2"))) { &error("晉級狀態記錄檔 ($logfile2) 讀取失敗。"); } while ( ) { ($n,$k) = split(/,/,$_); $k =~ s/\n//g; push(@RANKDATA,"$k,$n") ; } close(IN); @RANKDATA = sort { $a <=> $b } @RANKDATA ; @RANKDATA = reverse @RANKDATA ; &header ; #<<關閉視窗
\n"; #(驚直修改 - 改為關閉視窗) print "■■■ 各人晉級狀態 ■■■

\n"; print "
\n"; print "\n"; print "\n"; #(驚直修改 - 改變表格標題列的背景顏色) print "\n"; print "\n"; foreach ( @RANKDATA ) { ($k,$n) = split(/,/,$_); for ( $j = 0 ; $j <= $#rankno ; $j++ ) { if ( $k >= $rankno[$j] ) { $ranking = $rank[$j] ; $rank_idx = $j ; } } print "\n"; print "\n"; #(驚直修改 - 加入英文字形) print "\n"; } print "
留言者留言次數晉級狀態
$n$k$ranking


\n"; &footer ; #<<<顯示HTML頁尾 exit ; } ###<-------------------------------------------------------------- ###<--- 下載留言記錄檔 i001112 ###<-------------------------------------------------------------- sub download { print "Content-type: text/download; charset=big5\n\n"; #(驚直修改 - 加入繁體中文語系標籤) print "\n"; print "\n"; #(驚直修改 - 加入繁體中文語系識別語法) print "$title"; #<<>> #(驚直加入 - 下載回來的記錄檔也使用樣式表) print "\n"; #<<>> print "\n"; $wk = "bgcolor=\"$bgcolor\""; print "\n"; &view ; print "

\n"; &footer ; exit; }