<?php
define('IS_NOT_LOGIN', true); // 로그인 하지 않은 상태에서 접근하는 파일인 경우
$adminsubmitmsg = $_REQUEST['m'];
?>

<!DOCTYPE html>
<html>

<head>
	<?php
	/*
	///// 비밀번호화 처리 {
	include "cryption.php";
	$computerId = $_SERVER['HTTP_USER_AGENT']." |_| ".$_SERVER['REMOTE_ADDR']." |_| ".date("Y-m-d H:i:s");
	define("handShakeLoginKey", encrypt(md5(uniqid())."_".$computerId));
	$handShakeLoginFile = fopen("handShakeLogin.key", "w") or die("Error:E10015");
	fwrite($handShakeLoginFile, handShakeLoginKey);
	fclose($handShakeLoginFile);
	///// 비밀번호화 처리 }
	*/
	?>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title><?=$HOME_ADMIN_TITLE_NAME?> 로그인</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<link rel="icon" href="/favicon.ico" type="image/x-icon">
	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">

	<link rel="stylesheet" type="text/css" href="css/main_admin.css?v=<?php echo $MY_CSS_VER?>">

	<script src="vendor/js/jquery-3.3.1.min.js?v=<?php echo $MY_JS_VER?>"></script>
	<script src="vendor/js/jquery.dataTables.js?v=<?php echo $MY_JS_VER?>"></script>
	<script src="vendor/js/buttons.html5.min.js?v=<?php echo $MY_JS_VER?>"></script>

	<script>
		function formsubmit() {
			var adminid = $("#adminemail").val().trim(); // 이메일 입력란을 회원ID로 사용
			var adminpwd = $("#adminpwd").val().trim();
			if (adminid == "")
			{
				$("#adminsubmitmsg").text("이메일(회원ID)을 입력하세요");
				$("#adminid").focus();
				return false;
			} else if (adminpwd == "") {
				$("#adminsubmitmsg").text("비밀번호를 입력하세요");
				$("#adminpwd").focus();
				return false;
			}
			$("#adminloginform").submit();
		}

		$(document).ready(function() {
			// 실시간 이메일 입력값을 회원ID 입력란에도 동기화
			$('#adminemail').on('input', function() {
				$('#adminid').val($(this).val());
			});
			$('#adminid').on('input', function() {
				$('#adminemail').val($(this).val());
			});
		});
		setTimeout(function() {
			$('#adminpwd').val('');
			// Also clear native input values directly
			var adminid = document.getElementById('adminemail');
			var adminpwd = document.getElementById('adminpwd');
			if (adminpwd) adminpwd.value = '';
		}, 100);
	</script>

	<script>
		window.onload=function(){
			$('body').fadeIn(1000);
		}
		$(document).keyup(function(event) {
			$("#adminsubmitmsg").empty();
			if (event.which === 13) {
				formsubmit();
			}
		})
		function resetpwd() {
			var link = 'resetpwd_admin.php';
			location.href=link;
		}
		function joinup() {
			var link = 'joinup_admin.php';
			location.href=link;
		}
	</script>
	<style>
		input {outline: none; background:#ffffff; color:#fdfdffff; }
		input:focus {outline: none; background:#c7daff; color:#fdfdffff; }
		#adminpwd {outline: none; color:#fdfdffff; font-family:"굴림"; }
		#adminpwd:focus {outline: none; background:#c7daff; color:#fdfdffff; font-family:"굴림"; }
		#adminsubmit { color: #f9f9f9ff; }
		#adminsubmit:hover { background: #d9d9d8ff; color: #2694eeff; }
		#resetpwd {outline: none; border-top:1px solid #444444; border-right:1px solid #444444; border-bottom:1px solid #444444; border-left:1px solid #444444; color:#a7a7a7; font-size:0.8rem; }
		#resetpwd:hover { background:orangered; color:#ffffff; }
		#toggleButton {outline: none; color:#a7a7a7; font-size:0.8rem; }
		#toggleButton:hover { background:#00ff00; color:#ffffff; }
		#joinup {outline: none; border-top:1px solid #444444; border-right:1px solid #444444; border-bottom:1px solid #444444; border-left:0px solid #444444; color:#a7a7a7; font-size:0.8rem; }
		#joinup:hover { background:#26bffa; color:#ffffff; }
		#agreement {outline: none; border-top:1px solid #444444; border-right:1px solid #444444; border-bottom:1px solid #444444; border-left:1px solid #444444; color:#a7a7a7; font-size:0.8rem; }
		#agreement:hover { font-weight:bold; color:#ffffff; }

	   /* Premium animated bokeh background with black/blue base for IT/Trust look */
	   #bg-effect {
		 width: 100vw;
		 height: 100vh;
		 position: fixed;
		 top: 0; left: 0;
		 z-index: -2;
		 overflow: hidden;
		 background: linear-gradient(120deg, #0a0c1a 0%, #11204d 100%);
	   }
	   #bg-effect .bokeh {
		 position: absolute;
		 border-radius: 50%;
		 filter: blur(32px) brightness(1.15);
		 opacity: 0.48;
		 pointer-events: none;
		 mix-blend-mode: screen;
		 transition: opacity 0.5s;
	   }
	   #bg-effect::after {
		 content: '';
		 position: absolute;
		 top: 0; left: 0; width: 100%; height: 100%;
		 background: rgba(10,12,26,0.55);
		 pointer-events: none;
		 z-index: 2;
	   }
	</style>

	<script>
	   // Premium animated bokeh effect (blue/cyan/white, IT look)
	   document.addEventListener('DOMContentLoaded', function() {
		 var bg = document.getElementById('bg-effect');
		 if (!bg) return;
		 // Remove old bokeh if any
		 Array.from(bg.querySelectorAll('.bokeh')).forEach(e => e.remove());
		 // Bokeh config (cool, high-tech)
		 var bokehs = [
		   {color:'#26bffa', size:320, x:10, y:20, dx:0.07, dy:0.06, opacity:0.45},
		   {color:'#1a2a4d', size:260, x:70, y:60, dx:-0.06, dy:0.05, opacity:0.38},
		   {color:'#00eaff', size:200, x:40, y:80, dx:0.05, dy:-0.08, opacity:0.32},
		   {color:'#11204d', size:280, x:80, y:30, dx:-0.08, dy:0.09, opacity:0.38},
		   {color:'#ffffff', size:180, x:60, y:10, dx:0.09, dy:0.07, opacity:0.22}
		 ];
		 bokehs.forEach((b, i) => {
		   var el = document.createElement('div');
		   el.className = 'bokeh';
		   el.style.background = b.color;
		   el.style.width = el.style.height = b.size+'px';
		   el.style.left = b.x+'vw';
		   el.style.top = b.y+'vh';
		   el.style.opacity = b.opacity;
		   bg.appendChild(el);
		   b.el = el;
		 });
		 function animate() {
		   bokehs.forEach(function(b) {
			 b.x += b.dx;
			 b.y += b.dy;
			 if (b.x < -20 || b.x > 100) b.dx *= -1;
			 if (b.y < -20 || b.y > 100) b.dy *= -1;
			 b.el.style.left = b.x+'vw';
			 b.el.style.top = b.y+'vh';
		   });
		   requestAnimationFrame(animate);
		 }
		 animate();
	   });
	</script>
</head>

<body style="margin:0; padding:0; overflow:hidden; display:none; background: none;">
<div id="bg-effect" style="position:fixed; z-index:-2; top:0; left:0; width:100vw; height:100vh;"></div>
	<form id="adminloginform" name="adminloginform" action="login_admin_process.php" method="post" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
		<div style="display:flex; justify-content:center; align-items:flex-start; flex-direction:column; width:100%; height:100vh; font-size:1.1em;">
			<div style="display:flex; justify-content:center; align-items:center; width:344px; height:auto; margin:0px auto 10px; color:#a7a7a7; font-size:1.3rem; text-align:center;">
				<div style="display:flex; justify-content:center; align-items:center;"><img src="img/VPNLink_LOGO5.png" style="height:35px;"></div> <div style='margin-left:10px;'><b><?php echo $HOME_ADMIN_TITLE_NAME?></b> 로그인</div>
			</div>
			<div style="display:flex; justify-content:center; align-items:center; width:50%; min-width:350px;; height:auto; margin:0px auto 10px;">
				<div id="adminsubmitmsg" style="display:flex; justify-content:center; align-items:center; width:350px;; height:30px; color: #c4ff5dff; text-align:center; font-size:0.9rem;"><?php echo $adminsubmitmsg?></div>
			</div>

			<div style="display:flex; justify-content:center; align-items:flex-start; flex-direction:row; width:50%; min-width:350px;; max-width:800px; height:auto; margin:0px auto 20px;">
				<div style="display:flex; justify-content:center; align-items:center; width:100px; height:30px; border:1px solid #7a7a7a; background:#7a7a7a; color:#ffffff; padding:10px; text-align:center;">이메일</div>
				<div style="width:250px; border:1px solid transparent; background:#ffffff; padding:0px;">
					<?php
						if (isset($_COOKIE['VLAv1Cookie4mbid']) && $_COOKIE['VLAv1Cookie4mbid'] !== '') {
					?>
						<input type="text" name="adminemail" id="adminemail" style="width:230px; height:30px; padding:10px 10px 10px; border:0; font-size:1.1em; color:#333333;" value="<?php echo htmlspecialchars($_COOKIE['VLAv1Cookie4mbid'])?>">
					<?php
						} else {
					?>
						<input type="text" name="adminemail" id="adminemail" style="width:230px; height:30px; padding:10px 10px 10px; border:0; font-size:1.1em; color:#333333;" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
					<?php } ?>
				</div>
			</div>

			<div style="display:none; justify-content:center; align-items:flex-start; flex-direction:row; width:50%; min-width:350px;; max-width:800px; height:auto; margin:0px auto 20px;">
				<div style="display:flex; justify-content:center; align-items:center; width:100px; height:30px; border:1px solid #7a7a7a; background:#7a7a7a; color:#ffffff; padding:10px; text-align:center;">회원ID</div>
				<div style="width:250px; border:1px solid transparent; background:#ffffff; padding:0px;">
					<?php
						if (isset($_COOKIE['VLAv1Cookie4mbid']) && $_COOKIE['VLAv1Cookie4mbid'] !== '') {
					?>
						<input type="text" name="adminid" id="adminid" style="width:230px; height:30px; padding:10px 10px 10px; border:0; font-size:1.1em; color:#333333;" value="<?php echo htmlspecialchars($_COOKIE['VLAv1Cookie4mbid'])?>">
					<?php
						} else {
					?>
						<input type="text" name="adminid" id="adminid" style="width:230px; height:30px; padding:10px 10px 10px; border:0; font-size:1.1em; color:#333333;" autocomplete="new-username" autocorrect="off" autocapitalize="off" spellcheck="false">
					<?php } ?>
				</div>
			</div>
			<div style="display:flex; justify-content:center; align-items:flex-start; flex-direction:row; width:50%; min-width:350px;; max-width:800px; height:auto; margin:0px auto 20px;">
				<div style="display:flex; justify-content:center; align-items:center; width:100px; height:30px; border:1px solid #7a7a7a; background:#7a7a7a; color:#ffffff; padding:10px; text-align:center;">비밀번호</div>
				<div style="width:250px; border:1px solid transparent; background:#ffffff; padding:0px;">
					<input type="password" name="adminpwd" id="adminpwd" style="width:230px; height:30px; padding:10px 10px 10px; border:0; font-size:1.1em; color:#333333;" value="" autocomplete="new-password" autocorrect="off" autocapitalize="off" spellcheck="false">
				</div>
			</div>
			<div style="display:flex; justify-content:center; align-items:center; width:50%; min-width:350px;; height:auto; margin:0px auto 50px;">
				<div id="adminsubmit" style="display:flex; justify-content:center; align-items:center; width:350px;; height:30px; border:1px solid #7a7a7a; padding:10px; text-align:center; cursor:pointer;" onclick="formsubmit();">로그인</div>
			</div>

			<div style="display:flex; justify-content:center; align-items:center; width:50%; min-width:350px;; max-width:800px; height:auto; margin:0px auto 20px;">
				<div id="resetpwd" style="display:flex; justify-content:center; align-items:center; width:165px; height:30px; padding:5px 10px; text-align:center; cursor:pointer;" onclick="resetpwd();">비밀번호 재설정</div>
				<div id="joinup" style="display:flex; justify-content:center; align-items:center; width:165px; height:30px; padding:5px 10px; text-align:center; cursor:pointer; margin-left:1px;" onclick="joinup();">회원가입</div>
			</div>
		</div>

	</form>
</body>

</html>

<?php
if ($_REQUEST['first']=='yes') {
	$submitid = "admin";
	$submitpwd = "12345678";
	$md5_mempwd = $submitpwd."_pwd_".$submitid."_id";
	$i_mempwd = md5($md5_mempwd);
	echo $i_mempwd;
}
?>