Browse Source

server を別リポジトリに移動

main
Miteruzo 1 year ago
parent
commit
81347dbb7e
23 changed files with 0 additions and 110 deletions
  1. +0
    -0
      .gitignore
  2. +0
    -0
      assets/MusMus-BGM-097.mp3
  3. +0
    -0
      assets/bg.jpg
  4. +0
    -0
      assets/eating-kusa.wav
  5. +0
    -0
      assets/goatoh-face-closed-closed.png
  6. +0
    -0
      assets/goatoh-face-closed-open.png
  7. +0
    -0
      assets/goatoh-face-open-closed.png
  8. +0
    -0
      assets/goatoh-face-open-open.png
  9. +0
    -0
      assets/goatoh-head.png
  10. +0
    -0
      assets/goatoh-leg.png
  11. +0
    -0
      assets/goatoh-tail.png
  12. +0
    -0
      assets/goatoh-tarso.png
  13. +0
    -0
      assets/mumumumu.wav
  14. +0
    -0
      icon.png
  15. +0
    -0
      main.hsp
  16. +0
    -0
      modules/chat.mod.hsp
  17. +0
    -0
      modules/goatoh.mod.hsp
  18. +0
    -2
      server/.gitignore
  19. +0
    -12
      server/chat.php
  20. +0
    -7
      server/config.sample.php
  21. +0
    -27
      server/migrations/2023_06_29_220600_create_chats_table.sql
  22. +0
    -22
      server/migrations/2023_06_29_224300_create_users_table.sql
  23. +0
    -40
      server/modules/chat.mod.php

android/.gitignore → .gitignore View File


android/assets/MusMus-BGM-097.mp3 → assets/MusMus-BGM-097.mp3 View File


android/assets/bg.jpg → assets/bg.jpg View File


android/assets/eating-kusa.wav → assets/eating-kusa.wav View File


android/assets/goatoh-face-closed-closed.png → assets/goatoh-face-closed-closed.png View File


android/assets/goatoh-face-closed-open.png → assets/goatoh-face-closed-open.png View File


android/assets/goatoh-face-open-closed.png → assets/goatoh-face-open-closed.png View File


android/assets/goatoh-face-open-open.png → assets/goatoh-face-open-open.png View File


android/assets/goatoh-head.png → assets/goatoh-head.png View File


android/assets/goatoh-leg.png → assets/goatoh-leg.png View File


android/assets/goatoh-tail.png → assets/goatoh-tail.png View File


android/assets/goatoh-tarso.png → assets/goatoh-tarso.png View File


android/assets/mumumumu.wav → assets/mumumumu.wav View File


android/icon.png → icon.png View File


android/main.hsp → main.hsp View File


android/modules/chat.mod.hsp → modules/chat.mod.hsp View File


android/modules/goatoh.mod.hsp → modules/goatoh.mod.hsp View File


+ 0
- 2
server/.gitignore View File

@@ -1,2 +0,0 @@
/config.php


+ 0
- 12
server/chat.php 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);


+ 0
- 7
server/config.sample.php View File

@@ -1,7 +0,0 @@
<?php

return ['host' => 'localhost', // MySQL のアドレス
'port' => 3306, // MySQL のポート番号
'user' => 'root', // MySQL のユーザ名
'pass' => '']; // MySQL のパスワード


+ 0
- 27
server/migrations/2023_06_29_220600_create_chats_table.sql View File

@@ -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 = 'チャット';


+ 0
- 22
server/migrations/2023_06_29_224300_create_users_table.sql View File

@@ -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 = 'ユーザ';


+ 0
- 40
server/modules/chat.mod.php 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");
}
}


Loading…
Cancel
Save