Add: Real server

This commit is contained in:
2018-06-22 20:58:24 +09:00
parent 225c6e944e
commit 2d4c3af9e0
13 changed files with 14 additions and 34 deletions
-2
View File
@@ -1,8 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../send_error_code.php";
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
@@ -1,8 +1,6 @@
<?php <?php
header("Content-Type: application/json"); header("Content-Type: application/json");
include "./../send_error_code.php";
$maestro_id = $_POST["maestro_id"]; $maestro_id = $_POST["maestro_id"];
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
@@ -1,8 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../send_error_code.php";
$maestro_id = $_POST["maestro_id"]; $maestro_id = $_POST["maestro_id"];
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
@@ -1,8 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../send_error_code.php";
$maestro_id = $_POST["maestro_id"]; $maestro_id = $_POST["maestro_id"];
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
-2
View File
@@ -1,8 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../send_error_code.php";
$maestro_id = $_POST["MaestroID"]; $maestro_id = $_POST["MaestroID"];
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
$user_id = $_POST["UserID"]; $user_id = $_POST["UserID"];
@@ -1,8 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../lib/send_error_code.php";
$maestro_id = $_POST["MaestroID"]; $maestro_id = $_POST["MaestroID"];
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
$date = $_POST["Date"]; $date = $_POST["Date"];
@@ -1,8 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../lib/send_error_code.php";
$maestro_id = $_POST["MaestroID"]; $maestro_id = $_POST["MaestroID"];
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
$date = $_POST["Date"]; $date = $_POST["Date"];
@@ -1,8 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../lib/send_error_code.php";
$maestro_id = $_POST["MaestroID"]; $maestro_id = $_POST["MaestroID"];
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
$date = $_POST["Date"]; $date = $_POST["Date"];
@@ -1,8 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../send_error_code.php";
$maestro_id = $_POST["MaestroID"]; $maestro_id = $_POST["MaestroID"];
$user_id = $_POST["UserID"]; $user_id = $_POST["UserID"];
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
+8 -10
View File
@@ -1,13 +1,11 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../send_error_code.php";
$maestro_id = $_POST["MaestroID"]; $maestro_id = $_POST["MaestroID"];
$user_id = $_POST["UserID"]; $user_id = $_POST["UserID"];
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
$best_record = $_POST["BestRecord"]; $best_record = $_POST["BestRecord"];
echo $best_record." / "; // echo $best_record." / ";
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
@@ -15,15 +13,15 @@ $prev_best_record_id = -1;
$prev_best_record = 0; $prev_best_record = 0;
$prev_best_record_id = get_best_record($maestro_id, $app_id, $user_id); $prev_best_record_id = get_best_record($maestro_id, $app_id, $user_id);
// echo $prev_best_record_id." ".$prev_best_record; // echo "id : ".$prev_best_record_id." ".$prev_best_record;
if($prev_best_record_id == "") { if($prev_best_record_id < 0) {
echo "insert"; // echo "insert";
insert_best_record($maestro_id, $app_id, $user_id, $best_record); insert_best_record($maestro_id, $app_id, $user_id, $best_record);
} else { } else {
echo $best_record." ".$prev_best_record; // echo $best_record." ".$prev_best_record;
if($best_record > $prev_best_record) { if($best_record > $prev_best_record) {
echo "update"; // echo "update";
update_best_record($prev_best_record_id, $best_record); update_best_record($prev_best_record_id, $best_record);
} }
} }
@@ -62,7 +60,7 @@ function insert_best_record($maestro_id, $app_id, $user_id, $best_record) {
VALUES (?, ?, ?, ?, NOW()); VALUES (?, ?, ?, ?, NOW());
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('iiii', $maestro_id, $user_id, $app_id, $best_record); $stmt->bind_param('iiid', $maestro_id, $user_id, $app_id, $best_record);
$stmt->execute(); $stmt->execute();
} }
@@ -75,7 +73,7 @@ function update_best_record($prev_best_record_id, $best_record) {
WHERE BestRecordID = ? AND DATE(RecordDateTime) = DATE(NOW()) AND HOUR(RecordDateTime) = HOUR(NOW()) WHERE BestRecordID = ? AND DATE(RecordDateTime) = DATE(NOW()) AND HOUR(RecordDateTime) = HOUR(NOW())
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $best_record, $prev_best_record_id); $stmt->bind_param('di', $best_record, $prev_best_record_id);
$stmt->execute(); $stmt->execute();
} }
+2 -2
View File
@@ -1,9 +1,9 @@
<?php <?php
$hasServiceDBSetting = file_exists("./service_db_setting.php"); $hasServiceDBSetting = file_exists("./../setup/service_db_setting.php");
if($hasServiceDBSetting == true) { if($hasServiceDBSetting == true) {
include("./service_db_setting.php"); include("./../setup/service_db_setting.php");
} else { } else {
$db_host = "localhost"; $db_host = "localhost";
$db_user = "afterschool"; $db_user = "afterschool";
-2
View File
@@ -1,8 +1,6 @@
<?php <?php
header('Content-Type: application/json'); header('Content-Type: application/json');
include "./../send_error_code.php";
$maestro_name = $_POST["maestro_name"]; $maestro_name = $_POST["maestro_name"];
$name = $_POST["name"]; $name = $_POST["name"];
$enterCode = $_POST["enter_code"]; $enterCode = $_POST["enter_code"];
+4 -2
View File
@@ -14,7 +14,7 @@ CREATE TABLE moty_user (
UserID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, UserID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL, MaestroID INT UNSIGNED NOT NULL,
Name CHAR(50) NOT NULL, Name CHAR(50) NOT NULL,
EnterCode CHAR(6) NOT NULL EnterCode CHAR(6) NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID) FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID)
); );
@@ -24,7 +24,9 @@ CREATE TABLE moty_user (
CREATE TABLE moty_app ( CREATE TABLE moty_app (
AppID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, AppID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
AppName CHAR(40) NOT NULL, AppName CHAR(40) NOT NULL,
AppType INT UNSIGNED NOT NULL KoreanName CHAR(40) NOT NULL,
AppType INT UNSIGNED NOT NULL,
HowToPlay TEXT NOT NULL
); );
CREATE TABLE moty_active_app ( CREATE TABLE moty_active_app (