server を別リポジトリに移動

This commit is contained in:
2023-06-30 20:05:53 +09:00
parent 2bd0e8a5aa
commit 81347dbb7e
23 changed files with 0 additions and 110 deletions
View File

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 135 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

View File
-2
View File
@@ -1,2 +0,0 @@
/config.php
-12
View File
@@ -1,12 +0,0 @@
<?php
require_once './modules/common.mod.php';
$db = new Chat;
$user_id = $_POST['id'];
$chat_message = $_POST['text'];
$db -> send_chat ($user_id, $chat_message);
-7
View File
@@ -1,7 +0,0 @@
<?php
return ['host' => 'localhost', // MySQL のアドレス
'port' => 3306, // MySQL のポート番号
'user' => 'root', // MySQL のユーザ名
'pass' => '']; // MySQL のパスワード
@@ -1,27 +0,0 @@
CREATE TABLE
IF NOT EXISTS
goatoh_training.chats
(
id
INT
NOT NULL
AUTO_INCREMENT
COMMENT '主キー',
user_id
INT
NOT NULL
COMMENT 'ユーザのキー',
text
TEXT
CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
NOT NULL
COMMENT 'チャット・テキスト',
PRIMARY KEY (id)
)
ENGINE = InnoDB
CHARSET = utf8mb4 COLLATE utf8mb4_general_ci
COMMENT = 'チャット';
@@ -1,22 +0,0 @@
CREATE TABLE
IF NOT EXISTS
goatoh_training.users
(
id
INT
NOT NULL
AUTO_INCREMENT
COMMENT '主キー',
name
VARCHAR(30)
CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
NOT NULL
COMMENT 'ユーザ名',
PRIMARY KEY (id)
)
ENGINE = InnoDB
CHARSET = utf8mb4 COLLATE utf8mb4_general_ci
COMMENT = 'ユーザ';
-40
View File
@@ -1,40 +0,0 @@
<?php
class
Chat
{
var $db;
function
__construct ()
{
$config = include (__DIR__ . '/config.php');
$db_host = $config['host'];
$db_port = $config['port'];
$db_user = $config['user'];
$db_pass = $config['pass'];
$this -> db = new mysqli ($db_host, $db_user, $db_pass, 'goatoh_training',
$db_port);
}
function
send_chat (
int $user_id,
string $text):
void
{
$sql = "
INSERT INTO
chats (
id,
text)
VALUES
(
$user_id,
'$text')";
$this -> db -> query ($sql) or die ("db_insert error $sql");
}
}