<?php $__TOKEN = "hardcodeshitbykernstudios"; require_once('_init.php');?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Charisma Gaming</title>
	<link rel="stylesheet" href="css/styles.css">
	<link rel="stylesheet" href="css/colorbox.css">
	<link rel="stylesheet" href="jquery-ui/css/custom-theme/jquery-ui-1.10.4.custom.css">
	<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
	<header id="header"></header>
	<div id="content" class='mainWidth'>
		<input id='navToggle' type='checkbox' />
		<label for='navToggle'></label>
		<nav id="mainNav">
			<ul class='inlineContainer'>
				 <li><a href='?'>Home</a></li>
				 <li><a href='?module=register'>Register</a></li>
				<?php if(isset($_SESSION['nEMID'])){
					echo "<li><a href='?module=mall'>Item Mall</a></li>";
					echo "
					
					<li>
					<a>Lucky Boxes</a>
					<ul class='submenu'>
						<li><a href='?module=LuckyB'>Lucky Box</a></li>
						<li><a href='?module=LuckyB2'>Special Lucky Box</a></li>
					</ul>
				</li>
					
					";
				}else{
					echo "<li><a href='?module=mall'>Login</a></li>";
					
				}?>
				<?php if(isset($_SESSION['nEMID'])){ ?>
				<li>
					<a>Account</a>
					<ul class='submenu'>
						<li><a href='?module=accountinf'>Account Info</a></li>
						<li><a href='?module=payment'>Payment</a></li>
						<li><a href='?module=changepw'>Password Change</a></li>
					</ul>
				</li>
				<?php } ?>
				<li>
					<a>Top 100</a>
					<ul class='submenu'>
						<li><a href='?module=topChar'>Top 100 Character</a></li>
						<li><a href='?module=topGuild'>Top 100 Guilds</a></li>
					</ul>
				</li>
				<li><a href='?module=download'>Download</a></li>
				<li><a href='http://forums.charisma-gaming.com/'>Forums</a></li>
				<?php 
				
				
				
				if(isset($_SESSION['nEMID'])){
				$conn = sqlsrv_connect($__CONFIG['SQLHost'], array("Database"=>$__CONFIG['SQLDB'], "UID"=>$__CONFIG['SQLUID'], "PWD"=>$__CONFIG['SQLPWD']));
				if(!$conn){
					echo print_r(sqlsrv_errors(), true);
					exit();
				}
				$checkAccount = sqlsrv_query($conn, "SELECT sUsername, nAGPoints FROM tAccounts WHERE nEMID = ?;", array($_SESSION['nEMID']));
				$fetchAccount = sqlsrv_fetch_array($checkAccount);
				?>
				<li id='userNavigation'>
					<div class='avatarWrap'>
						<img class='avatar' src='placeholders/35x35_avatar_index.jpg' alt='Avatar' />
					</div>
					<span class='username'><?php echo $fetchAccount['sUsername'];?></span>
					<ul class='submenu right'>
						<li><a href='#'><?php echo $fetchAccount['nAGPoints']; ?> Points</a></li>
						<li><a href='?module=logout'>Logout</a></li>
					</ul>
				</li>
				<?php }?>
				
			</ul>
		</nav>
		<div id='slidebox'>
			
		</div>
		<div id='mainbody' class='inlineContainer'>
			<div class='leftColumn borderBox news'>
				<?php
					if(isset($_GET['module']) && !empty($_GET['module'])) {
						if(file_exists(realpath('./module/')."/".$_GET['module'].".php")) {
							include(realpath('./module/')."/".$_GET['module'].".php");
						}else{
							include(realpath('./module/').'/news.php');
						}
					}else{
						include(realpath('./module/').'/news.php');
					}
				?>
			</div>
		</div>
	</div>
	<footer id='footer' class='mainWidth borderBox inlineContainer'>
		<div class='leftColumn'>
			<div class='info'></div>
			<div class='about borderBox'>
				<h2>KeRnStudios Network</h2>
				<p>Code by KeRnStudios <i class="fa fa-copyright"></i> <?php echo date('Y');?>&nbsp;</p>
				
			</div>
		</div>
	</footer>
	<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
	<script src='js/jquery.colorbox-min.js'></script>
	<script src='jquery-ui/js/jquery-ui-1.10.4.custom.min.js'></script>
	<script src='js/slider.js'></script>
	<script src='js/menu.js'></script>
	<script src='js/lightbox.js'></script>
</body>
</html>