103 行
3.7 KiB
PHP
103 行
3.7 KiB
PHP
<?php
|
|
//直接アクセスしちゃ駄目
|
|
require $d_root.'/hide_php/conf/c.php';
|
|
require $d_root.'/hide_php/conf/submit.php';
|
|
require $d_root.'/hide_php/conf/bbs.php';
|
|
|
|
|
|
$bbs_dir = $d_root.'/sqlike/bbs';
|
|
//定義
|
|
|
|
|
|
|
|
if (isset($_POST['submit'], $_POST['name'], $_POST['key']) && $_POST['submit'] === 'set'){
|
|
setcookie('name', $_POST['name'], time() + 999999, '/');
|
|
$_SESSION['key'] = $_POST['key'];
|
|
header('Location:./');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//セッションの代用
|
|
$session_num = one_time_pass(50, 100);
|
|
set_session('mkboard', $session_num);
|
|
|
|
|
|
|
|
$html_file = $d_root.'/sqlike/html/form/ext_board.html';
|
|
if (file_exists($html_file)){
|
|
$html = explode('{NEW_BOARD}', file_get_contents($html_file));
|
|
} else {
|
|
not_found();
|
|
}
|
|
######################html開始
|
|
html_head('板の作成-', '', $d_root.'/sqlike/css/form/bbs.css', false);
|
|
echo $html[0];
|
|
$html = explode('{FORM}', $html[1]);
|
|
|
|
$s_name=(isset($_COOKIE['name'])?$_COOKIE['name']:'');
|
|
$s_key=(isset($_SESSION['key'])?$_SESSION['key']:'');
|
|
$s_edit_pass=(isset($_SESSION['edit_pass'])?$_SESSION['edit_pass']:'');
|
|
$trip_key = t_key(h($s_name), h($s_key));
|
|
$full_name = h($s_name).'◆'.$trip_key;
|
|
$user_revel_file = $d_root.'/sqlike/user/revel/'.encode_a(h($s_name)).'('.encode_a($trip_key).').txt';
|
|
if (file_exists($user_revel_file)){
|
|
$post_count = (int)get($user_revel_file, 1);
|
|
} else {
|
|
$post_count = 0;
|
|
}
|
|
|
|
|
|
//新着ボード
|
|
if (!empty($s_key) && ($post_count >= 5)){
|
|
$user_board_list = [];
|
|
$user_boards = scandir($bbs_dir.'/user_board');
|
|
foreach ($user_boards as $user_board){
|
|
if (preg_match('/^[0-9]+\.txt$/', $user_board) === 1){
|
|
$board = str_replace('.txt', '', $user_board);
|
|
$user_board_path = $bbs_dir.'/user_board/'.$user_board;
|
|
$board_head = get($user_board_path, 1);
|
|
if ($board_head !== false){
|
|
list($board_title, $board_description, $board_content, $board_access_passwd, $board_edit_passwd) = explode("'", $board_head);
|
|
if ($full_name === get($user_board_path, 2)){
|
|
$user_board_list[filemtime($bbs_dir.'/'.$board).'.'.$board] = [$board, $board_title];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
krsort($user_board_list, SORT_NUMERIC);
|
|
foreach ($user_board_list as $date => $d){
|
|
echo '<tr><td><a href="/board.php?Board='.$d[0].'">'.$d[1].'</a></td><td>'.$d[0].'番</td><td><form action="mkboard.php" method="POST" style="float:none;"><input type="hidden" name="session_num" value="'.$session_num.'"><input type="hidden" name="board" value="'.$d[0].'"><button type="submit" name="submit" value="edit">編集</button></form></td></tr>';
|
|
}
|
|
} else {
|
|
echo '<tr><td colspan="3">まだありません</td></tr>';
|
|
}
|
|
|
|
echo $html[0];
|
|
|
|
|
|
|
|
if (!empty($s_key) && ($post_count >= 5)){
|
|
echo '<form action="./mkboard.php" method="POST" id="form">
|
|
<h2>新規作成</h2>
|
|
<input type="hidden" name="session_num" value="'.$session_num.'">
|
|
<input type="hidden" name="full_name" value="'.$full_name.'">
|
|
<p><label><b>タイトル</b><input type="text" name="title"></label></p>
|
|
<p><label>説明<input type="text" name="description" style="width:75%;"></label></p>
|
|
<p><label>コンテンツ<br><textarea rows="8" name="content"></textarea></label></p>
|
|
<p>コンテンツをHTMLとしますか? (HTMLが分からない方は「いいえ」にチェックして下さい)<br>
|
|
<label><input type="radio" name="html" value="yes" checked>はい</label> <label><input type="radio" name="html" value="no">いいえ</label></p>
|
|
<p><br></p>
|
|
<p>パスワード:<br><label>入室<input type="text" name="access_pass"></label><label><b>管理</b><input type="text" name="edit_pass" value="'.$s_edit_pass.'"></label></p>
|
|
<p><label style="float:right;">作成は此方→<button name="submit" value="mkboard" class="enter">確認</button></label></p>
|
|
<p></p>
|
|
</form>';
|
|
}
|
|
|
|
|
|
echo $html[1].'<p>*あなたは<b>'.$post_count.'回</b>投稿しています。</p>';
|
|
|
|
html_foot('', '');
|