<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<title><?php echo $title;?></title>
<link rel="stylesheet" href="./css/swiper.min.css">
<link rel="stylesheet" href="./css/style.css">
<script src="./js/style.js?ver=<?php echo APMS_SVER; ?>"></script>
</head>
<body>
<div class="swiper-container">
	<div class="parallax-bg" data-swiper-parallax="-23%"></div>
	<div class="swiper-wrapper">
		<div class="swiper-slide">
			<div class="title" data-swiper-parallax="-100">Remote PC - Auction Purchase</div>
			<div class="subtitle" data-swiper-parallax="-200">"Microsoft Windows 10"</div>
			<div class="text" data-swiper-parallax="-300">
			<table id="table1">
				<tr>
					<th>PC No.</th>
					<!-- <th>DAILY FEE</th>
					<th>DAILY EXT. FEE</th> -->
					<th>LOCATION</th>
					<th>IP</th>
					<th>OS</th>
					<th>CPU</th>
					<th>GPU</th>
					<th>RAM</th>
					<th>SSD</th>
					<th>HDD</th>

				</tr>
				<?php
					$result_api_data = sql_query(" SELECT * FROM api_get_remotepc WHERE rental_stat='렌탈대기' AND auction_on='1' AND OperatingSystem LIKE '%Windows 10%' ORDER BY no DESC LIMIT 10");
					while($api_data = sql_fetch_array($result_api_data)){
						$it_id = $no = $api_data['no'];
						$M_storeid = $api_data['M_storeid'];
						$M_storename = $api_data['M_storename'];
						$extIP = $api_data['extIP'];
						$ip_org = explode(" ", $extIP)[0];
						$ip_parts = explode(".", $ip_org); // IP 주소를 점(.)으로 분리
						// 각 부분을 3자리로 맞추기 위해 앞에 0을 추가
						foreach ($ip_parts as &$part) {
							$part = str_pad($part, 3, '0', STR_PAD_LEFT);
						}
						// 마스킹할 부분을 선택
						$ip_parts[1] = '***';
						$ip_parts[3] = '***';
						// 마스킹된 IP 주소를 다시 조합
						$masked_ip = implode(".", $ip_parts);
						$ip = $masked_ip; // 출력: 111.***.022.***

						$country = explode(" ", $extIP)[1];
						switch($country) {
							case "KR":
								$country = "Korea";
								break;
							case "JP":
								$country = "Japan";
								break;
							case "US":
								$country = "United States";
								break;
							case "CN":
								$country = "China";
								break;
							case "TW":
								$country = "Taiwan";
								break;
							case "HK":
								$country = "Hong Kong";
								break;
							case "SG":
								$country = "Singapore";
								break;
							case "MY":
								$country = "Malaysia";
								break;
							case "TH":
								$country = "Thailand";
								break;
							case "VN":
								$country = "Vietnam";
								break;
							case "ID":
								$country = "Indonesia";
								break;
							case "PH":
								$country = "Philippines";
								break;
							case "AU":
								$country = "Australia";
								break;
							case "NZ":
								$country = "New Zealand";
								break;
							case "CA":
								$country = "Canada";
								break;
							case "BR":
								$country = "Brazil";
								break;
							case "GB":
								$country = "United Kingdom";
								break;
							case "DE":
								$country = "Germany";
								break;
							case "FR":
								$country = "France";
								break;
							case "IT":
								$country = "Italy";
								break;
							case "ES":
								$country = "Spain";
								break;
							case "NL":
								$country = "Netherlands";
								break;
							case "SE":
								$country = "Sweden";
								break;
							case "CH":
								$country = "Switzerland";
								break;
							case "AT":
								$country = "Austria";
								break;
							case "BE":
								$country = "Belgium";
								break;
							case "DK":
								$country = "Denmark";
								break;
							case "FI":
								$country = "Finland";
								break;
							case "IE":
								$country = "Ireland";
								break;
							case "NO":
								$country = "Norway";
								break;
						}
						$intIP = $api_data['intIP'];
						$CpuName_arr = explode("Ž",trim(str_ireplace(array("(R)","(TM)","Intel","AMD","with Radeon Graphics","with Radeon Vega Graphics","CPU","Core "," Cores","Eight-Processor"),array("","","","","","","","","C",""),$api_data['CpuName'])));
						if (count($CpuName_arr) == 1) {
							$CpuName = $CpuName_arr[0];
						} else if (count($CpuName_arr) == 2) {
							$CpuName = "[Dual] " . $CpuName_arr[0];
						} else if (count($CpuName_arr) == 3) {
							$CpuName = "[Triple] " . $CpuName_arr[0];
						} else if (count($CpuName_arr) == 4) {
							$CpuName = "[Quad] " . $CpuName_arr[0];
						}
						$cpu_core = $api_data['cpu_core'];
						$MainBoard = $api_data['MainBoard'];
						$RAM = $api_data['RAM']."GB";
						$SSDinfo = $api_data['SSDinfo'];
						$SSDsize = $api_data['SSDsize'];
						$SSD = $api_data['SSD'];
						$HDDinfo = $api_data['HDDinfo'];
						$HDDsize = $api_data['HDDsize']=="No HDD"?"<div style='width:100%; min-width:40px; text-align:center; margin:0 auto 0;'>-</div>":$api_data['HDDsize'];
						$HDD = $api_data['HDD'];
						$VideoController_arr = explode("Ž",trim(str_ireplace(array("(R)","(TM)"),array("",""),$api_data['VideoController'])));
						if (count($VideoController_arr) == 1) {
							$VideoController = $VideoController_arr[0];
						} else if (count($VideoController_arr) > 1) {
							if ((strpos($VideoController_arr[0], "NVIDIA") !== false) || (strpos($VideoController_arr[0], "AMD") !== false)) {
								$VideoController = $VideoController_arr[0];
							} else if ((strpos($VideoController_arr[1], "NVIDIA") !== false) || (strpos($VideoController_arr[1], "AMD") !== false)) {
								$VideoController = $VideoController_arr[1];
							} else {
								$VideoController = $VideoController_arr[0]."<br>".$VideoController_arr[1];
							}
						}
						$gpu_ram = $api_data['gpu_ram'];
						$OperatingSystem = trim(str_ireplace(array("Microsoft","Windows","(64Bit)"),array("","Win",""),$api_data['OperatingSystem']));
						$rantal_fee_type = $api_data['rantal_fee_type'];
						$rental_fee = $api_data['rental_fee'];
						$rental_setting_fee = $api_data['rental_setting_fee'];
						$rental_fee_first_daily = round(($rental_fee + $rental_setting_fee) / 30);
						$rental_fee_ext_daily = round(($rental_fee) / 30);
						$rental_stat = $api_data['rental_stat'];
						$client_number = $api_data['client_number'];
						$cpu_clock = $api_data['cpu_clock'];
						$AppVer = $api_data['AppVer'];

						// wr_id 추출
						$result_wr_id = sql_fetch(" SELECT wr_id FROM g5_write_auction WHERE pcnum='{$it_id}'");
						$wr_id = $result_wr_id['wr_id'];

						echo "<tr data-href='".G5_BBS_URL."/board.php?bo_table=auction&wr_id={$wr_id}&s=&pcnum={$it_id}'>";
						echo "<td align=center>".$no."</td>";
						echo "<td align=right>".number_format($rental_fee_first_daily)." Point"."</td>";
						echo "<td align=right>".number_format($rental_fee_ext_daily)." Point"."</td>";
						echo "<td align=center>".$country."</td>";
						echo "<td align=center>".$ip."</td>";
						echo "<td>".$OperatingSystem."</td>";
						echo "<td>".$CpuName."</td>";
						echo "<td>".$VideoController."</td>";
						echo "<td align=right>".$RAM."</td>";
						echo "<td align=right>".$SSDsize."</td>";
						echo "<td align=right>".$HDDsize."</td>";
						echo "</tr>";

					}
				?>
			</table>
			</div>
		</div>

		<div class="swiper-slide">
			<div class="title" data-swiper-parallax="-100">Remote PC - General Purchase</div>
			<div class="subtitle" data-swiper-parallax="-200">"Microsoft Windows 10"</div>
			<div class="text" data-swiper-parallax="-300">
				<table id="table1">
					<tr>
						<th>PC No.</th>
						<!-- <th>DAILY FEE</th>
						<th>DAILY EXT. FEE</th> -->
						<th>LOCATION</th>
						<th>IP</th>
						<th>OS</th>
						<th>CPU</th>
						<th>GPU</th>
						<th>RAM</th>
						<th>SSD</th>
						<th>HDD</th>

					</tr>
					<?php
						$result_api_data = sql_query(" SELECT * FROM api_get_remotepc WHERE rental_stat='렌탈대기' AND auction_on='0' AND OperatingSystem LIKE '%Windows 10%' ORDER BY no DESC LIMIT 10");
						while($api_data = sql_fetch_array($result_api_data)){
							$it_id = $no = $api_data['no'];
							$M_storeid = $api_data['M_storeid'];
							$M_storename = $api_data['M_storename'];
							$extIP = $api_data['extIP'];
							$ip_org = explode(" ", $extIP)[0];
							$ip_parts = explode(".", $ip_org); // IP 주소를 점(.)으로 분리
							// 각 부분을 3자리로 맞추기 위해 앞에 0을 추가
							foreach ($ip_parts as &$part) {
								$part = str_pad($part, 3, '0', STR_PAD_LEFT);
							}
							// 마스킹할 부분을 선택
							$ip_parts[1] = '***';
							$ip_parts[3] = '***';
							// 마스킹된 IP 주소를 다시 조합
							$masked_ip = implode(".", $ip_parts);
							$ip = $masked_ip; // 출력: 111.***.022.***

							$country = explode(" ", $extIP)[1];
							switch($country) {
								case "KR":
									$country = "Korea";
									break;
								case "JP":
									$country = "Japan";
									break;
								case "US":
									$country = "United States";
									break;
								case "CN":
									$country = "China";
									break;
								case "TW":
									$country = "Taiwan";
									break;
								case "HK":
									$country = "Hong Kong";
									break;
								case "SG":
									$country = "Singapore";
									break;
								case "MY":
									$country = "Malaysia";
									break;
								case "TH":
									$country = "Thailand";
									break;
								case "VN":
									$country = "Vietnam";
									break;
								case "ID":
									$country = "Indonesia";
									break;
								case "PH":
									$country = "Philippines";
									break;
								case "AU":
									$country = "Australia";
									break;
								case "NZ":
									$country = "New Zealand";
									break;
								case "CA":
									$country = "Canada";
									break;
								case "BR":
									$country = "Brazil";
									break;
								case "GB":
									$country = "United Kingdom";
									break;
								case "DE":
									$country = "Germany";
									break;
								case "FR":
									$country = "France";
									break;
								case "IT":
									$country = "Italy";
									break;
								case "ES":
									$country = "Spain";
									break;
								case "NL":
									$country = "Netherlands";
									break;
								case "SE":
									$country = "Sweden";
									break;
								case "CH":
									$country = "Switzerland";
									break;
								case "AT":
									$country = "Austria";
									break;
								case "BE":
									$country = "Belgium";
									break;
								case "DK":
									$country = "Denmark";
									break;
								case "FI":
									$country = "Finland";
									break;
								case "IE":
									$country = "Ireland";
									break;
								case "NO":
									$country = "Norway";
									break;
							}
							$intIP = $api_data['intIP'];
							$CpuName_arr = explode("Ž",trim(str_ireplace(array("(R)","(TM)","Intel","AMD","with Radeon Graphics","with Radeon Vega Graphics","CPU","Core "," Cores","Eight-Processor"),array("","","","","","","","","C",""),$api_data['CpuName'])));
							if (count($CpuName_arr) == 1) {
								$CpuName = $CpuName_arr[0];
							} else if (count($CpuName_arr) == 2) {
								$CpuName = "[Dual] " . $CpuName_arr[0];
							} else if (count($CpuName_arr) == 3) {
								$CpuName = "[Triple] " . $CpuName_arr[0];
							} else if (count($CpuName_arr) == 4) {
								$CpuName = "[Quad] " . $CpuName_arr[0];
							}
							$cpu_core = $api_data['cpu_core'];
							$MainBoard = $api_data['MainBoard'];
							$RAM = $api_data['RAM']."GB";
							$SSDinfo = $api_data['SSDinfo'];
							$SSDsize = $api_data['SSDsize'];
							$SSD = $api_data['SSD'];
							$HDDinfo = $api_data['HDDinfo'];
							$HDDsize = $api_data['HDDsize']=="No HDD"?"<div style='width:100%; min-width:40px; text-align:center; margin:0 auto 0;'>-</div>":$api_data['HDDsize'];
							$HDD = $api_data['HDD'];
							$VideoController_arr = explode("Ž",trim(str_ireplace(array("(R)","(TM)"),array("",""),$api_data['VideoController'])));
							if (count($VideoController_arr) == 1) {
								$VideoController = $VideoController_arr[0];
							} else if (count($VideoController_arr) > 1) {
								if ((strpos($VideoController_arr[0], "NVIDIA") !== false) || (strpos($VideoController_arr[0], "AMD") !== false)) {
									$VideoController = $VideoController_arr[0];
								} else if ((strpos($VideoController_arr[1], "NVIDIA") !== false) || (strpos($VideoController_arr[1], "AMD") !== false)) {
									$VideoController = $VideoController_arr[1];
								} else {
									$VideoController = $VideoController_arr[0]."<br>".$VideoController_arr[1];
								}
							}
							$gpu_ram = $api_data['gpu_ram'];
							$OperatingSystem = trim(str_ireplace(array("Microsoft","Windows","(64Bit)"),array("","Win",""),$api_data['OperatingSystem']));
							$rantal_fee_type = $api_data['rantal_fee_type'];
							$rental_fee = $api_data['rental_fee'];
							$rental_setting_fee = $api_data['rental_setting_fee'];
							$rental_fee_first_daily = round(($rental_fee + $rental_setting_fee) / 30);
							$rental_fee_ext_daily = round(($rental_fee) / 30);
							$rental_stat = $api_data['rental_stat'];
							$client_number = $api_data['client_number'];
							$cpu_clock = $api_data['cpu_clock'];
							$AppVer = $api_data['AppVer'];

							echo "<tr data-href='".G5_SHOP_URL."/item.php?it_id={$it_id}'>";
							echo "<td align=center>".$no."</td>";
							echo "<td align=right>".number_format($rental_fee_first_daily)." Point"."</td>";
							echo "<td align=right>".number_format($rental_fee_ext_daily)." Point"."</td>";
							echo "<td align=center>".$country."</td>";
							echo "<td align=center>".$ip."</td>";
							echo "<td>".$OperatingSystem."</td>";
							echo "<td>".$CpuName."</td>";
							echo "<td>".$VideoController."</td>";
							echo "<td align=right>".$RAM."</td>";
							echo "<td align=right>".$SSDsize."</td>";
							echo "<td align=right>".$HDDsize."</td>";
							echo "</tr>";

						}
					?>
				</table>
			</div>
		</div>

		<div class="swiper-slide">
			<div class="title" data-swiper-parallax="-100">VPN/PROXY</div>
			<div class="subtitle" data-swiper-parallax="-200">ID & PASSWORD</div>
			<div class="text" data-swiper-parallax="-300">
				<p>
				This service is currently being prepared.
				</p>
			</div>
		</div>
		<div class="swiper-slide">
			<div class="title" data-swiper-parallax="-100">GAME</div>
			<div class="subtitle" data-swiper-parallax="-200">ID & PASSWORD</div>
			<div class="text" data-swiper-parallax="-300">
				<p>
				This service is currently being prepared.
				</p>
			</div>
		</div>
	</div>
	<div class="swiper-pagination swiper-pagination-white"></div>
	<div class="swiper-button-prev swiper-button-white"></div>
	<div class="swiper-button-next swiper-button-white"></div>

	<div class="box-enter">
		<p><img src="./img/logo.png" alt="" class="logo"></p>
		<a href="<?php echo $enter_url;?>" class="btn-enter">Entrance</a>
	</div>
</div>

<script src="./js/swiper.min.js"></script>
<script>
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        parallax: true,
		autoplay: 60000,
        speed: 600,
    });
    </script>
</body>
</html>