<?php session_start();
	if (!$_SESSION['username']){
		echo "<script language=JavaScript>";
		echo "location.href = '".$thisPage."login.php';";
		echo "</script>";
	}
	
	include("init.php"); 
	
	$tmp = $thisUrl."koneksi.php";
	include ($tmp);
	//echo "<br>Temp : ".$tmp;

	$tmp = $thisUrl."functions/clear_data.php";
	include ($tmp);

	$action=$_REQUEST["action"];
	$menu=$_REQUEST["menu"];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>WEBSITE BACKOFFICE </title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<link href="style.css" rel="stylesheet" type="text/css">
		<link href="pagination.css" rel="stylesheet" type="text/css">

		<script language="JavaScript" type="text/javascript" src="richtext.js"></script>
		<script language="JavaScript" type="text/javascript">
		<!--
		function submitForm() {
			//make sure hidden and iframe value are in sync before submitting form
			//to sync only 1 rte, use updateRTE(rte)
			//to sync all rtes, use updateRTEs
			updateRTE('description');
			//updateRTEs();
			//alert("rte1 = " + document.RTEDemo.content.value);
			
			//change the following line to true to submit form
			return true;
		}
		
		//Usage: initRTE(imagesPath, includesPath, cssFile)
		initRTE("images/", "", "");
		//-->
		</script>				

	</head>	
	<body>
		<center>
			<table width="987">
				<tr valign="top">
					<td width="207" class="bg">
						<?php 
						$tmp = $thisUrl."kiri.php";
						include ($tmp);
						?>
					</td>
					<td width="10"></td>
					<td width="770">
						<?php 
						$tmp = $thisUrl."logo.php";
						include ($tmp);

						$sql = "select * from user_akses, menus_level_0 where menu=id and id='".$menu."'";
						//echo $sql;
						$max = mysql_num_rows(mysql_query($sql));
						if ($max > 0) {
							if ($hasil = mysql_query($sql)) {
								while ($data = mysql_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="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 {
							?>
                            <br>
                            <strong>Selamat Datang User <?php echo $_SESSION['username']?> </strong>
                            <div id="spasi1d">
                                Silahkan Pilih Menu yang Ingin Anda Edit Disebelah Kiri
                            </div>
                            <?php
						}
						?>
					</td>
				</tr>
			</table>
		</center>
	</body>
</html>	