diff --git a/.gitignore b/.gitignore
index 7530e88..20ecc9c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-/image
-/draft
+/images
+/drafts
/database.php
diff --git a/assets/kusobbs.gif b/assets/kusobbs.gif
new file mode 100644
index 0000000..863b0c8
Binary files /dev/null and b/assets/kusobbs.gif differ
diff --git a/music.mp3 b/assets/music.mp3
similarity index 100%
rename from music.mp3
rename to assets/music.mp3
diff --git a/database.example.php b/database.example.php
new file mode 100644
index 0000000..57d0d3e
--- /dev/null
+++ b/database.example.php
@@ -0,0 +1,12 @@
+
+
+
+
+
+ = ($title == '') ? '' : ($title . ' - ') ?>キケッツチャンネル お絵描き掲示板
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ query ("SELECT * FROM threads WHERE id <> 1 ORDER BY latest DESC")): ?>
+ fetch_assoc ()): ?>
+
+
+
+
+
+ '): ?>
+
+ = $row['explain'] ?> |
+
+
+
+
+
+
+
+
+
+
+
+
+ '): ?>
+
+ = $explain ?> |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ query ("
+ SELECT
+ response_id as id, name, message, date, image, held, deleted, pass, good, bad, good - bad as evaluate
+ FROM
+ responses
+ WHERE
+ thread_id = $thread
+ ORDER BY
+ " . (($sort == 'td')
+ ? 'id DESC'
+ : (($sort == 'eg')
+ ? 'evaluate DESC, id DESC'
+ : (($sort == 'ta')
+ ? 'id ASC'
+ : (($sort == 'eb')
+ ? 'evaluate ASC, id DESC'
+ : 'id DESC')))))):
+?>
+ fetch_assoc ()): ?>
+
+
+
+
+
+
+
+
+
+ 削除されました. |
+
+ 確認中です. |
+
+ |
+
+
+
+
+
+ close ();
+ endif;
+?>
+
+
+ レス削除
+ 削除したいレス番号と削除用パスワードを入力して “削除” を押してください.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/index.php b/index.php
index 8a1e274..45763d2 100644
--- a/index.php
+++ b/index.php
@@ -1,31 +1,29 @@
set_charset ('utf8');
-if ($result = $mysqli -> query ("SELECT * FROM threads WHERE id = $thread")):
+if ($result = $mysqli -> query ("SELECT * FROM threads WHERE id = $thread"))
+ {
$row = $result -> fetch_assoc ();
$title = $row['title'];
$explain = $row['explain'];
$result -> close ();
-endif;
+ }
if (isset ($_GET['id'])
&& isset ($_GET['evaluate'])
- && (($_GET['evaluate'] == 'good') || ($_GET['evaluate'] == 'bad'))):
+ && (($_GET['evaluate'] == 'good') || ($_GET['evaluate'] == 'bad')))
+ {
$mysqli -> query ("
UPDATE
responses
@@ -54,346 +54,7 @@ if (isset ($_GET['id'])
(thread_id = $thread) AND (response_id = {$_GET['id']})");
header ("Location: ./?thread=$thread&sort=$sort");
-endif;
-?>
-
+ }
-
-
-
-
- = ($title == '') ? '' : ($title . ' - ') ?>キケッツチャンネル お絵描き掲示板
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Canvas のサイズを変更
-
-
-
-
-
-
-
-
-
-
- query ("SELECT * FROM threads WHERE id <> 1 ORDER BY latest DESC")):
- while ($row = $result -> fetch_assoc ()):
-?>
-
-
-
-
-
-'):
-?>
-
-
- = $row['explain'] ?> |
-
-
-')
- endwhile; // end of ($row = $result -> fetch_assoc ())
- endif; // end of ($result = $mysqli -> query ("SELECT * FROM threads ORDER BY latest DESC"))
-else: // $thread != -1
-?>
-
-
-
-
-
-
-'):
-?>
-
- = $explain ?> |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- query ("
- SELECT
- response_id as id, name, message, date, image, held, deleted, pass, good, bad, good - bad as evaluate
- FROM
- responses
- WHERE
- thread_id = $thread
- ORDER BY
- " . (($sort == 'td')
- ? 'id DESC'
- : (($sort == 'eg')
- ? 'evaluate DESC, id DESC'
- : (($sort == 'ta')
- ? 'id ASC'
- : (($sort == 'eb')
- ? 'evaluate ASC, id DESC'
- : 'id DESC')))))):
- while ($row = $result -> fetch_assoc ()):
-?>
-
-
-
-
-
-
-
-
-
- 削除されました. |
-
- 確認中です. |
-
- |
-
-
-
- close ();
- endif;
-?>
-
-
- レス削除
- 削除したいレス番号と削除用パスワードを入力して “削除” を押してください.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+require_once './forms/index.frm.php';
diff --git a/migrate.php b/migrate.php
new file mode 100644
index 0000000..27fc12d
--- /dev/null
+++ b/migrate.php
@@ -0,0 +1,10 @@
+ query (file_get_contents ($file));
+
diff --git a/migrations/2023_09_01_011340_create_threads_table.sql b/migrations/2023_09_01_011340_create_threads_table.sql
new file mode 100644
index 0000000..cf0e292
--- /dev/null
+++ b/migrations/2023_09_01_011340_create_threads_table.sql
@@ -0,0 +1,2 @@
+CREATE TABLE `miteruzo_bbs`.`threads` ( `id` INT NOT NULL AUTO_INCREMENT , `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , `explain` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , `latest` DATETIME NOT NULL , `length` INT NOT NULL DEFAULT '0' , PRIMARY KEY (`id`)) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
+
diff --git a/migrations/2023_09_01_012000_create_responses_table.sql b/migrations/2023_09_01_012000_create_responses_table.sql
new file mode 100644
index 0000000..90d6217
--- /dev/null
+++ b/migrations/2023_09_01_012000_create_responses_table.sql
@@ -0,0 +1,2 @@
+CREATE TABLE `miteruzo_bbs`.`responses` ( `thread_id` INT NOT NULL , `response_id` INT NOT NULL , `name` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '名なしさん' , `message` MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , `date` DATETIME NOT NULL , `image` VARCHAR(31) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL , `held` TINYINT NOT NULL DEFAULT '0' , `deleted` TINYINT NOT NULL DEFAULT '0' , `pass` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL , `good` INT NOT NULL DEFAULT '0' , `bad` INT NOT NULL DEFAULT '0' , PRIMARY KEY (`thread_id`, `response_id`)) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;
+
diff --git a/backup.php b/modules/backup.php
similarity index 87%
rename from backup.php
rename to modules/backup.php
index bc7fe68..267271b 100644
--- a/backup.php
+++ b/modules/backup.php
@@ -1,17 +1,19 @@
query ("
WHERE
(thread_id = $thread) AND (response_id = $id)");
- echo "消しましたぁ!!
";
+ echo "消しましたぁ!!
";
else:
echo '残念.
削除用パスワードが違います.';
endif;
- echo "
5 秒後に元のページに戻ります.
戻らない場合はこちら";
+ echo "
5 秒後に元のページに戻ります.
戻らない場合はこちら";
endif;
diff --git a/make_thread.php b/modules/make_thread.php
similarity index 88%
rename from make_thread.php
rename to modules/make_thread.php
index ec94c92..8ae4b56 100644
--- a/make_thread.php
+++ b/modules/make_thread.php
@@ -17,7 +17,7 @@ if (!(empty ($_POST['thread-name'])))
$result -> close ();
- $sql = "INSERT INTO threads (id, title, `explain`, latest, length) VALUES ($current, '{$_POST['thread-name']}', '$explain', '" . date ('Y-m-d H:i:s') . "', 0)";
+ $sql = "INSERT INTO threads (title, `explain`, latest, length) VALUES ('{$_POST['thread-name']}', '$explain', '" . date ('Y-m-d H:i:s') . "', 0)";
$mysqli -> query ($sql);
/* $sql = "CREATE TABLE `miteruzo_bbs`.`thread_$current` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'レス番',
@@ -37,5 +37,5 @@ if (!(empty ($_POST['thread-name'])))
$mysqli -> close ();
}
-header ("location: ./?thread=$current");
+header ("location: ../?thread=$current");
diff --git a/upload.php b/modules/upload.php
similarity index 95%
rename from upload.php
rename to modules/upload.php
index 69c0cc7..58a12ae 100644
--- a/upload.php
+++ b/modules/upload.php
@@ -2,10 +2,10 @@
require "${_SERVER['DOCUMENT_ROOT']}/database.php";
-define ('SAVE_DIR', 'image/'); // 保存ディレクトリ定義
+define ('SAVE_DIR', "${_SERVER['DOCUMENT_ROOT']}/images/"); // 保存ディレクトリ定義
$thread = $_GET['thread'];
-file_put_contents ('log.txt', $thread);
+// file_put_contents ('log.txt', $thread);
$json = getParamJSON (); // JSON パラメタ
diff --git a/modules/colour-pad.js b/scripts/colour-pad.js
similarity index 100%
rename from modules/colour-pad.js
rename to scripts/colour-pad.js
diff --git a/paint.js b/scripts/paint.js
similarity index 98%
rename from paint.js
rename to scripts/paint.js
index 9a808d1..c5f4e50 100644
--- a/paint.js
+++ b/scripts/paint.js
@@ -219,11 +219,11 @@ SendToServer (backup)
mode: 'cors'};
if (backup)
- await SendServer (`backup.php?id=${uniqId}`, param);
+ await SendServer (`/modules/backup.php?id=${uniqId}`, param);
else
{
// SendServer (`upload.php?name=${userName.value}&pass=${password.value}&msg=${message.value}`, param);
- await SendServer (`upload.php${window.location.search}&name=${userName.value}&pass=${password.value}&held=${held ? 1 : 0}&uniqid=${uniqId}`, param);
+ await SendServer (`/modules/upload.php${window.location.search}&name=${userName.value}&pass=${password.value}&held=${held ? 1 : 0}&uniqid=${uniqId}`, param);
}
}
@@ -872,7 +872,7 @@ deletePostReally ()
{
const searchParams = new URLSearchParams (window.location.search);
- window.location.href = `./delete.php?thread=${searchParams.get (
+ window.location.href = `./modules/delete.php?thread=${searchParams.get (
'thread')}&id=${delId.value}&pass=${delPass.value}`;
}
else
diff --git a/script.js b/scripts/script.js
similarity index 94%
rename from script.js
rename to scripts/script.js
index a3cd596..2360a09 100644
--- a/script.js
+++ b/scripts/script.js
@@ -1,6 +1,6 @@
-const music = new Audio ('music.mp3'); // BGM
-let playing = false; // 再生フラグ
-let nowPlay = true; // 再生すべきかどぅか
+const music = new Audio ('./assets/music.mp3'); // BGM
+let playing = false; // 再生フラグ
+let nowPlay = true; // 再生すべきかどぅか
document.getElementById ('sort').addEventListener ('change', sortChange);
diff --git a/style.css b/style.css
deleted file mode 100644
index 57f4775..0000000
--- a/style.css
+++ /dev/null
@@ -1,104 +0,0 @@
-body
-{
- background-color: aquamarine;
-}
-
-table
-{
- margin: 24px auto 40px;
-}
-
-td
-{
- padding: 8px;
-}
-
-table, td
-{
- border: solid 1px;
- background-color: white;
-}
-
-#paint
-{
- margin-bottom: 64px;
-}
-
-#paint > div
-{
- margin: 24px auto;
-}
-
-h1, .illust
-{
- text-align: center;
-}
-
-.radio
-{
- /* width: 704px; */
- /* display: inline-block; */
- vertical-align: middle;
- line-height: 1.5em;
- /* margin: auto; */
-}
-
-.button-area, .canvas-area
-{
- text-align: center;
-}
-
-.canvas-area
-{
- width: 480px;
- height: 480px;
- max-width: 100%;
- position: relative;
- padding: 0;
- box-sizing: content-box;
-}
-
-.canvas-area:before
-{
- content: "";
- display: block;
- padding-top: 100%;
-}
-
-.canvas-area > canvas
-{
- position: absolute;
- left: 0;
- top: 0;
- border: 1px solid;
- max-width: 100%;
- box-sizing: content-box;
- padding: 0;
- margin: 0;
-}
-
-.modal {
- display: none;
- position: fixed;
- z-index: 1;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- background-color: rgba(0, 0, 0, 0.4);
-}
-
-.modal-content {
- background-color: #fff;
- margin: 15% auto;
- padding: 20px;
- border: 1px solid #888;
- width: 400px;
- text-align: center;
-}
-
-@media only screen and (max-width: 600px) {
- .modal-content {
- width: 70%;
- }
-}
diff --git a/styles/style.css b/styles/style.css
new file mode 100644
index 0000000..4788483
--- /dev/null
+++ b/styles/style.css
@@ -0,0 +1,240 @@
+html
+{
+ font-size: 24px;
+ font-family: "Helvetica Neue", "Helvetica", "Segoe UI", "Arial",
+ "JPAGothic", "IPAGothic",
+ "Hiragino Sans", "Hiragino Kaku Gothic ProN",
+ "Yu Gothic", "Meiryo", "MS Gothic",
+ sans-serif;
+ width: 960px;
+ text-align: justify;
+ margin: auto;
+ punctuation-trim: adjacent;
+}
+
+em
+{
+ font-style: normal;
+ font-size: 120%;
+ font-weight: bold;
+ color: red;
+ font-family: "Helvetica Neue", "Helvetica", "Segoe UI", "Arial",
+ "JPAGothic", "IPAGothic",
+ "Hiragino Sans", "Hiragino Kaku Gothic ProN",
+ "Yu Gothic", "Meiryo", "MS Gothic",
+ sans-serif;
+}
+
+.miteruzochan
+{
+ white-space: nowrap;
+}
+
+section
+{
+ margin-bottom: 3em;
+}
+
+p:not(.noindent)
+{
+ text-indent: 1em;
+}
+
+p
+{
+ margin: 0 2em;
+ line-height: 3em;
+}
+
+.copy
+{
+ font-size: 200%;
+ font-weight: bold;
+ font-style: italic;
+ text-align: center;
+ font-family: "Times New Roman",
+ "JPAMincho", "IPAMincho", "Hiragino Mincho ProN",
+ "Yu Mincho", "MS Mincho",
+ serif;
+ margin: 1em 0;
+}
+
+footer
+{
+ font-size: 16px;
+ color: dimgray;
+ text-align: center;
+ line-height: 2em;
+ padding-bottom: 24px;
+}
+
+footer > div
+{
+ margin: 24px 0;
+}
+
+.copyright
+{
+ text-align: center;
+ margin: 24px 0;
+}
+
+footer a
+{
+ color: darkslategray;
+}
+
+a
+{
+ text-decoration: none;
+}
+
+div.paragraph
+{
+ margin-bottom: 1.5em;
+}
+
+table
+{
+ margin: auto;
+}
+
+tr:nth-child(odd)
+{
+ background-color: lightgray;
+}
+
+th, td
+{
+ padding: 8px 16px;
+}
+
+#title
+{
+ text-align: left;
+ display: inline-block;
+}
+
+#translate
+{
+ text-align: right;
+ display: inline-block;
+ width: 288px;
+}
+
+header
+{
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+button, input
+{
+ font-size: 24px;
+}
+
+body
+{
+ background-color: aquamarine;
+}
+
+table
+{
+ margin: 24px auto 40px;
+}
+
+td
+{
+ padding: 8px;
+}
+
+table, td
+{
+ border: solid 1px;
+ background-color: white;
+}
+
+#paint
+{
+ margin-bottom: 64px;
+}
+
+#paint > div
+{
+ margin: 24px auto;
+}
+
+h1, .illust
+{
+ text-align: center;
+}
+
+.radio
+{
+ /* width: 704px; */
+ /* display: inline-block; */
+ vertical-align: middle;
+ line-height: 1.5em;
+ /* margin: auto; */
+}
+
+.button-area, .canvas-area
+{
+ text-align: center;
+}
+
+.canvas-area
+{
+ width: 480px;
+ height: 480px;
+ max-width: 100%;
+ position: relative;
+ padding: 0;
+ box-sizing: content-box;
+}
+
+.canvas-area:before
+{
+ content: "";
+ display: block;
+ padding-top: 100%;
+}
+
+.canvas-area > canvas
+{
+ position: absolute;
+ left: 0;
+ top: 0;
+ border: 1px solid;
+ max-width: 100%;
+ box-sizing: content-box;
+ padding: 0;
+ margin: 0;
+}
+
+.modal {
+ display: none;
+ position: fixed;
+ z-index: 1;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.4);
+}
+
+.modal-content {
+ background-color: #fff;
+ margin: 15% auto;
+ padding: 20px;
+ border: 1px solid #888;
+ width: 400px;
+ text-align: center;
+}
+
+@media only screen and (max-width: 600px) {
+ .modal-content {
+ width: 70%;
+ }
+}