PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_MULTI_STATEMENTS => false ); $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option); } catch(PDOException $e) { // 接続エラーのときエラー内容を取得する $error_message[] = $e->getMessage(); } $Get_Post_Json = file_get_contents("php://input"); if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) { //トークン取得 if(!(empty($_GET['token']))){ $token = safetext($_GET['token']); }else{ $post_json = json_decode($Get_Post_Json, true); if(isset($post_json["token"])){ $token = safetext($post_json["token"]); }else{ $err = "input_not_found"; $response = array( 'error_code' => $err, 'success' => false ); echo json_encode($response, JSON_UNESCAPED_UNICODE); exit; } } if($token == ""){ $err = "input_not_found"; $response = array( 'error_code' => $err, 'success' => false ); echo json_encode($response, JSON_UNESCAPED_UNICODE); exit; } session_start(); if( !empty($pdo) ) { $AuthData = APIAuth($pdo, $token, "read:ueuse"); if($AuthData[0] === true){ $userData = $AuthData[2]; //本文取得 if(!(empty($_GET['uniqid']))){ $fav_uniqid = safetext($_GET['uniqid']); }elseif(!(empty($post_json["uniqid"]))){ $fav_uniqid = safetext($post_json["uniqid"]); } if(!(empty($fav_uniqid))){ $res = getFavorite($pdo, $fav_uniqid); if($res[0] === true){ $response = array( 'favorite_list' => decode_yajirushi(htmlspecialchars_decode($res[2])), 'success' => true ); echo json_encode($response, JSON_UNESCAPED_UNICODE); }else{ $err = "input_not_found"; $response = array( 'error_code' => $err, 'success' => false ); echo json_encode($response, JSON_UNESCAPED_UNICODE); } }else{ $err = "input_not_found"; $response = array( 'error_code' => $err, 'success' => false ); echo json_encode($response, JSON_UNESCAPED_UNICODE); } }else{ $err = $AuthData[1]; $response = array( 'error_code' => $err, 'success' => false ); echo json_encode($response, JSON_UNESCAPED_UNICODE); } } }else{ $err = "input_not_found"; $response = array( 'error_code' => $err, 'success' => false ); echo json_encode($response, JSON_UNESCAPED_UNICODE); } ?>