", $skin_data); $tmp_formfoot = $form . $delimiter .$foot; changeForm($tmp_formfoot); changeFoot($tmp_formfoot, $oyacnt, $fin); if($_POST['mode'] == 'last') $tmp_formfoot = preg_replace("/
]*?>.*?<\/form>/is", "", $tmp_formfoot, 1); list($form, $foot) = explode($delimiter, $tmp_formfoot); print $head . $form; if($_POST['mode'] != "main"){ $foot = preg_replace("/.*?/s", "", $foot, 1); } if($_POST['mode'] == "form"){ print $foot; exit; } foreach ($lines as $line) { $dt = new dt($line); if($dt->no == $dt->oyano){$count++;} if($count < $start ) { continue; } if($count > $fin ) { break; } if($dt->no == $dt->oyano){ changeFootData($tmp_rfoot, $lastname, $lastdate, $rescnt); print $tmp_rfoot; $tmp_rheadfoot = $rhead . $delimiter . $rfoot; changeData($tmp_rheadfoot, $dt); list($tmp_rhead, $tmp_rfoot) = explode("$delimiter", $tmp_rheadfoot); print $tmp_rhead; $rescnt = 0; } else { $tmp_rbody = $rbody; changeData($tmp_rbody, $dt); print $tmp_rbody; $rescnt++; } $lastname = $dt->name; $lastdate = $dt->date; } if($count) { changeFootData($tmp_rfoot, $lastname, $lastdate, $rescnt); print $tmp_rfoot; } print $foot; } function setValue (&$str, $name, $value, $type) { if($type == 0){ $str = preg_replace("/(name=\"$name\")/","$1 value=\"$value\"",$str,1); } else if ($type == 1) { if(!$value) $value = '[^"]*?'; $str = preg_replace("/(name=\"$name\" value=\"$value\")/","$1 checked",$str,1); } else { $str = preg_replace("/(\n", $tmp_formfoot, 1); $tmp_formfoot = preg_replace("/.*?/s", $resstr, $tmp_formfoot, 1); if($Form_pos == "bottom" && !$ownskin) if(preg_match("/]*?>.*?<\/form>/is", $tmp_formfoot, $matches)) $tmp_formfoot = str_replace($matches[0],"",$tmp_formfoot); $tmp_formfoot = preg_replace("/.*?/s", "$matches[0]", $tmp_formfoot, 1); if($ownskin) $tmp_formfoot = str_replace("\$no\$", $_POST['no'], $tmp_formfoot); if($Re_sub) $tmp_formfoot = str_replace("name=\"sub\"", "name=\"sub\" value=\"$Re_sub{$_POST['free']}\"", $tmp_formfoot); changeForm($tmp_formfoot); list ($form, $foot) = explode($delimiter, $tmp_formfoot); foreach ($lines as $_) { $dt = new dt($_); if ($dt->oyano == $_POST['no']){ if($dt->no == $dt->oyano && !$flag){ $tmp_rheadfoot = $rhead . $delimiter .$rfoot; changeData($tmp_rheadfoot, $dt); list($rhead, $rfoot) = split($delimiter, $tmp_rheadfoot); changeFootData($rfoot,'','','');#<=================attention $bodies .= $rhead; $flag = 1; } else { $tmp_rbody = $rbody; changeData($tmp_rbody, $dt); $bodies .= $tmp_rbody; } } else if ($flag) { break; } } if(!$flag) Error("記錄不存在", 0); print $head; print $form; print $bodies; print $rfoot; print $foot; exit; } function CheckAndChanging() { global $Need_name, $Need_msg, $Need_mail, $Need_sub, $Need_url, $No_name, $No_sub, $check_use,$MasterName, $Mpass, $Max_name, $Max_sub, $Max_msg, $MASTER, $SU, $Free, $No_icon, $filename, $spname, $spwd; if($Need_name && !$_POST['name']){ Error("請輸入姓名", 0); } if($Need_msg && !$_POST['msg'] ){ Error("請輸入內容", 0); } if($Need_sub && !$_POST['sub']) { Error("請輸入主題", 0); } if($Need_mail && !$_POST['mail']){ Error("請輸入郵箱地址", 0); } if($Need_url && !$_POST['url'] ){ Error("請輸入網站地址", 0); } if($check_use && !$_POST['check_post']) { Error("請輸入驗證碼", 0); } if(!$_POST['name']){ $_POST['name'] = $No_name;} if(!$_POST['sub']) { $_POST['sub'] = $No_sub; } if(!$_POST['icon']){ $_POST['icon'] = $No_icon;} if ($check_use){ if($_POST['check_post'] != $_POST['check']){ Error("驗證碼錯誤", 0); } } if(strlen($_POST['name']) > $Max_name) { Error("姓名請在半角 $Max_name 字內", 0);} if(strlen($_POST['sub']) > $Max_sub) { Error("標題請在半角 $Max_sub 字內", 0);} if(strlen($_POST['msg']) > $Max_msg) { Error("內容請在半角 $Max_msg 字內", 0);} if(strlen($_POST['mail']) > 100) { Error("mail地址過長。", 0);} if(strlen($_POST['url']) > 200) { Error("url地址過長", 0);} if (get_magic_quotes_gpc()) { $_POST['name'] = stripslashes($_POST['name']); $_POST['sub'] = stripslashes($_POST['sub']); $_POST['msg'] = stripslashes($_POST['msg']); if(count($Free)){ foreach($Free as $f){ $_POST[$f[0]] = stripslashes($_POST[$f[0]]); } } } Tag(); while(list($key, $val) = each($_POST)) ChangeBr($_POST[$key]); reset($_POST); $_POST['url'] = preg_replace("/^http:\/\//","",$_POST['url'],1); if(preg_match("/^master/", $_POST['icon']) && !$MASTER){ Error("請勿使用管理員專用頭像");} while(list ($key, $val) = each($_FILES)) { if($MasterOnlyResUp && $_POST['no'] && !$MASTER && $_FILES[$key]['tmp_name']){ Error("只能由管理員上傳文件");} if($MasterOnlyUp && !$_POST['no'] && !$MASTER && $_FILES[$key]['tmp_name']){ Error("只能由管理員上傳文件");} }reset($_FILES); } function Write() { global $MASTER,$MasterOnlyRes, $MasterOnlyThre, $AvoidExpiration, $SU, $MasterOnlyUp, $MasterOnlyResUp,$File_check,$Usrsort, $Log_file, $Up_dir, $Upsort, $Datesort, $Max_thre, $Self, $AvoidExpiration, $Max_wait,$Free,$FileType,$MASTER,$Max_upsz,$Wrt_jump,$Res_jump,$Mail_func,$Mail_mode; $pasts = array(); $lines = array("a"); $times = time(); if($MasterOnlyRes && $_POST['no'] && !$MASTER){ Error("只能由管理員回復");} if($MasterOnlyThre && !$_POST['no'] && !$MASTER){ Error("只能由管理員留言");} CheckAndChanging(); $w_year = date("y"); $w_mon = date("m"); $w_day = date("d"); $w_week = date("w"); $w_hour = date("H"); $w_min = date("i"); $w_sec = date("s"); $w_year = ($Datesort && $_POST['year']) ? $_POST['year'] : $w_year; $w_mon = ($Datesort && $_POST['mon']) ? $_POST['mon'] : $w_mon; $w_day = ($Datesort && $_POST['day']) ? $_POST['day'] : $w_day; $w_day = sprintf("%02d", $w_day); $w_mon = sprintf("%02d", $w_mon); $w_year = sprintf("%02d", $w_year); if($Datesort && !$_POST['no']){ if(!DateExists($w_year+2000,$w_mon,$w_day)) Error("該日期不存在"); $w_week = GetWeek($w_year+2000,$w_mon,$w_day); } $w_date = "$w_year/$w_mon/$w_day/$w_week/$w_hour/$w_min/$w_sec/"; $w_dateline = "$w_year$w_mon$w_day$w_week$w_hour$w_min$w_sec"; #Lock(); $lines = file($Log_file); list(,$lastno, $oyacnt, $past_no, $last_sec, $last_ip,) = explode(",",array_shift($lines)); $lastno++; $oyano = !$_POST['no'] ? $lastno : $_POST['no']; $ip = getenv("REMOTE_ADDR"); $host = gethostbyaddr($ip); if(!$MASTER && $last_ip == $ip && ($waitsec = ($Max_wait - $times + $last_sec)) > 0){ Error("灌水限制:請在 $waitsec 秒後再發新帖"); } $rand = sprintf("%05d",rand(0,100000)); for($i=1; $i<=3; $i++){ $ext =''; if($_FILES[$i]['tmp_name']){ if(count($FileType)){ foreach($FileType as $ft){ if(preg_match("/\.($ft)$/i",$_FILES[$i]['name'])){ $ext = $ft; break; } }} if(!$ext) Error("請勿上傳未被允許上傳的文件格式"); if($_FILES[$i]['size']/1024>$Max_upsz)Error("上傳文件大小請控制在 $Max_upsz KB 內{$_FILES[$i]['size']}"); list($w, $h, $type, $attr) = getimagesize($_FILES[$i]['tmp_name']); if( $type < 1 || $type > 3){ $w = $h = -1; } $img[$i] = "$ext/$w/$h"; if(!move_uploaded_file($_FILES[$i]['tmp_name'], "$Up_dir$lastno-$i-$rand.$ext")){ Error("{$_FILES[$i]['tmp_name']}無效"); } } } for($i=0; $i", $line); $dateline = join('', explode('/',$date)); if($w_dateline >= $dateline && $no == $oyano) break; $cnt++; } array_splice($lines, $cnt, 0, $new_line); } if(count($lines) > $Max_thre){ while(1){ $line = array_pop($lines); list ($no, $oyano) = explode("<>", $line); array_unshift($pasts, $line); if($no == $oyano){ $inc--; if(count($lines) <= $Max_thre || !count($lines)) break; } } } $oyacnt += ++$inc; } else { if($Usrsort && !$Datesort){ $Upsort = ($_POST['upsort'] == '') ? $Upsort : $_POST['upsort']; } if($Upsort) { $linecnt = count($lines); $moves = array(); for($i=0; $i<$linecnt; $i++){ list($no, $oyano) = explode("<>", $lines[$i]); if($oyano == $_POST['no']){ array_push($moves, $lines[$i]); $lines[$i] = ''; $flag = 1; } else if ($flag) { break; } $cnt++; } if(!$flag) Error('找不到記錄'); array_push ($moves, $new_line); array_splice($lines, 0, 0, $moves); } else { foreach($lines as $line){ list($no, $oyano) = explode("<>", $line); if($oyano == (int) $_POST['no']){ $flag = 1; } else if ($flag) { break; } $cnt++; } if(!$flag) Error('找不到記錄'); array_splice($lines, $cnt, 0, $new_line); } } $past_no = MakePast($pasts, $past_no); array_unshift ($lines, "\n"); $fp = fopen("$Log_file", "wb"); foreach ($lines as $_) { fputs($fp, $_);} fclose($fp); # Unlock(); if($Mail_func && ($Mail_mode || !$MASTER) ){ sendmail("$ip ($host)"); } $expire = time() + 3600 * 24 * 30; @setcookie("name", $_POST['name'], $expire); @setcookie("url", $_POST['url'], $expire); @setcookie("mail", $_POST['mail'], $expire); @setcookie("color", $_POST['color'],$expire); @setcookie("icon", $_POST['icon'], $expire); @setcookie("pass", $_POST['pass'], $expire); $_COOKIE['name'] = $_POST['name']; $_COOKIE['url'] = $_POST['url']; $_COOKIE['mail'] = $_POST['mail']; $_COOKIE['color'] = $_POST['color']; $_COOKIE['icon'] = $_POST['icon']; $_COOKIE['pass'] = $_POST['pass']; if(count($Free)){ foreach($Free as $f){ @setcookie($f[0], $_POST[$f[0]], $expire); $_COOKIE['$f[0]'] = $_POST[$f[0]]; } } if($SU){ if($AvoidExpiration){ header("Location: $Self?mode=master&page={$_POST['page']}&epass={$_POST['epass']}&su=1\n\n"); exit(0); } Master(); } if($_POST['no'] && $Res_jump){ if($Res_jump == 'res') {res(); exit;} header("Location: $Res_jump"); exit; } if($Wrt_jump){ header("Location: $Wrt_jump"); exit; } if($AvoidExpiration){ header("Location: $Self"); exit; } } function sendmail($host){ global $Mailto, $Selfname; $tmpmessage = preg_replace("/
/i", "\n", $_POST['msg']); $subject = "[ $Selfname ] {$_POST['sub']}"; $message = <<", $lines[$j]); if($no == $del || ($oyano == $del && $flag)){ if(decry($_POST['pass'],$pass) || $MASTER){ $flag = $find = 1; if($SU || $CompleteDel){ $lines[$j] = ""; if($oyano == $no) $dec++; } else { $lines[$j]="$no<>$oyano<><>///////<><><>(內容已刪除)<><><><><>none.gif<><><><>\n"; $flag=0; } $error=0; for($i=0;$i<=3;$i++){ list ($ext,,) = split("/",$img[$i]); if($ext) {unlink("$Up_dir$no-$i-$rand.$ext");} }#------------------------------------------------ } } } if(!$find){ Error("找不到記錄");} if($error){ Error("密碼錯誤");} $h = array(); $h = split(",",$head); $h[2] -= $dec; array_unshift ($lines, join(',',$h)); $fp = fopen("$Log_file", "wb"); foreach ($lines as $_) { fputs($fp, $_);} fclose($fp); # Unlock(); if($SU) { Master();} if($Del_jump) { header("Location: $Del_jump"); exit; } } function Edit() { global $MasterOnlyEdit, $MASTER, $Log_file, $SU; $flag = 0; $lines = array(); if($MasterOnlyEdit && !$MASTER){ Error("只能由管理員進行修改"); } # Lock(); $lines = file("$Log_file"); for ($j=1; $jno != $_POST['no']) continue; if(!decry($_POST['pass'], $dt->pass) && !$MASTER) {Error("密碼錯誤");} if($_POST['mode'] == 'edit'){ if(!$SU){ Editform($dt); } else { MasterEditform($dt); } } else { EditWrite($lines, $j, $dt); $flag=1; break; } $flag = 1; } if (!$flag){ Error("未找到 No.{$_POST['no']} 的記錄"); } } function Editform(&$dt) { global $Self, $Skin_edit, $Img_dir, $Max_up, $check_use, $Auto_Eskin, $Delfile_view, $Use_Extracut, $Free, $Ctype, $Itype, $Eskin_from, $Edit_back, $Edit_target; $back = (!$Edit_back) ? "$Self" : $Edit_back; $from = ($Eskin_from) ? $Eskin_from : 'edit'; $ownskin = ($from == 'edit'); $editstr = "

Edit No.{$_POST['no']}"; if($Edit_target) {$editstr .= "[ back ]";} $editstr .= "

"; for($i=1;$i<=$Max_up;$i++) { if($dt->img[$i]){ list ($ext, $w, $h ) = explode("/", $dt->img[$i]); $img_del_txt[$i] .= "刪除 "; if($Delfile_view){ $img_del_txt[$i] .= "[no-$i-$dt->rand.$ext\" target=\"_blank\">view] ";} } } $skin_data = openSkin($from); list ($head, $form, $rhead, $rbody, $rfoot, $foot) = explode("", $skin_data); $tmp_formfoot = $form . $foot; $tmp_formfoot = preg_replace("/(name=\"mode\" value=)\"write\">/i", "$1\"ewrite\">\nno}\">\n", $tmp_formfoot, 1); $tmp_formfoot = preg_replace("/.*?/s", $editstr, $tmp_formfoot, 1); $tmp_formfoot = preg_replace("/.*?/s", "", $tmp_formfoot, 1); $tmp_formfoot = str_replace ("\$self\$", $Self, $tmp_formfoot); if ($check_use){ $checkpass0 = mt_rand(0, 9); $checkpass1 = mt_rand(0, 9); $checkpass2 = mt_rand(0, 9); $checkpass3 = mt_rand(0, 9); $checkpass4 = mt_rand(0, 9); $checkpass = $checkpass0 . $chekckpass1 . $checkpass2 . $checkpass3 . $checkpass4 ; $tmp_formfoot = str_replace("\$checkpass\$", $checkpass, $tmp_formfoot); } if($Use_Extracut) $tmp_formfoot = preg_replace("/.*?/s", "", $tmp_formfoot); if($ownskin) $tmp_formfoot = str_replace("\$no\$", $_POST['no'], $tmp_formfoot); $dt->msg = str_replace("
", "\n", $dt->msg); $str = str_replace("\$self\$",$Self,$str); setValue($tmp_formfoot, "name", $dt->name, 0); setValue($tmp_formfoot, "sub", $dt->sub, 0); setValue($tmp_formfoot, "url", "http://{$dt->url}",0); setValue($tmp_formfoot, "mail", $dt->mail, 0); setValue($tmp_formfoot, "color", $dt->color, $Ctype); setValue($tmp_formfoot, "icon", $dt->icon, $Itype); setValue($tmp_formfoot, "pass", $_POST['pass'], 0); $tmp_formfoot = str_replace(">", ">{$dt->msg}", $tmp_formfoot); for($i=1; $i<=$Max_up; $i++) { $tmp_formfoot = str_replace("", $img_del_txt[$i], $tmp_formfoot); } if(count($Free)){ $i = 0; $frees = array(); if($dt->freeline){ $frees = explode("\t", $dt->freeline); } foreach($Free as $f){ setValue($tmp_formfoot, $f[0], $frees[$i], $f[1]); $i++; } } print $head . $tmp_formfoot; # Unlock(); exit; } function EditWrite (&$lines, $j, &$dt) { global $Self, $Log_file, $Up_dir, $Free, $AvoidExpiration, $SU,$FileType,$Max_up,$MASTER,$Max_upsz,$Edit_jump,$File_check; $mode = ($_POST['mode'] == 'ewrite') ? 1 : 0; $rand = time(); if($mode){ CheckAndChanging(); for($i=1;$i<=$Max_up;$i++){ $ext =''; if($_POST["delimg-$i"]||$_FILES[$i]['tmp_name']){ list($ext,,) = explode("/", $dt->img[$i]); @unlink("$Up_dir{$dt->no}-$i-{$dt->rand}.$ext"); } $ext = ''; if($_FILES[$i]['tmp_name']){ if(count($FileType)){ foreach($FileType as $ft){ if(preg_match("/\.($ft)$/i",$_FILES[$i]['name'])){ $ext = $ft; break; } }} if(!$ext) Error("請勿上傳未被允許上傳的文件格式"); if($_FILES[$i]['size']/1024>$Max_upsz)Error("上傳文件大小請控制在 $Max_upsz KB 內"); list($w, $h, $type, $attr) = getimagesize($_FILES[$i]['tmp_name']); if( $type < 1 || $type > 3){ $w = $h = -1; } $img[$i] = "$ext/$w/$h"; if(!move_uploaded_file($_FILES[$i]['tmp_name'], "$Up_dir$dt->no-$i-$dt->rand.$ext")){ Error("{$_FILES[$i]['tmp_name']}無效"); } } else { $img[$i] = $_POST["delimg-$i"] ? '' : $dt->img[$i]; } } for($i=0; $iaccept)); $lines[$j] = "{$dt->no}<>{$dt->oyano}<>{$dt->pass}<>{$dt->date}<>{$_POST['sub']}<>{$_POST['name']}<>{$_POST['msg']}<>{$_POST['mail']}<>{$_POST['url']}<>{$_POST['color']}<>{$_POST['icon']}<>$freeline<>{$img[1]}<>{$img[2]}<>{$img[3]}<>$dt->rand<>$accept<>{$dt->close}<>{$dt->ip}<><>\n"; } else { $lines[$j] = "{$dt->no}<>{$dt->oyano}<>{$dt->pass}<>{$dt->date}<>{$dt->sub}<>{$dt->name}<>{$dt->msg}<>{$dt->mail}<>{$dt->url}<>{$dt->color}<>{$dt->icon}<>$freeline<>{$dt->img[1]}<>{$dt->img[2]}<>{$dt->img[3]}<>{$dt->rand}<>{$_POST['free']}<>{$dt->close}<>{$dt->ip}<><>\n"; } $fp = fopen("$Log_file", "wb"); foreach ($lines as $line) { fputs($fp, $line);} fclose($fp); # Unlock(); if($SU){ if($AvoidExpiration){ header("Location: $Self?mode=master&page={$_POST['page']}&epass={$_POST['epass']}&su=1\n\n"); exit(0); } else { Master(); } } if($Edit_jump) { header("Location: $Edit_jump");exit; } if($AvoidExpiration){ header("Location: $Self"); exit; } else { Index(); exit; } } function decry($a, $b) { if(crypt($a, $b) == $b) return 1; else return 0; } function MasterHead() { global $m_font_c, $m_font, $m_font_sz, $m_bgc, $m_txt_bgc,$m_bdr_c; print << EOT; } function Master() { global $MASTER, $M_View, $SU, $Up_dir, $Log_file, $m_tbl_bgc,$m_tbl_tbgc; if (!$MASTER) Error("密碼錯誤"); if (!$SU && $_POST['editedit']) $e=0; $start = $M_View * $_POST['page']; $fin = $start + $M_View - 1; MasterHead(); Masterform(new dt(""), 0); $files = array(); $dir = opendir($Up_dir); while($tmp = readdir($dir)){ array_push($files, $tmp); } closedir($dir); array_shift($files); array_shift($files); foreach($files as $file){$img_sz += filesize("$Up_dir$file")/1000;} $log_sz = filesize("$Log_file")/1000; print <<
記錄檔當前大小: $log_sz KB    [ 重新排列記錄檔 ]
上傳文件當前大小: $img_sz KB
EOT; $lines = file($Log_file); array_shift($lines); $i = 0; foreach ($lines as $_) { $dt = new dt($_); if($dt->no == $dt->oyano){$count++;} if($count < $start ) { continue; } if( $count > $fin ) { break; } if($dt->no == $dt->oyano){ if($count>1){ print "\n"; } MasterTable($dt, 1); } else { MasterTable($dt, 0); } } print "
No Del Edit 主題 姓名
(ip)
內容 上傳文件 瀏覽
回復
1 2 3 許可
"; $next_page = $_POST['page'] + 1; $prev_page = $_POST['page'] - 1; print "

"; if($_POST['page']>0){ print "<< 上一頁  "; } if($count>$fin){ print "  下一頁 >>"; } print "


"; print ""; print "



"; print "
Script * Chinese by Snow*stop\n"; exit; print "

\n\n"; exit; } function MasterTable (&$dt, $flag) { global $Img_dir, $Re_sub, $m_tbl_bgc, $m_tbl_rbgc, $Str_week; $dt->msg = str_replace("
", " ", $dt->msg); $dt->msg = htmlspecialchars($dt->msg); cutStr($dt->msg, 50); cutStr($dt->sub, 10); list ($year, $mon, $day, $week, $hour, $min, $sec) = explode("/", $dt->date); list ($dt->ip) = explode(",", $dt->ip); $res = ($flag) ? "no','{$_POST['page']}','$Re_sub{$dt->sub}')\">詳細" : "↑"; $col = ($flag) ? $m_tbl_bgc : $m_tbl_rbgc; print ""; print "{$dt->no}"; print "no}','{$_POST['page']}','');\">Del"; print "no}','{$_POST['page']}','')\">Edit"; print "{$dt->sub}{$dt->name}
({$dt->ip}) {$dt->msg}
($year.$mon.$day)"; print ""; if($dt->img[1]){list($a,$w) = split("/",$dt->img[1]);print "no-1-$dt->rand.$a\" target=\"_blank\">";print $w>0 ? "○" : "□"; print "";} print""; print ""; if($dt->img[2]){list($a,$w) = split("/",$dt->img[2]);print "no-2-$dt->rand.$a\" target=\"_blank\">";print $w>0 ? "○" : "□"; print "";} print""; print ""; if($dt->img[3]){list($a,$w) = split("/",$dt->img[3]);print "no-3-$dt->rand.$a\" target=\"_blank\">";print $w>0 ? "○" : "□"; print "";} print""; print ""; if(!$dt->accept && ($dt->img[1]||$dt->img[2]||$dt->img[3])){ print "no}','{$_POST['page']}','1')\">未"; } else if(($dt->img[1]||$dt->img[2]||$dt->img[3]) ){ print "no}','{$_POST['page']}','0')\">?"; } print ""; print "$res"; print ""; } function Masterform(&$dt, $nre) { global $Datesort, $Cbox, $Ibox, $Str_week, $Img_dir, $Self, $Mas_back, $Mas_target,$Self,$check_use; $back = (!$Mas_back) ? $Self : $Mas_back; if ($check_use){ $checkpass0 = mt_rand(0, 9); $checkpass1 = mt_rand(0, 9); $checkpass2 = mt_rand(0, 9); $checkpass3 = mt_rand(0, 9); $checkpass4 = mt_rand(0, 9); $checkpass = $checkpass0 . $chekckpass1 . $checkpass2 . $checkpass3 . $checkpass4 ; } if($nre == 2){//edit for($i=1; $i<=3; $i++){ list($ext,,) = explode("/", $dt->img[$i]); $img_del_txt[$i] = $ext ? "[no-$i-$dt->rand.$ext\" target=\"_blank\">view]刪除" : ""; } list($year,$mon,$day) = explode("/",$dt->date); $writemode = "ewrite"; } else {//normal and respons $dt->name =$_COOKIE['name']; $dt->sub =$Re_sub . $_POST['free']; $dt->mail =$_COOKIE['mail']; $dt->url =$_COOKIE['url']; $dt->color =$_COOKIE['color']; $dt->icon =$_COOKIE['icon']; $year = date("y"); $mon = date("m"); $day = date("d"); $writemode = "write"; } if($nre > 0 ){//edit and res print "[ back ]"; } else {//normal print "[ Back to Rayboard ]"; } print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; if($nre > 0){ print "\n"; } print ""; if($Datesort){ if($nre == 2) { print "\n";} else { print "\n";} } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ""; print ""; if ($check_use){ print ""; } print "\n
修改記錄 $year.$mon.$day [$no]
Date
Namename}\">
Titlesub}\">
使用html語法
Mailmail}\">
Urlurl}\">
{$img_del_txt[1]}
{$img_del_txt[2]}
{$img_del_txt[3]}
Color"; if(count($Cbox)){ foreach ($Cbox as $cbox) { print "color){print " checked";} print ">"; } } print "
Icon"; print "
驗證碼 $checkpass
\n
\n"; } function MasterResform() { global $Log_file, $Max_up, $Img_dir, $m_tbl_bgc, $m_tbl_rbgc,$Str_week; $lines = array(); $lines = file("$Log_file"); array_shift($lines); MasterHead(); $flag = 0; print "
"; foreach ($lines as $_ ) { $dt = new dt($_); for($j=1;$j<=3;$j++){ list ($ext[$j], $w[$j], $h[$j]) = explode("/",$dt->img[$j]); reviseSize($w[$j], $h[$j], $gomi); } list ($year, $mon, $day, $week, $hour, $min,$sec) = explode("/",$dt->date); if ($dt->oyano == $_POST['no']){ if($dt->no == $dt->oyano && !$flag){ print "
\n"; print "姓名:$dt->name ($dt->ip)
主題: $dt->sub
郵箱: $dt->mail
網站: http://$dt->url
日期: 20$year/$mon/$day ($Str_week[$week]) $hour:$min:$sec

$dt->msg\n
\n"; for($j=1;$j<=$Max_up; $j++){ if($dt->img[$j]) print "no-$j-$dt->rand.$ext[$j] width=$w[$j] height=$h[$j]> "; } print "

\n"; $flag=1; } else { print "
 \n"; print "姓名: $dt->name ($dt->ip)
日期 : 20$year/$mon/$day ($Str_week[$week]) $hour:$min:$sec
標題 : $dt->sub
郵箱 : $dt->mail
網站 : http://$dt->url

{$dt->msg}\n
\n"; for($j=1; $j<=$Max_up; $j++){ if($dt->img[$j]) print "no-$j-$dt->rand.$ext[$j] width=$w[$j] height=$h[$j]> "; } print "

\n"; } } elseif ($flag) { break; } } print "
\n"; Masterform(new dt(""), 1); exit; } function DateExists($year,$mon,$day) { if($year<1 || $day<1){Error("數值錯誤");} if($mon==1 || $mon==3 || $mon==5 || $mon==7 || $mon==8 || $mon==10 || $mon==12){ if($day<32){return 1;} }elseif ($mon==4 || $mon==6 || $mon==9 || $mon==11){ if($day<31){return 1;} }elseif($mon==2){ if(!($year % 4)){ if($day<30){return 1;} }else { if($day<29){return 1;} } }else{return 0;} return 0; } function GetWeek($year,$mon,$day) { if($year == 1582) { if($mon < 10) { return -1; } elseif($mon == 10) { if($day < 15) { return -1; } } } elseif($year < 1582) { return -1; } if($mon == 1 || $mon == 2) { $year --; $mon += 12; } $week = ($year + intval($year/4) - intval($year/100) + intval($year/400) + intval((13*$mon+8)/5) + $day) % 7; return $week; } /*function Lock() { global $LOCK, $Lock_file; $LOCK=fopen("$Lock_file","w"); if(!flock($LOCK, 2)) Error("Lock is busy.."); }*/ /*function Unlock() { global $LOCK; fclose($LOCK); }*/ function ChangeBr(&$str) { $str = str_replace("\r\n","
",$str); $str = str_replace("\r","
",$str); $str = str_replace("\n","
",$str); } function Tag() { global $Tag_accept, $SU; while(list ($key, $val) = each($_POST)) if(!($Tag_accept || $_POST['tag'] && $SU)) $_POST[$key] = htmlspecialchars($_POST[$key]); reset($_POST); } function MakePast ($past, $past_no) { global $Past_func, $Past_dir, $Max_psize; $plines = array(); if(!$Past_func || !count($past)){ return $past_no; } $past_file = $Past_dir . $past_no . ".php"; if (@filesize($past_file) > $Max_psize * 1024) { $past_no++; $past_file = "$Past_dir$past_no.php"; } if (file_exists($past_file)){ $plines = file($past_file); } else { array_push($past, "\n"); } $plines = array_merge($past, $plines); $fp = fopen("$past_file", "wb"); foreach ($plines as $_) { fputs($fp, $_);} fclose($fp); return $past_no; } function Admin() { global $Mpass, $MASTER, $JumpPass; if($_COOKIE['pass'] && $Mpass == $_COOKIE['pass'] && $JumpPass){ $MASTER=1; $_POST['epass'] = crypt($Mpass); Master(); } MasterHead(); print "[ Back ]"; print "
管理員登陸

"; print "
\n"; print "Pass

"; print "

















Chinese & Edit by Snow*stop
"; exit; } function Searchform($files, &$str) { global $Self, $Past_dir, $Log_file; $select = ($_POST['log'] == 'log') ? "selected" : ""; $check1 = ($_POST['cond'] == 'and') ? "selected" : ""; $check2 = ($_POST['cond'] == 'or') ? "selected" : ""; $matches= array(); $str .= "

"; $str .= ""; $str .= "範圍"; $str .= "  條件"; $str .= "

關鍵字 "; $str .= "
"; } function SearchView() { global $Srch_View, $Skin_srch, $Log_file, $Past_dir, $Self, $Sskin_from, $Match_c, $Use_Extracut, $Srch_back, $Srch_target; $count = 0; $skin_data; $mode = (!$_POST['word']) ? 0 : ((!$_POST['no']) ? 1 : 2); $from = ($Sskin_from) ? $Sskin_from : 'search'; $ownskin = ($from == 'search'); $start = $Srch_View * ($_POST['page']) + 1; $fin = $start + $Srch_View -1;#?????????????? $lines = array(); $strs = array(); $files = array(); $delimiter = time(); if(preg_match("/^(\d+)$/", $_POST['log'], $matches)){ $srh_log = $Past_dir . $matches[0] . ".php"; } else if ($_POST['log']) { $srh_log = $Log_file; } $skin_data = openSkin($from); list ($head, $form, $rhead, $rbody, $rfoot, $foot) = explode("", $skin_data); $_POST['word'] = htmlspecialchars($_POST['word']); $_ = $_POST['word']; $_ = preg_replace("/ +/", " ", $_); $_ = preg_replace("/ +/", " ", $_); $strs = explode(" ", $_); if($mode == 1){ if($srh_log && file_exists($srh_log)){ $fp = fopen($srh_log,"r"); if($srh_log == $Log_file){fgets($fp, 9182);} } else {/* Error("打開失敗 {$_POST['log']}");*/} while (!feof($fp) && $tmp = fgets($fp, 9182)){ $flag = 0; if(count($strs)) foreach ($strs as $str) { if(strstr($tmp, $str) != false){ $flag=1; if($_POST['cond'] =='or'){ break; } } else if ($_POST['and'] == 'and') { $flag=0; break; } } if($flag){ array_push($lines, $tmp); $flag=0;} } fclose($fp); if($srh_log != $Log_file) array_pop($lines); } else { if($srh_log && file_exists($srh_log)){ $lines = file($srh_log); if($srh_log == $Log_file){ array_shift($lines); } else { array_pop($lines); } } else { /*Error("打開失敗 {$_POST['log']}");*/} } $finds = count($lines); $dir = opendir($Past_dir); while($tmp = readdir($dir)){ array_push($files, $tmp); } sort($files,SORT_NUMERIC); closedir($dir); print $head; $tmp_formfoot = $form . $delimiter .$foot; if(!$ownskin){ $back = (!$Srch_back) ? $Self : $Srch_back; $tmp_formfoot = preg_replace("/(
]*?>.*?<\/form>)/is", "", $tmp_formfoot, 1); $tmpstr = "

"; if($Srch_target){ $tmpstr .= "[ 返回 ]"; if($mode == 2){ $tmpstr .= "  [ 返回搜索結果 ]"; $tmp_formfoot = preg_replace("/.*?/s", "", $tmp_formfoot, 1); } } Searchform($files, $tmpstr); if($mode == 1){ $tmpstr .= "

符合條件的有 $finds

"; } else if($mode == 2) { $tmpstr .= "

No.{$_POST['no']}

"; } if($Use_Extracut) $tmp_formfoot = preg_replace("/.*?/s", "", $tmp_formfoot); $tmp_formfoot = preg_replace("/.*?/s", $tmpstr, $tmp_formfoot, 1); list($form, $foot) = split($delimiter, $tmp_formfoot); print $form; } else { SearchformChanging($form); } $rescnt = 0; $lastname ; $bodies; if(count($lines)){ foreach($lines as $line){ $dt = new dt($line); if($mode == 2 && $_POST['no'] != $dt->oyano) { continue; } if($mode == 1 || $dt->no == $dt->oyano) { $count++; } if($mode != 2 && ($count < $start || $count > $fin)){ continue; } if($dt->no == $dt->oyano || $mode == 1){ if($mode == 1){ $dt->msg .= "

[oyano}&log={$_POST['log']}&page={$_POST['page']}\">相關留言]"; if($dt->no != $dt->oyano){ $dt->sub = "Re:{$dt->oyano} - " . $dt->sub; } } changeFootData($tmp_rfoot, $lastname, $lastdate, $rescnt); $bodies .= $tmp_rfoot; $tmp_rheadfoot = $rhead . $delimiter . $rfoot; changeData($tmp_rheadfoot, $dt); list ($tmp_rhead, $tmp_rfoot) = explode($delimiter, $tmp_rheadfoot); $bodies .= $tmp_rhead; } else { $tmp_rbody = $rbody; changeData($tmp_rbody, $dt); $bodies .= $tmp_rbody; $rescnt++; } $lastname = $dt->name; $lastdate = $dt->date; } } if($count) { changeFootData($tmp_rfoot, $lastname, $lastdate, $rescnt); $bodies .= $tmp_rfoot; } if($Match_c) if(count($strs)){ $bodies = mb_convert_encoding($bodies,"EUC-JP","SJIS"); foreach($strs as $str){ if($str){ $str = mb_convert_encoding($str,"EUC-JP","SJIS"); $bodies = preg_replace("/((?:\G|>)[^<]*?)$str/","$1$str",$bodies); } } $bodies = mb_convert_encoding($bodies,"SJIS","EUC-JP"); } print $bodies; changeFoot($foot, $count, $fin); print $foot; exit; } function SearchformChange($sForm, $fileline,$finds){ global $Log_file, $Past_dir, $Self; preg_match("/