<?php session_start();
	include_once("functions/init.php"); 
	include ($thisUrl."adm1n/functions/access.php");
	include_once ($thisUrl."adm1n/functions/koneksi.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<?php
		//echo dirname(__FILE__);
		$tmp = $thisUrl."adm1n/functions/head_section.php";
		include ($tmp);
		?>
    </head>	
	<body>
    	<div class="se-pre-con"></div>
		<center>
			<table width="1024">
				<tr valign="top">
					<td width="207" class="bg">
						<?php 
						$tmp = $thisUrl."adm1n/functions/kiri.php";
						include ($tmp);
						?>
					</td>
					<td width="10"></td>
					<td width="807">
						<?php 
						$tmp = $thisUrl."adm1n/functions/logo.php";
						include ($tmp);
						//echo "<br> tmp : ".$tmp;

						if (isset($menu)) {
							$sql = "select * from user_akses, menus_level_0 where menu=id and id='".$menu."'";
						} //echo $sql;

						if (mysqli_num_rows($hasil)) {
							$max = mysqli_num_rows(mysqli_query($conn, $sql));
							echo "max ". $max; 
							if ($max > 0) {
								if ($hasil = mysqli_query($conn, $sql)) {
									while ($data = mysqli_fetch_array($hasil)) {
										$tmp = $thisUrl."adm1n/".$data["menuLINK"]."index.php";
										//echo "<br> Links : ".$links;
										if (file_exists($tmp)) {
											include ($tmp);
										} else {
											?>
											<table cellpadding="0" cellspacing="0" border="0">
												<tr valign="top">
													<td align="center">
														<img src="<?php echo $thisPage.'adm1n/images/loading.gif'; ?>" border="0"><br>
													</td>
												</tr>
												<tr>
													<td align="left">
														<div id="spasi1d"></div>
														<strong>Updating on progress, please check back later</strong> 
													</td>
												</tr>
											</table>
											<?php
										}
									}
								
								}
							} else {}
						} else {
							?>
							<br>
							<strong>Selamat Datang User <?php echo $_SESSION['username']?> </strong>
							<div id="spasi1d">
								Silahkan Pilih Menu yang Ingin Anda Edit Disebelah Kiri
							</div>
							<p>
							<?php
							$err_msg = (isset($_REQUEST["err_msg"]) ? $_REQUEST["err_msg"] : null);
							if ($err_msg == '1') echo "Password baru yang Anda masukkan tidak sama";
							else if ($err_msg == '2') echo "Selamat. Password Anda telah diganti.";
							else if ($err_msg == '3') echo "Gagal menggani password";
							else if ($err_msg == '4') echo "User tidak dikenali. ";

						}?></p>
					</td>
				</tr>
			</table>
		</center>
	</body>
</html>