<?php
@session_name('xTempMail');
@session_start();

if ((isset($_COOKIE['email']) && $_COOKIE['email'] != '')) {
	$_SESSION['email'] = base64_decode($_COOKIE['email']);
}else{
	include 'inc/create.php';
}

$ThisEmail = $_SESSION['email'];

$allowed_lang = array('en','id');
if ((isset($_COOKIE['language']) && $_COOKIE['language'] != '')) {
	if (in_array($_COOKIE['language'], $allowed_lang)) {
		$xlang = $_COOKIE['language'];
	}else{ $xlang = "en"; }
}else{ $xlang = "id"; }


$lang = array(
	'en' => $lang = array(
		'Forget about spam, advertising mailings, hacking and attacking robots. Keep your real mailbox clean and secure. Temp Mail provides temporary, secure, anonymous, free, disposable email address.',
		'Copy',
		'Refresh',
		'Change',
		'Delete'
	),
	'id' => $lang = array(
		'Lupakan tentang spam, surat iklan, peretasan dan serang robot. Jaga kotak surat Anda yang sebenarnya bersih dan aman. Temp Mail memberikan alamat email sementara, aman, anonim, gratis, sekali pakai.',
		'Salin',
		'Segarkan',
		'Ubah',
		'Hapus'
	)
);

$rtl=false;
if ($xlang == "en") {
	$lang_btn_flag = 'flag_gb';
	$lang_btn_text = 'EN';
}elseif($xlang == "id"){
	$lang_btn_flag = 'flag_id';
	$lang_btn_text = 'ID';
}

?>
<!doctype html>
<html class="no-js" lang="en">
	<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		
		<meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1">
		<title>xTempMail</title>
		<link rel="shortcut icon" href="img/xmail.png"/>
		<meta name="description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="css/style.css"> 
        <script type="text/javascript">
        if (screen.width <= 720) {
        alert("Mobile Device Are Not Allowed!")
        window.location = "home";
        }
        </script>
	</head>
	<body <?php if($rtl){ echo "dir='rtl'"; } ?> >
		<div class="block" id="header">
			<div class="content">
				<div id="logo"></div>
				<div id="email">
					<input type="text" id="email_id" value="<?=$ThisEmail?>" data-value="<?=$ThisEmail?>">
				</div>
				<div id="desc"><?=$lang[$xlang][0]?></div>
				<div id="lang">
					<button id="lang_btn" class="<?=$lang_btn_flag?>"><?=$lang_btn_text?></button>
					<div id="lang_list">
						<div class="lang_item flag_gb" data-lang="en">EN</div>
						<div class="lang_item flag_id" data-lang="id">ID</div>
					</div>
				</div>
			</div>
			<div id="loader">
				<div id="progress"></div>
			</div>
		</div>
		<div class="block">
			<div class="content" id="xbody">
				<div id="sidebar" class="<?php if($rtl){ echo 'right'; }else{ echo 'left'; } ?>">
					<div class="item" id="item_to_copy" data-target="copy" data-clipboard-text="<?=$ThisEmail?>"><?=$lang[$xlang][1]?></div>
					<div class="item" data-target="refresh"><?=$lang[$xlang][2]?></div>
					<div class="item" data-target="change"><?=$lang[$xlang][3]?></div>
					<div class="item" data-target="delete"><?=$lang[$xlang][4]?></div>
				</div>
				<div id="xAJAX">
					<div id="ajax" class="<?php if($rtl){ echo 'right'; }else{ echo 'left'; } ?>"></div>
				</div>
			</div>
		</div>

		<div class="block">
			<div class="content" id="footer">
				<span>Copyright &copy; <?=@date('Y')?> xTempMail</span>
			</div>
		</div>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/clipboard.min.js"></script>
		<script type="text/javascript" src="js/script.js"></script>
	</body>
</html>