", $message_bk); //\n除去して
*/ $message_bk = ereg_replace("<", "<", $message_bk); $message_bk = ereg_replace(">", ">", $message_bk); $message_bk = ereg_replace("
", "\n", $message_bk); //Win系は\n $message_bk = ereg_replace("
", "\r", $message_bk); //Mac系は\r // // 本体 // $fp=fopen ($layout_html,"r"); while (1) { $str=fgets($fp,256); if ($str == false) { break; } else { if(ereg("%BBS%", $str)){ view(); } else{ if(ereg("%name_bk%", $str)){ $str=eregi_replace("\%name_bk\%",$name_bk,$str); } if(ereg("%message_bk%", $str)){ $str=eregi_replace("\%message_bk\%",$message_bk,$str); } $str=eregi_replace("\%bbsname\%",$bbsname,$str); $str=eregi_replace("\%bbsurl\%",$bbsurl,$str); echo $str; } } } fclose($fp); exit; // // 発言表示部分 // function view() { global $layout_sub_html,$constr,$table1,$table2,$view,$begin,$id,$keyword,$kind,$max; $pid=pg_connect ($constr); if (!$pid) { echo "只今システム障害のため、一時的にメンテナンスを実施しております。
ご迷惑おかけしますが復旧まで今暫くお待ちください。

"; } else{ // $sql = "SELECT * FROM $table1 AS A WHERE flg !='1'"; $sql = "SELECT * FROM $table1 WHERE flg !='1'"; // // 発言総数の取得 // if($kind=="1"){ $sql .= " AND resflg='1'"; } if(empty($keyword)!=TRUE){ // // 複数キーワードかを判定する // $keyword = ereg_replace(" ", " ", $keyword); $keyword = ereg_replace(" ", " ", $keyword); $keyword = ereg_replace(" ", " ", $keyword); $keyword = ereg_replace(" ", " ", $keyword); $keyword = ereg_replace(" ", " ", $keyword); $searchcount = substr_count("$keyword", " "); if(empty($searchcount)==TRUE){ $keyword = mb_convert_encoding($keyword, "EUC", "SJIS"); $tempsql .= " AND (name like '%$keyword%' OR comment like '%$keyword%')"; } else{ $temp = split(" ", "$keyword"); for ($k = 0; $k <= $searchcount; $k++) { $temp[$k] = mb_convert_encoding($temp[$k], "EUC", "SJIS"); $tempsql .= " AND (name like '%$temp[$k]%' OR comment like '%$temp[$k]%')"; } } } $sql .= "$tempsql"; // $sql .= " OR EXISTS (SELECT id FROM $table2 AS B WHERE flg!='1' AND A.id = B.parentid $tempsql)"; $rtn=pg_exec ($pid,"$sql"); $all = pg_numrows ($rtn); pg_freeresult ($rtn); if (empty($begin)==true) { $begin=0; $number=$all; } else{ $number=$all-$begin; } $value2=$begin+$view; // 総ページ数の計算 $allpage = (int)($all / $view); $allpage+=1; // 現在のページの計算 $nowpage = ($value2 / $view); // // 発言情報の取得 // $sql2 = "$sql"; $sql2 .= " ORDER BY turn desc,id desc limit $view offset $begin"; $rtn=pg_exec ($pid,"$sql2"); $row = pg_numrows ($rtn); $i = "0"; if ($row == "0") { echo "




検索条件にHITしませんでした。


"; echo "


"; } else{ while ($i<$row) { $data = pg_fetch_array ($rtn,$i); $id = $data[id]; $name = mb_convert_encoding($data[name], "SJIS", "EUC-JP"); $time = mb_convert_encoding($data[time], "SJIS", "EUC-JP"); $comment = mb_convert_encoding($data[comment], "SJIS", "EUC-JP"); $urltext1 = mb_convert_encoding($data[urltext1], "SJIS", "EUC-JP"); $urltext2 = mb_convert_encoding($data[urltext2], "SJIS", "EUC-JP"); $urltext3 = mb_convert_encoding($data[urltext3], "SJIS", "EUC-JP"); if(empty($keyword)!=TRUE){ if(empty($searchcount)==TRUE){ $keywordtemp = mb_convert_encoding($keyword, "SJIS", "EUC"); $comment = str_replace("$keywordtemp", "$keywordtemp", $comment); } else{ $temp = split(" ", "$keyword"); for ($k = 0; $k <= $searchcount; $k++) { $comment = str_replace("$temp[$k]", "$temp[$k]", $comment); } } } if (empty($data[icon])==TRUE) { $icon = ""; } else { $icon = ""; } if (empty($data[url])==TRUE) { $url = ""; } else { if (empty($data[urltext1])==TRUE) { $url = "$data[url]
"; } else{ $url = "$urltext1
"; } } if (empty($data[url2])==TRUE) { $url2 = ""; } else { if (empty($data[urltext2])==TRUE) { $url2 = "$data[url2]
"; } else{ $url2 = "$urltext2
"; } } if (empty($data[url3])==TRUE) { $url3 = ""; } else { if (empty($data[urltext3])==TRUE) { $url3 = "$data[url3]
"; } else{ $url3 = "$urltext3
"; } } $kazu=($i)%2; $number2 = number_format($number); $fp2=fopen ($layout_sub_html,"r"); while (1) { $str=fgets($fp2,256); if ($str == false) { break; } else { $str=eregi_replace("\%NUMBER\%",$number2,$str); $str=eregi_replace("\%ID\%",$id,$str); $str=eregi_replace("\%ICON\%",$icon,$str); $str=eregi_replace("\%DATA\%",$time,$str); $str=eregi_replace("\%NAME\%",$name,$str); $str=eregi_replace("\%MESSEGE\%",$comment,$str); $str=eregi_replace("\%URL\%",$url,$str); $str=eregi_replace("\%URL2\%",$url2,$str); $str=eregi_replace("\%URL3\%",$url3,$str); if($kazu=="1"){ $str=eregi_replace("\%IMG\%","bbs_sqare01.gif",$str); $str=eregi_replace("\%BGCOLOR\%","#f0e4c9",$str); } else{ $str=eregi_replace("\%IMG\%","bbs_sqare02.gif",$str); $str=eregi_replace("\%BGCOLOR\%","#d6e3d1",$str); } if(ereg("%RES%", $str) && $data[resflg]=="1"){ view2(); $str=eregi_replace("\%RES\%",$nossing,$str); } else{ $str=eregi_replace("\%RES\%",$nossing,$str); } echo $str; } } fclose($fp2); $i++; $number--; } $value2=$begin+$view; $keyword = mb_convert_encoding($keyword, "SJIS", "EUC-JP"); if ($value2 > $view) { $value3=$begin-$view; echo "<[前の $view 件]>"; } if($allpage < $max){ $maxpage = $allpage; } else{ $maxpage = $max; } for($j=1; $j<=$maxpage; $j++){ $next = ($j-1)*$view; echo "[$j] "; } if ($i >= $view) { echo "<[次の $view 件]>"; } } } } // // レス発言表示部分 // function view2() { global $layout_res_html,$table2,$id,$constr,$keyword; $pid=pg_connect ($constr); if (!$pid) { //echo "失敗"; echo ""; } // // 発言情報の取得 // $rtn2 = pg_exec ($pid,"SELECT * FROM $table2 WHERE flg !='1' AND parentid='$id' ORDER BY id;"); $row2 = pg_numrows ($rtn2); $j = "0"; while ($j<$row2) { $data2 = pg_fetch_array ($rtn2,$j); $name = mb_convert_encoding($data2[name], "SJIS", "EUC-JP"); $time = mb_convert_encoding($data2[time], "SJIS", "EUC-JP"); $comment = mb_convert_encoding($data2[comment], "SJIS", "EUC-JP"); $urltext1 = mb_convert_encoding($data2[urltext1], "SJIS", "EUC-JP"); $urltext2 = mb_convert_encoding($data2[urltext2], "SJIS", "EUC-JP"); $urltext3 = mb_convert_encoding($data2[urltext3], "SJIS", "EUC-JP"); if(empty($keyword)!=TRUE){ $searchcount = substr_count("$keyword", " "); if(empty($searchcount)==TRUE){ $keywordtemp2 = mb_convert_encoding($keyword, "SJIS", "EUC"); $comment = str_replace("$keywordtemp2", "$keywordtemp2", $comment); } else{ $temp2 = split(" ", "$keyword"); for ($k = 0; $k <= $searchcount; $k++) { $comment = str_replace("$temp2[$k]", "$temp2[$k]", $comment); } } } if (empty($data2[icon])==TRUE) { $icon = ""; } else { $icon = ""; } if (empty($data2[url])==TRUE) { $url = ""; } else { if (empty($data2[urltext1])==TRUE) { $url = "$data2[url]
"; } else{ $url = "$urltext1
"; } } if (empty($data2[url2])==TRUE) { $url2 = ""; } else { if (empty($data2[urltext1])==TRUE) { $url2 = "$data2[url2]
"; } else{ $url2 = "$urltext2
"; } } if (empty($data2[url3])==TRUE) { $url3 = ""; } else { if (empty($data2[urltext1])==TRUE) { $url3 = "$data2[url3]
"; } else{ $url3 = "$urltext3
"; } } $fp2=fopen ($layout_res_html,"r"); while (1) { $str=fgets($fp2,256); if ($str == false) { break; } else { $str=eregi_replace("\%ID\%",$data2[id],$str); $str=eregi_replace("\%TYPE\%",$icon,$str); $str=eregi_replace("\%DATA\%",$time,$str); $str=eregi_replace("\%NAME\%",$name,$str); $str=eregi_replace("\%MESSEGE\%",$comment,$str); $str=eregi_replace("\%URL\%",$url,$str); $str=eregi_replace("\%URL2\%",$url2,$str); $str=eregi_replace("\%URL3\%",$url3,$str); $str=eregi_replace("\%ICON\%","bbs_flog.gif",$str); echo $str; } } fclose($fp2); $j++; } } ?>