", $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,$view_sp,$begin,$id,$keyword,$kind,$max,$category_id; // //■カテゴリー表示 // if($category_id == "0"){$category_disp = "指定なし";} elseif($category_id == "1"){$category_disp = "ホテル";} elseif($category_id == "2"){$category_disp = "宴会・パーティー";} elseif($category_id == "3"){$category_disp = "カラオケ";} elseif($category_id == "4"){$category_disp = "ダーツバー";} elseif($category_id == "5"){$category_disp = "エステ&スパ";} elseif($category_id == "6"){$category_disp = "ウエディング";} elseif($category_id == "7"){$category_disp = "レストラン";} elseif($category_id == "8"){$category_disp = "カフェ";} //■カテゴリー名の表示 if($category_id != ""){ echo "
"; echo "
$category_disp 】に絞ったクチコミ内容を表示しています。

"; echo "
"; } $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($category_id == ""){ $sql = "SELECT * FROM $table1 WHERE flg !='1'"; } //■指定カテゴリーのみ表示 elseif($category_id != ""){ $sql = "SELECT * FROM $table1 WHERE flg !='1' AND category='$category_id'"; } // // 発言総数の取得 // 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_sp; // 総ページ数の計算 $allpage = (int)($all / $view_sp); $allpage+=1; // 現在のページの計算 $nowpage = ($value2 / $view_sp); // // 発言情報の取得 // $sql2 = "$sql"; $sql2 .= " ORDER BY turn desc,id desc limit $view_sp 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"); */ $name = mb_convert_encoding($data[name], "utf-8", "EUC-JP");//EUC-JP ⇒ utf-8 $time = mb_convert_encoding($data[time], "utf-8", "EUC-JP"); $comment = mb_convert_encoding($data[comment], "utf-8", "EUC-JP"); $urltext1 = mb_convert_encoding($data[urltext1], "utf-8", "EUC-JP"); $urltext2 = mb_convert_encoding($data[urltext2], "utf-8", "EUC-JP"); $urltext3 = mb_convert_encoding($data[urltext3], "utf-8", "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--; } //■ページング echo "
\n"; $value2=$begin+$view_sp; $keyword = mb_convert_encoding($keyword, "SJIS", "EUC-JP"); //前の*件 if ($value2 > $view_sp) { $value3=$begin-$view_sp; echo "« 前の $view_sp 件"; } //次の*件 if ($i >= $view_sp) { echo "次の $view_sp 件 »"; } echo"
"; if($allpage < $max){ $maxpage = $allpage; } else{ $maxpage = $max; } echo "
\n"; for($j=1; $j<=$maxpage; $j++){ //for($j=1; $j<=5; $j++){ $next = ($j-1)*$view_sp; //閲覧中のページ(白背景) if($j == $nowpage){ echo "$j"; } //その他ページング(黒背景) else{ $disp_count = $nowpage + 5; if($j < $disp_count and $nowpage < $j){ echo "$j"; } } } echo"
"; //表示記事数 / 総記事数 $first = $begin+1; $last = $begin+$view_sp; echo "
${first}件~${last}件(全${all}件)
"; } } } // ---------------------------------------------------------------------------------------- // ●レス発言表示部分 // ---------------------------------------------------------------------------------------- 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"); */ $name = mb_convert_encoding($data2[name], "utf-8", "EUC-JP"); $time = mb_convert_encoding($data2[time], "utf-8", "EUC-JP"); $comment = mb_convert_encoding($data2[comment], "utf-8", "EUC-JP"); $urltext1 = mb_convert_encoding($data2[urltext1], "utf-8", "EUC-JP"); $urltext2 = mb_convert_encoding($data2[urltext2], "utf-8", "EUC-JP"); $urltext3 = mb_convert_encoding($data2[urltext3], "utf-8", "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++; } } ?>