Fix: revised php code to admin
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestro_id = $_POST["maestro_id"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$query = "UPDATE moty_maestro SET ActivateStatus=1 WHERE MaestroID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('i', $maestro_id);
|
||||
$stmt->bind_param("i", $maestro_id);
|
||||
$stmt->execute();
|
||||
|
||||
if($stmt->affected_rows <= 0) {
|
||||
send_error_message($replyJSON, "마에스트로 계정 활성화 실패");
|
||||
$db_conn->close();
|
||||
set_error_message("마에스트로 계정 활성화 실패");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -1,28 +1,28 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroName = $_POST["maestro_name"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
$replyJSON = null;
|
||||
|
||||
|
||||
$maestroList = null;
|
||||
if(strlen($maestroName) === 0)
|
||||
$replyJSON = get_maestro_list();
|
||||
$maestroList = get_maestro_list();
|
||||
else
|
||||
$replyJSON = get_maestro_list_by_name($maestroName);
|
||||
$maestroList = get_maestro_list_by_name($maestroName);
|
||||
|
||||
if(strlen($replyJSON) === 0) {
|
||||
send_error_message($replyJSON, "오늘의 랭킹 기록 없음");
|
||||
$db_conn->close();
|
||||
if(strlen($maestroList) === 0) {
|
||||
set_error_message("오늘의 랭킹 기록 없음");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
set_data("maestroList", $maestroList);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
function get_maestro_list() {
|
||||
@@ -34,21 +34,20 @@ function get_maestro_list() {
|
||||
ORDER BY MaestroID DESC
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
|
||||
// $stmt->bind_param('ii', $maestroName, $startNo);
|
||||
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
|
||||
// $stmt->bind_param("ii", $maestroName, $startNo);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestroID, $name, $accountType);
|
||||
|
||||
$maestroList = array();
|
||||
while($stmt->fetch()) {
|
||||
$maestro['MaestroID'] = $maestroID;
|
||||
$maestro['Name'] = $name;
|
||||
$maestro['AccountType'] = $accountType;
|
||||
$maestro["maestroID"] = $maestroID;
|
||||
$maestro["maestroName"] = $name;
|
||||
$maestro["accountType"] = $accountType;
|
||||
array_push($maestroList, $maestro);
|
||||
}
|
||||
|
||||
$return_array['MaestroList'] = $maestroList;
|
||||
return $return_array;
|
||||
return $maestroList;
|
||||
}
|
||||
|
||||
function get_maestro_list_by_name($maestroName) {
|
||||
@@ -60,21 +59,20 @@ function get_maestro_list_by_name($maestroName) {
|
||||
ORDER BY MaestroID DESC
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param('s', $maestroName);
|
||||
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param("s", $maestroName);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestroID, $name, $accountType);
|
||||
|
||||
$maestroList = array();
|
||||
while($stmt->fetch()) {
|
||||
$maestro['MaestroID'] = $maestroID;
|
||||
$maestro['Name'] = $name;
|
||||
$maestro['AccountType'] = $accountType;
|
||||
$maestro["maestroID"] = $maestroID;
|
||||
$maestro["maestroName"] = $name;
|
||||
$maestro["accountType"] = $accountType;
|
||||
array_push($maestroList, $maestro);
|
||||
}
|
||||
|
||||
$return_array['MaestroList'] = $maestroList;
|
||||
return $return_array;
|
||||
return $maestroList;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
@@ -8,10 +8,10 @@ $maestro_name = $_POST["maestro_name"];
|
||||
$password = $_POST["password"];
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
send_error_code("생년월일이 숫자가 아닙니다. : ".$enterCode);
|
||||
exit;
|
||||
} else if(strlen($enterCode) != 6) {
|
||||
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
||||
send_error_code("6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : ".$enterCode);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
@@ -30,7 +30,7 @@ if($login_data === null || $login_data[maestroID] === null) {
|
||||
exit;
|
||||
}
|
||||
|
||||
set_data("maestroId", $login_data[maestroID]);
|
||||
set_data("maestroID", $login_data[maestroID]);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
@@ -41,7 +41,7 @@ function get_maestro_id($maestro_name) {
|
||||
|
||||
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('s', $maestro_name);
|
||||
$stmt->bind_param("s", $maestro_name);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestro_id);
|
||||
// while($stmt->fetch()) {
|
||||
@@ -58,7 +58,7 @@ function login($maestro_name, $password) {
|
||||
|
||||
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=? AND Password=PASSWORD(?)";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ss', $maestro_name, $password);
|
||||
$stmt->bind_param("ss", $maestro_name, $password);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestro_id);
|
||||
// while($stmt->fetch())
|
||||
|
||||
Reference in New Issue
Block a user