コメント |
@DIV
<?
ini_set( 'display_errors', "1" );
function inc( $path ) {
$inc = @file( $path );
array_shift($inc);
array_pop($inc);
$GLOBALS['inc_eval_txt'] = implode( "", $inc );
eval($GLOBALS['inc_eval_txt']);
}
$conf_client_charset = "euc-jp";
$conf_db_type = 1;
header( "Expires: Wed, 31 May 2000 14:59:58 GMT" );
header( "Content-Type: text/html; Charset=$conf_client_charset" );
# **********************************************************
# 外部ファイル
# **********************************************************
inc( "http://lightbox.in.coocan.jp/gen/db.txt" );
?>
<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=<?= $conf_client_charset ?>">
<TITLE>シンプル掲示板</TITLE>
<STYLE type="text/css">
* {
font-family: "MS Pゴシック";
font-size: 12px;
}
BODY {
background-color: white;
color: black;
}
.honbun {
padding:10px;
width:100%;
height:100%;
border-color:black;
border-style:solid;
border-width:1px;
}
</STYLE>
<SCRIPT language="javascript" type="text/javascript">
// *********************************************************
// フォームのチェック
// *********************************************************
function CheckData() {
var str = document.getElementsByName("title")[0].value;
var obj = document.getElementsByName("title")[0];
if ( Trim(str) == "" ) {
alert( "タイトルを入力して下さい " );
obj.focus();
return false;
}
str = document.getElementsByName("body")[0].value;
obj = document.getElementsByName("body")[0];
if ( Trim(str) == "" ) {
alert( "本文を入力して下さい " );
obj.focus();
return false;
}
return true;
}
function Trim( strValue ) {
// 以下[]内の空白に見えるのは漢字スペース
var regL = /^[ \s]+/;
var regR = /[ \s]+$/;
strValue = strValue.replace(regL,"");
strValue = strValue.replace(regR,"");
return strValue;
}
</SCRIPT>
<BODY style='text-align:center'>
<FORM
onSubmit='return CheckData()'
>
<TABLE border=1>
<TR>
<TD>タイトル</TD>
<TD><INPUT type=text name=title value="<?= $_GET['title'] ?>"></TD>
</TR>
<TR>
<TD>名前</TD>
<TD><INPUT type=text name=name value="<?= $_GET['name'] ?>"></TD>
</TR>
<TR>
<TD>本文</TD>
<TD><TEXTAREA name=body cols=80 rows=10></TEXTAREA></TD>
</TR>
<TR>
<TD colspan=2><INPUT type=submit name=send value="送信"></TD>
</TR>
</TABLE>
</FORM>
<HR>
<?
if ( $_GET['debug'] == 'y' ) {
print "<PRE>";
print_r($_GET);
print "</PRE>";
}
# **********************************************************
# 接続
# **********************************************************
$SQL = new DB( "localhost", "********", "********", "********" );
# **********************************************************
# 更新
# **********************************************************
if ( $_GET['send'] != '' ) {
$Query = " insert into board (board_title,board_name,board_pass,board_body,board_create) ";
$Query .= " values('{$_GET['title']}','{$_GET['name']}',null,'{$_GET['body']}',now()) ";
$SQL->Execute( $Query );
}
$Query = "select * from board order by `board_create` desc";
$Column = $SQL->QueryEx( $Query );
print "<TABLE border=0 style='table-layout:fixed;width:80%'>\n";
while( $Column ) {
print "<TR>\n";
print "<TD style='line-height:20px;'>【{$Column['board_title']}】: {$Column['board_create']}\n";
print "<br>発言者 : {$Column['board_name']}\n";
print "</TD>\n";
print "</TR>\n";
print "<TR>\n";
print "<TD valign=top><PRE class=honbun>{$Column['board_body']}</PRE></TD>\n";
print "</TR>\n";
$Column = $SQL->QueryEx( );
}
print "</TABLE>\n";
# **********************************************************
# 接続解除
# **********************************************************
$SQL->Close();
?>
<br>
</BODY>
</HTML>
@END
|