<?php
if (empty($_SESSION["user_id"])){
	?>
	<div class="p-20">
		<div class="title"><h3><?php echo $lang["settings1"]; ?></h3></div>
	</div>
	<?php
}
else{
	?>
	<script>
		function Request_Button(asd){
			$.post("scripts/request.php", {type:asd}, function(data){
				$("#customContainer").html(data);
			});
		}
	</script>
	
	<div class="p-20">
		<div class="title"><h3><?php echo $lang["settings4"]; ?> <?php echo strtoupper($_SESSION["user_name"]); ?></h3></div>
		<div class="user-area">
			<ul class="options">
				<li><a href="settings/"><i class="fas fa-cog"></i> CHANGE YOUR ACCOUNT PASSWORD</a></li>
				<li><a href="settings/"><i class="fas fa-envelope"></i> CHANGE EMAIL ADDRESS</a></li>
				<li><a href="javascript:void(0)" onclick="Request_Button(1)"><i class="fas fa-lock"></i> REQUEST STOREKEEPER PASSWORD</a></li>
				<li><a href="javascript:void(0)" onclick="Request_Button(2)"><i class="fas fa-user-times"></i> REQUEST CHARACTER DELETION CODE</a></li>
				<li><a href="donate/" class="yellow"><i class="fas fa-donate"></i> DONATE</a></li>
			</ul>
			<div class="info">
				<ul>
					<li>USER NAME: <?php echo $_SESSION["user_name"]; ?></li>
					<li>E-MAIL: <?php echo $_SESSION["user_email"]; ?></li>
					<li>COINS: <?php echo number_format($_SESSION["user_coins"]); ?></li>
					<li>VOTE-COINS: <?php echo number_format($_SESSION["user_vcoins"]); ?></li>
				</ul>
			</div>
		</div>
		<div class="characters-area">
			<?php
				$query = mysqli_query(GetConexion(), "select player.id,player.name,player.level,player.job,player.skill_group,player.id,player.ip,player_index.empire,account.status, account.availDt from ".DB_PLAYER.".player LEFT JOIN player.player_index ON player_index.id=player.account_id INNER JOIN account.account 
				ON account.id=player.account_id where account.id = ".$_SESSION["user_id"]." limit 4;");

				while ($obj = mysqli_fetch_object($query)){
					?>
					<div class="player">
						<img src="./style/imgs/job/<?php echo $obj->job; ?>.png" width="115px" height="115px" />
						<ul>
							<li>CHARACTER NAME: <?php echo $obj->name; ?></li>
							<li>GUILD: <?php echo GetInfoFromGuild($obj->id, "name"); ?></li>
							<li>LEVEL: <?php echo $obj->level; ?></li>
							<li>KINGDOM: <?php echo $empire[$obj->empire]; ?></li>
							<li>RANK POSITION: <?php echo GetRankPos($obj->id); ?></li>
						</ul>
					</div>
					<?php
				}
			?>
		</div>
	</div>
	<?php
}
?>