<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>スレッド式掲示板</title></head>
<link href="css/bbs.css" rel="stylesheet" type="text/css" />

<!--shadowbox setting start-->
<link rel="stylesheet" type="text/css" media="screen" href="../../js/shadowbox/shadowbox.css" />
<script type="text/javascript" src="../../js/shadowbox/shadowbox.js"></script>
<script type="text/javascript" src="../../js/jquery.js"></script>	
<script type="text/javascript"> 
Shadowbox.init({
    language: 'ja',
    players:  ['img', 'html', 'iframe', 'qt', 'wmp', 'swf', 'flv']
});
</script>
<!--shadowbox setting end-->

<body>
<div id='main'>
<?php
require 'counter/counter.php';
require 'set/setting.php';

//掲示板全ログ取得
require 'set/db_connect.php';
$tbl_name = DB_TBL_BBSLOGS;
$flg01    = BBSLOG_DEL_FLG;
$str_sql = <<< ___BBS_SQL___
SELECT * FROM   `$tbl_name` 
        WHERE   `$flg01`='0';
___BBS_SQL___;
$bbs_rs = mysql_query($str_sql,$db);
//echo $bbs_rs;
$bbs_i = 0;
while($bbs_logs = mysql_fetch_assoc($bbs_rs)){
    $bbs_all_logs[BBSLOG_ID][$bbs_i]        = $bbs_logs[BBSLOG_ID];
    $bbs_all_logs[BBSLOG_THREAD_ID][$bbs_i] = $bbs_logs[BBSLOG_THREAD_ID];
    $bbs_all_logs[BBSLOG_DIVISION][$bbs_i]  = $bbs_logs[BBSLOG_DIVISION];
    $bbs_all_logs[BBSLOG_TITLE][$bbs_i]     = $bbs_logs[BBSLOG_TITLE];
    $bbs_all_logs[BBSLOG_NAME][$bbs_i]      = $bbs_logs[BBSLOG_NAME];
    $bbs_all_logs[BBSLOG_MAIL][$bbs_i]      = $bbs_logs[BBSLOG_MAIL];
    $bbs_all_logs[BBSLOG_URL][$bbs_i]       = $bbs_logs[BBSLOG_URL];
    $bbs_all_logs[BBSLOG_IMAGAES][$bbs_i]   = $bbs_logs[BBSLOG_IMAGAES];
    $bbs_all_logs[BBSLOG_COMMENT][$bbs_i]   = $bbs_logs[BBSLOG_COMMENT];
    $bbs_all_logs[BBSLOG_EDIT_PASS][$bbs_i] = $bbs_logs[BBSLOG_EDIT_PASS];
    $bbs_all_logs[BBSLOG_FONT][$bbs_i]      = $bbs_logs[BBSLOG_FONT];
    $bbs_all_logs[BBSLOG_AUTHOR_IP][$bbs_i] = $bbs_logs[BBSLOG_AUTHOR_IP];
    $bbs_all_logs[BBSLOG_DATE][$bbs_i]      = $bbs_logs[BBSLOG_DATE];
    $bbs_all_logs[BBSLOG_UPDATE][$bbs_i]    = $bbs_logs[BBSLOG_UPDATE];
    $bbs_all_logs[BBSLOG_DEL_FLG][$bbs_i]   = $bbs_logs[BBSLOG_DEL_FLG];
    $bbs_i++;
}
$mode = $_GET["mode"];
switch($mode){
    case "new_thread":
        new_thread();
    break;
    case "show_thread":
        show_thread();
    break;
    case "edit_thread":
        edit_thread();
    break;
    case "read_me":
        read_me();
    break;
    default:
    show_top();
}

function read_me(){
    //表示エリア用にグローバル化
    
    $GLOBALS['page_title'] = "いろいろ使い方とか解説とか";
    $GLOBALS['show_form'] = <<< ___READ_ME___
<div style='text-align:left;margin-top:10px;padding:5px;'>
<p>
受講生掲示板とほぼ同じ形式のものをＰＨＰで作ってみました。一応、<font color="#006600"><strong>スレッド作成・レス・修正・削除</strong></font>ができます。<br />
書き込む際は修正用のパスワードは必須です。<br />
文字色指定・画像投稿もできます。文字色はセレクトボックスから。色の追加要望は随時下されば追加します。<br />
アイコンが使えるようにーとか言う要望についてですが、えっと、アイコンの画像作ってください(＾ー＾)ﾆﾔｰ<br />
<br />
エラーメッセージなども気を使って作ったつもりですが、たぶん色々とバグがあるかもしれません。<br />
その際は書き込んでいただければ対処いたしますし、自分でも色々見ていっています<br />
現在のところ<strong>「修正した際に登録日時も更新されてしまう」</strong>というのがわかっています。<br />
そんな処理書いてないのにおかしいなぁ・・・。<br />
<br />
お持ち帰り用の圧縮ファイルは→<a href='../../DL/m_bbs.zip'>こちら</a>←<br />
一応、ＤＢもついてます。Readmeつけていませんが、とりあえずsetフォルダのsetting内のDBの設定だとかを環境に合わせて変えてください。<br />
あとはbbs.phpにブラウザからアクセスすればOKです。act.phpはあくまで追加、更新等の処理を行なうためだけの中継ページに過ぎません。<br />
<br />
デザインはしんぷるいずざべすとを目指しました（ｷﾘｯ

<br />
更新履歴：<br />
2010年9月30日 Ver.1.0リリース<br />
同日────- 規定サイズ500KBに。携帯からの書き込み、画像添付も確認。 
</p>
</div>
___READ_ME___;

}


//BBSトップページ
function show_top(){
    global $bbs_all_logs;
    //var_dump($bbs_all_logs);
    //echo "OK";
    $page_title = "トップ";
    if($bbs_all_logs != NULL){
    //スレッドの親のみ取得
        require 'set/db_connect.php';
        $tbl_name = DB_TBL_BBSLOGS;
        $flg01    = BBSLOG_DIVISION;
        $flg02    = BBSLOG_DEL_FLG;
        $str_sql = <<< ___BBS_SQL___
SELECT * FROM   `$tbl_name` 
        WHERE `$flg01`='1' 
        AND   `$flg02`='0';
___BBS_SQL___;
        $thread_rs = mysql_query($str_sql,$db);
//echo $bbs_rs;
//トップページのフォーム
        $show_form = <<< ___BBS_TITLE___
    <div style='text-align:left;'>■■■ <a href='?mode=new_thread'>新規スレッド作成</a> ■■■</div>
    <table class='thread_table'>
        <tr style='background-color:#ccffcc;'>
            <td width='30' align='right'>No.</td>
            <td width='400' align='left'>タイトル</td>
            <td width='100' align='center'>投稿者</td>
            <td width='80' align='center'>書き込み数</td>
            <td width='240' align='center'>最終更新日時</td>
        </tr>

___BBS_TITLE___;
        while($thread_logs = mysql_fetch_assoc($thread_rs)){
            $show_thread_id = $thread_logs["thread_id"];
            $show_thread_title = $thread_logs["title"];
            $show_thread_autor = $thread_logs["name"];
            $show_thread_update = $thread_logs["update"];
            require 'set/db_connect.php';
            $str_sql = "SELECT COUNT(*) FROM `".DB_TBL_BBSLOGS."` WHERE `".BBSLOG_THREAD_ID."`='{$show_thread_id}'";
            $cnt_rs = mysql_query($str_sql,$db);
            $thread_cnt_data = mysql_fetch_assoc($cnt_rs);
            $thread_cnt = $thread_cnt_data["COUNT(*)"];
            $thread_cnt--;
            $show_form .= <<< ___BBS_TOP___
    <tr style='background-color:#ffffff;'>
        <td align='right'><a href='?mode=show_thread&thread_id=$show_thread_id'>$show_thread_id</a></td>
        <td align='left'><a href='?mode=show_thread&thread_id=$show_thread_id'>$show_thread_title</a></td>
        <td align='center'>$show_thread_autor</td>
        <td align='center'>$thread_cnt</td>
        <td align='center'>$show_thread_update</td>
    </tr>

___BBS_TOP___;
        }
        $show_form .= "</table>\n";
    }

    //表示エリア用にグローバル化
    $GLOBALS['show_form'] = $show_form;
    $GLOBALS['page_title'] = $page_title;
}

//BBS新規スレッド作成フォーム
function new_thread(){
    $page_title = "新規スレッド作成";

    //カラーコード取得
    require 'set/db_connect.php';
    $tbl_name = DB_TBL_FONT_COLOR;
    $str_sql = <<< ___BBS_SQL___
SELECT * FROM   `$tbl_name` 
___BBS_SQL___;
    $font_rs = mysql_query($str_sql,$db);
    while($bbs_font = mysql_fetch_assoc($font_rs)){
        $font_id = $bbs_font["id"];
        $font_color_code = $bbs_font["color_code"];
        $font_name = $bbs_font["comment"];
        $font_options .= <<< ___FONT_COLORS___
    <option value='$font_id' style='color:$font_color_code;background-color:#ffff99;'>■$font_name</option>
    
___FONT_COLORS___;
    }
        
    $show_form = <<< ___BBS_TITLE___
    <div style='text-align:left;'><span class='font_exec'>＊</span>は必須。</div>
    <form method='POST' action='act.php' enctype='multipart/form-data'>
        <table class='thread_table' style='background-color:#FFFFFF;'>
            <tr>
                <td width='220'>
                    <span class='font_exec'>＊</span>スレッドタイトル
                </td>
                <td>
                    <input type='text' name='title'>
                </td>
            </tr>
            <tr>
                <td>
                    <span class='font_exec'>＊</span>投稿者名
                </td>
                <td>
                    <input type='text' name='name' size='30'>
                </td>
            </tr>
            <tr>
                <td>
                    メールアドレス
                </td>
                <td>
                    <input type='text' name='mail' size='50' style="ime-mode:disabled;">
                </td>
            </tr>
            <tr>
                <td>
                    Webサイト
                </td>
                <td>
                    <input type='text' name='url' value='http://' size='50' style="ime-mode:disabled;">
                </td>
            </tr>
            <tr>
                <td>
                    画像添付
                </td>
                <td>
                    <input type='file' name='images' />　<span style='font-size:10px;'>jpg形式のみ。500KB以内。</span>
                </td>
            </tr>
            <tr>
                <td>
                    文字色
                </td>
                <td>
                    <select name='font_colors'>
                        $font_options
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <span class='font_exec'>＊</span>書き込み内容
                </td>
                <td>
                    <textarea name='comment' cols='60' rows='10'></textarea>
                </td>
            </tr>
            <tr>
                <td>
                    <span class='font_exec'>＊</span>編集パスワード
                </td>
                <td>
                    <input type='password' name='edit_pass' style="ime-mode:disabled;"/> ＊6文字以上
                </td>
            </tr>
            <tr>
                <td colspan='2' style='text-align:right;'>
                    <input type='hidden' name='act_mode' value='create_thread'>
                    <input type='submit' value='スレッド作成'>
                </td>
            </tr>
        </table>
    </form>
        <br />
        <br />
        <br />
        <div style='text-align:right;'>■■■ <a href='bbs.php'>トップに戻る</a> ■■■</div>
___BBS_TITLE___;

    //表示エリア用にグローバル化
    $GLOBALS['show_form'] = $show_form;
    $GLOBALS['page_title'] = $page_title;
}


//書き込み内容表示
function show_thread(){
    
    $thread_id = $_GET['thread_id'];
    require 'set/db_connect.php';
    $tbl_name = DB_TBL_BBSLOGS;
    $flg01    = BBSLOG_THREAD_ID;
    $flg02    = BBSLOG_DIVISION;
    $flg03    = BBSLOG_DEL_FLG;
    $str_sql = <<< ___BBS_SQL___
SELECT * FROM   `$tbl_name` 
        WHERE `$flg01`='$thread_id'  
        AND   `$flg02`='1' 
        AND   `$flg03`='0';
___BBS_SQL___;
    $thread_rs = mysql_query($str_sql,$db);
    $thread_data = mysql_fetch_assoc($thread_rs);
    $thread_logs_id        = $thread_data[BBSLOG_ID];
    $thread_logs_thread_id = $thread_data[BBSLOG_THREAD_ID];
    $thread_logs_division  = $thread_data[BBSLOG_DIVISION];
    $thread_logs_title     = $thread_data[BBSLOG_TITLE];
    $thread_logs_name      = $thread_data[BBSLOG_NAME];
    $thread_logs_mail      = $thread_data[BBSLOG_MAIL];
    $thread_logs_url       = $thread_data[BBSLOG_URL];
    $thread_logs_images    = $thread_data[BBSLOG_IMAGAES];
    $thread_logs_comment   = $thread_data[BBSLOG_COMMENT];
    $thread_logs_edit_pass = $thread_data[BBSLOG_EDIT_PASS];
    $thread_logs_font      = $thread_data[BBSLOG_FONT];
    $thread_logs_autor_ip  = $thread_data[BBSLOG_AUTHOR_IP];
    $thread_logs_date      = $thread_data[BBSLOG_DATE];
    $thread_logs_update    = $thread_data[BBSLOG_UPDATE];
    $thread_logs_del_flg   = $thread_data[BBSLOG_DEL_FLG];
    
    //指定のカラーコード取得
    $tbl_name = DB_TBL_FONT_COLOR;
    $flg01    = DB_TBL_FONT_ID;
    $str_sql = "SELECT * FROM `{$tbl_name}` WHERE `{$flg01}`='{$thread_logs_font}';";
    $font_rs = mysql_query($str_sql,$db);
    $font_data = mysql_fetch_assoc($font_rs);
    $font_color = $font_data["color_code"];

    if($thread_logs_mail == ""){
        $thread_logs_mail = "sage";
    }

    if($thread_logs_url == "" || $thread_logs_url = "http://"){
        $thread_logs_url = "bbs.php";
    }  

    if($thread_logs_images != ""){
        $thread_logs_images_display = "<div style='text-align:center;'><a href='$thread_logs_images' rel='shadowbox' title='[$thread_logs_name]さんの投稿画像'><img src='$thread_logs_images' title='[$thread_logs_name]さんの投稿画像' width='120' height='100'></a></div>";
    }

$show_form = <<< ___SHOW_FORM___
<div class='thread_title'>
■ $thread_logs_thread_id ■<strong>$thread_logs_title</strong>
(<a href='?mode=edit_thread&thread_id=$thread_logs_thread_id&bbs_id=$thread_logs_id'>修正</a>)
</div>
<div class='thread_body'>
投稿者：$thread_logs_name($thread_logs_autor_ip)&nbsp;投稿日時：$thread_logs_update&nbsp;最終更新日時：$thread_logs_update<br />
メール：<a href='mailto:$thread_logs_mail'>＠</a>&nbsp;ＨＰ：<a href='$thread_logs_url'>＠</a>
<hr>
$thread_logs_images_display
<p style='color:$font_color;margin-top:5px;margin-bottom:15px;'>
$thread_logs_comment
</p>
</div>

___SHOW_FORM___;

    //レス内容取得
    require 'set/db_connect.php';
    $tbl_name = DB_TBL_BBSLOGS;
    $flg01    = BBSLOG_THREAD_ID;
    $flg02    = BBSLOG_DIVISION;
    $flg03    = BBSLOG_DEL_FLG;
    $str_sql = <<< ___BBS_SQL___
SELECT * FROM   `$tbl_name` 
        WHERE `$flg01`='$thread_logs_thread_id'  
        AND   `$flg02`='2'  
        AND   `$flg03`='0';
___BBS_SQL___;
    $res_i = 1;
    $thread_res_rs = mysql_query($str_sql,$db);
    while($thread_res_data = mysql_fetch_assoc($thread_res_rs)){
        $thread_res_logs_id        = $thread_res_data[BBSLOG_ID];
        $thread_res_logs_thread_id = $thread_res_data[BBSLOG_THREAD_ID];
        $thread_res_logs_division  = $thread_res_data[BBSLOG_DIVISION];
        $thread_res_logs_title     = $thread_res_data[BBSLOG_TITLE];
        $thread_res_logs_name      = $thread_res_data[BBSLOG_NAME];
        $thread_res_logs_mail      = $thread_res_data[BBSLOG_MAIL];
        $thread_res_logs_url       = $thread_res_data[BBSLOG_URL];
        $thread_res_logs_images    = $thread_res_data[BBSLOG_IMAGAES];
        $thread_res_logs_comment   = $thread_res_data[BBSLOG_COMMENT];
        $thread_res_logs_edit_pass = $thread_res_data[BBSLOG_EDIT_PASS];
        $thread_res_logs_font      = $thread_res_data[BBSLOG_FONT];
        $thread_res_logs_autor_ip  = $thread_res_data[BBSLOG_AUTHOR_IP];
        $thread_res_logs_date      = $thread_res_data[BBSLOG_DATE];
        $thread_res_logs_update    = $thread_res_data[BBSLOG_UPDATE];
        $thread_res_logs_del_flg   = $thread_res_data[BBSLOG_DEL_FLG];
 
        //指定のカラーコード取得
        $tbl_name = DB_TBL_FONT_COLOR;
        $flg01    = DB_TBL_FONT_ID;
        $str_sql = <<< ___BBS_SQL___
SELECT * FROM   `$tbl_name` 
    WHERE   `$flg01`='$thread_res_logs_font'
___BBS_SQL___;
        $font_rs = mysql_query($str_sql,$db);
        $font_data = mysql_fetch_assoc($font_rs);
        $font_res_color = $font_data["color_code"];

    if($thread_res_logs_mail == ""){
        $thread_res_logs_mail = "sage";
    }

    if($thread_res_logs_url == "" || $thread_logs_url = "http://"){
        $thread_res_logs_url = "bbs.php";
    }  

    if($thread_res_logs_images != ""){
        $thread_res_logs_images_display = "<div style='text-align:center;'><a href='{$thread_res_logs_images}' rel='shadowbox' title='[$thread_res_logs_name]さんの投稿画像'><img src='{$thread_res_logs_images}' title='[$thread_res_logs_name]さんの投稿画像' width='120' height='100'></a></div>";
    }



$show_form .= <<< ___SHOW_FORM___
<div class='thread_body'>
<p>[ $res_i ]<strong>$thread_res_logs_title</strong>(<a href='?mode=edit_thread&thread_id=$thread_logs_thread_id&bbs_id=$thread_res_logs_id'>修正</a>)</p>
投稿者：$thread_res_logs_name($thread_res_logs_autor_ip)&nbsp;投稿日時：$thread_res_logs_date&nbsp;最終更新日時：$thread_res_logs_update<br />
メール：<a href='mailto:$thread_res_logs_mail'>＠</a>&nbsp;ＨＰ：<a href='$thread_res_logs_url'>＠</a>
<hr>
$thread_res_logs_images_display
<p style='color:$font_res_color;margin-top:5px;margin-bottom:15px;'>
$thread_res_logs_comment
</p>

</div>

___SHOW_FORM___;

        $res_i++;
    }

    //カラーコード取得
    require 'set/db_connect.php';
    $tbl_name = DB_TBL_FONT_COLOR;
    $str_sql = <<< ___BBS_SQL___
SELECT * FROM   `$tbl_name` 
___BBS_SQL___;
    $font_rs = mysql_query($str_sql,$db);
    while($bbs_font = mysql_fetch_assoc($font_rs)){
        $font_id = $bbs_font["id"];
        $font_color_code = $bbs_font["color_code"];
        $font_name = $bbs_font["comment"];
        $font_options .= <<< ___FONT_COLORS___
    <option value='$font_id' style='color:$font_color_code;background-color:#ffff99;'>■$font_name</option>
    
___FONT_COLORS___;
    }
    

    $show_form .= <<< ___BBS_TITLE___
    <br />
    <br />
    <div style='text-align:center;'><strong>≪　レスをつける　≫</strong></center>
    <br />
    <div style='text-align:left;'><span class='font_exec'>＊</span>は必須。</div>
    <form method='POST' action='act.php' enctype='multipart/form-data'>
        <table class='thread_table' style='background-color:#FFFFFF;'>
            <tr>
                <td width='220'>
                    <span class='font_exec'>＊</span>タイトル
                </td>
                <td>
                    <input type='text' name='title' value='Re; $thread_logs_title'>
                </td>
            </tr>
            <tr>
                <td>
                    <span class='font_exec'>＊</span>投稿者名
                </td>
                <td>
                    <input type='text' name='name' size='30'>
                </td>
            </tr>
            <tr>
                <td>
                    メールアドレス
                </td>
                <td>
                    <input type='text' name='mail' size='50' style="ime-mode:disabled;">
                </td>
            </tr>
            <tr>
                <td>
                    Webサイト
                </td>
                <td>
                    <input type='text' name='url' value='http://' size='50' style="ime-mode:disabled;">
                </td>
            </tr>
            <tr>
                <td>
                    画像添付
                </td>
                <td>
                    <input type='file' name='images' />　<span style='font-size:10px;'>jpg形式のみ。500KB以内。</span>
                </td>
            </tr>
            <tr>
                <td>
                    文字色
                </td>
                <td>
                    <select name='font_colors'>
                        $font_options
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <span class='font_exec'>＊</span>書き込み内容
                </td>
                <td>
                    <textarea name='comment' cols='60' rows='10'></textarea>
                </td>
            </tr>
            <tr>
                <td>
                    <span class='font_exec'>＊</span>編集パスワード
                </td>
                <td>
                    <input type='password' name='edit_pass' style="ime-mode:disabled;"/> ＊6文字以上
                </td>
            </tr>
            <tr>
                <td colspan='2' style='text-align:right;'>
                    <input type='hidden' name='act_mode' value='create_res'>
                    <input type='hidden' name='thread_id' value='$thread_logs_thread_id'>
                    <input type='submit' value='書き込み'>
                </td>
            </tr>
        </table>
    </form>
        <br />
        <br />
        <br />
        <div style='text-align:right;'>■■■ <a href='bbs.php'>トップに戻る</a> ■■■</div>
___BBS_TITLE___;


    $page_title = "スレッドNo.{$thread_logs_thread_id}";

    //表示エリア用にグローバル化
    $GLOBALS['show_form'] = $show_form;
    $GLOBALS['page_title'] = $page_title;
}


//スレッド、書き込み内容編集、削除フォーム
function edit_thread(){
    $page_title = "書き込み内容修正・削除";

    //書き込み内容表示
    $get_bbs_id     = $_GET["bbs_id"];
    require 'set/db_connect.php';
    $tbl_name = DB_TBL_BBSLOGS;
    $flg01    = BBSLOG_ID;
    $str_sql = <<< ___BBS_SQL___
SELECT * FROM   `$tbl_name` 
        WHERE `$flg01`='$get_bbs_id' 
___BBS_SQL___;
    $edit_thread_rs = mysql_query($str_sql,$db);
    $edit_thread_data = mysql_fetch_assoc($edit_thread_rs);
    $edit_thread_logs_id        = $edit_thread_data[BBSLOG_ID];
    $edit_thread_logs_thread_id = $edit_thread_data[BBSLOG_THREAD_ID];
    $edit_thread_logs_division  = $edit_thread_data[BBSLOG_DIVISION];
    $edit_thread_logs_title     = $edit_thread_data[BBSLOG_TITLE];
    $edit_thread_logs_name      = $edit_thread_data[BBSLOG_NAME];
    $edit_thread_logs_mail      = $edit_thread_data[BBSLOG_MAIL];
    $edit_thread_logs_url       = $edit_thread_data[BBSLOG_URL];
    $edit_thread_logs_images    = $edit_thread_data[BBSLOG_IMAGAES];
    $edit_thread_logs_comment   = $edit_thread_data[BBSLOG_COMMENT];
    $edit_thread_logs_edit_pass = $edit_thread_data[BBSLOG_EDIT_PASS];
    $edit_thread_logs_font      = $edit_thread_data[BBSLOG_FONT];
    $edit_thread_logs_autor_ip  = $edit_thread_data[BBSLOG_AUTHOR_IP];
    $edit_thread_logs_date      = $edit_thread_data[BBSLOG_DATE];
    $edit_thread_logs_update    = $edit_thread_data[BBSLOG_UPDATE];
    $edit_thread_logs_del_flg   = $edit_thread_data[BBSLOG_DEL_FLG];

    //テキストフィールド用に変換
    $edit_thread_logs_comment = str_replace("&nbsp;", "\t", $edit_thread_logs_comment);
    $edit_thread_logs_comment = str_replace("<br/>", "\n", $edit_thread_logs_comment);

    //カラーコード取得
    require 'set/db_connect.php';
    $tbl_name = DB_TBL_FONT_COLOR;
    $str_sql = <<< ___BBS_SQL___
SELECT * FROM   `$tbl_name` 
___BBS_SQL___;
    $font_rs = mysql_query($str_sql,$db);
    while($bbs_font = mysql_fetch_assoc($font_rs)){
        $font_id = $bbs_font["id"];
        $font_color_code = $bbs_font["color_code"];
        $font_name = $bbs_font["comment"];
        if($font_id == $edit_thread_logs_font){
            $font_options .= <<< ___FONT_COLORS___
    <option value='$font_id' style='color:$font_color_code;background-color:#ffff99;' selected>■$font_name</option>
    
___FONT_COLORS___;

        }else{$font_options .= <<< ___FONT_COLORS___
    <option value='$font_id' style='color:$font_color_code;background-color:#ffff99;'>■$font_name</option>
    
___FONT_COLORS___;
        }
    }
        
    $show_form = <<< ___BBS_TITLE___
    <div style='text-align:left;'><span class='font_exec'>＊</span>は必須。</div>
    <form method='POST' action='act.php' enctype='multipart/form-data'>
        <table class='thread_table' style='background-color:#FFFFFF;'>
            <tr>
                <td width='220'>
                    <span class='font_exec'>＊</span>スレッドタイトル
                </td>
                <td>
                    <input type='text' name='title' value='$edit_thread_logs_title'>
                </td>
            </tr>
            <tr>
                <td>
                    <span class='font_exec'>＊</span>投稿者名
                </td>
                <td>
                    <input type='text' name='name' size='30' value='$edit_thread_logs_name'>
                </td>
            </tr>
            <tr>
                <td>
                    メールアドレス
                </td>
                <td>
                    <input type='text' name='mail' value='$edit_thread_logs_mail' size='50' style="ime-mode:disabled;">
                </td>
            </tr>
            <tr>
                <td>
                    Webサイト
                </td>
                <td>
                    <input type='text' name='url' value='$edit_thread_logs_url' size='50' style="ime-mode:disabled;">
                </td>
            </tr>
            <tr>
                <td>
                    画像添付
                </td>
                <td>
                    <input type='file' name='images' />　<span style='font-size:10px;'>jpg形式のみ。500KB以内。変更しない場合はそのままで。</span>
                </td>
            </tr>
            <tr>
                <td>
                    文字色
                </td>
                <td>
                    <select name='font_colors'>
                        $font_options
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <span class='font_exec'>＊</span>書き込み内容
                </td>
                <td>
                    <textarea name='comment' cols='60' rows='10'>$edit_thread_logs_comment</textarea>
                </td>
            </tr>
            <tr>
                <td>
                    <span class='font_exec'>＊</span>編集パスワード
                </td>
                <td>
                    <input type='password' name='edit_pass' value='$edit_thread_logs_edit_pass' style="ime-mode:disabled;"/> ＊6文字以上(変更しないのであればそのまま)
                </td>
            </tr>
            <tr>
                <td colspan='2' style='text-align:right;'>
                    編集確認パスワード<input type='password' name='edit_thread_pass' style="ime-mode:disabled;"/>
                    <input type='hidden' name='thread_id' value='$edit_thread_logs_id'>
                    <input type='hidden' name='edit_images' value='$edit_thread_logs_images'>
                    <input type='hidden' name='act_mode' value='edit_thread'>
                    <input type='submit' value='修正'>
                </td>
            </tr>
        </table>
    </form>
    <br />
    <form method='POST' action='act.php'>
        <table class='thread_table' style='background-color:#FFFFFF;'>
            <tr>
                <td width='220'>
                    <span class='font_exec'>削除（削除した書き込みは復活できません）</span>
                </td>
                <td style='text-align:right;'>
                    削除確認パスワード<input type='password' name='del_thread_pass' style="ime-mode:disabled;"/>
                    <input type='hidden' name='thread_id' value='$edit_thread_logs_id'>
                    <input type='hidden' name='act_mode' value='del_thread'>
                    <input type='submit' value='削除'>
                </td>
            </tr>
        </table>
    </form>

        <br />
        <br />
        <br />
        <div style='text-align:right;'>■■■ <a href='bbs.php'>トップに戻る</a> ■■■</div>
___BBS_TITLE___;

    //表示エリア用にグローバル化
    $GLOBALS['show_form'] = $show_form;
    $GLOBALS['page_title'] = $page_title;
}



echo "\t<h1 id='bbs_header'>".BBS_HEADER_TITLE."<br />\n";
echo "\t<span class='pagetitle'>─{$page_title}─</span></h1>\n";
echo "\t<a href='?mode=read_me'>いろいろ使い方とか解説とか</a>\n";
echo $show_form;
echo "\t<div id='footer'>".BBS_FOOTER."</div>\n";

?>
</div>

</body>
</html>