<?php
	session_start();
	include('data\_dbconfig.php');
	include('data\_functions.php');
	include_once('data\blaettern.php');
	function writelog($loguser,$logmsg)
	{
		$logtime = time();
		$insertlog = mysql_query("INSERT INTO global_log (id, loggeduser, reason, logtime) VALUES ('', '".$loguser."', '".$logmsg."', '".$logtime."')");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Admin Panel</title>
<link href="admin.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="bgbild">
<?php
	if ($_SESSION['admin_eingeloggt'] == true)
					{
					?>
<div id="logoutwindow"><a href="action.php?action=logout">Click here to logout</a></div>
<div id="logwindow">
<strong>AdminLog</strong><hr size="1" />
<?php
								$abfrage = "SELECT * FROM global_log ORDER by logtime DESC LIMIT 15";
								$ergebnis = mysql_query($abfrage);

									while($row = mysql_fetch_array($ergebnis))
										{
										echo $row['loggeduser']." ".$row['reason']."<br>";
										}
?>

</div>
<?php		
					}

				if ($_SESSION['admin_eingeloggt'] == true)
					{
?>

<div id="content">
<div id="contenttop">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		    <tr>
		      <td><img src="gfx/menu/menu1.png" width="13" height="43" /></td>
		      <td width="109" align="center" valign="middle" background="gfx/menu/menu2.png" class="menu"><a href="index.php">Mainmenu</a></td>
		      <td width="110" align="center" valign="middle" background="gfx/menu/menu3.png" class="menu"><a href="index.php?show=user_menu">User</a></td>
		      <td width="110" align="center" valign="middle" background="gfx/menu/menu3.png" class="menu"><a href="index.php?show=server_menu">Server</a></td>
		      <td width="110" align="center" valign="middle" background="gfx/menu/menu3.png" class="menu"><a href="index.php?show=cashshop_menu">Cashshop</a></td>
		      <td width="110" align="center" valign="middle" background="gfx/menu/menu3.png" class="menu"><a href="index.php?show=profile_menu">Profile</a></td>
			  <td width="110" align="center" valign="middle" background="gfx/menu/bg.png" class="menu"></td>
		      <td><img src="gfx/menu/menubg.png" width="322" height="43" /></td>
	        </tr>
	     </table></div>
<div id="contentmain">
	  <br />
	  <br />
<?php
		switch (@$_GET['show']) {
				default:
					include "menu_main.php";
				break;
				case "user_menu":
					include "menu_user.php"; 
				break;
				case "server_menu":
					include "menu_server.php"; 
				break;
				case "cashshop_menu":
					include "menu_cashshop.php"; 
				break;
				case "profile_menu":
					include "menu_profile.php"; 
				break;
				}
?>
	  
		  
			</td>
	      <td width="6%">&nbsp;</td>
	      <td width="74%" align="left" valign="top">
<?php
		switch (@$_GET['content']) {
				default:
					include "main_content.php";
				break;
				case "add_news":
					include "main_add_news.php"; 
				break;
				case "server_check":
					include "server_servercheck.php"; 
				break;
				case "server_log":
					include "server_serverlog.php"; 
				break;
				case "error":
					include "error.php"; 
				break;
				case "itemdb":
					include "main_itemdb.php"; 
				break;
				case "mapdb":
					include "main_mapdb.php"; 
				break;
				case "enhancement":
					include "user_enhance.php"; 
				break;
				case "comdb":
					include "main_comdb.php"; 
				break;
				case "del_news":
					include "main_del_news.php"; 
				break;
				case "add_cashshop":
					include "cashshop_add.php"; 
				break;
				case "edit_char":
					include "user_editchar.php"; 
				break;
				case "fix_char":
					include "user_fixchar.php"; 
				break;
				}
?>		  
		  
		  
		  </td>
        </tr>
      </table>
	  </div>
<div id="contentfoot"><br />
              <br />
              <br />
              <br />
              <br />
              <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr class="footer">
                  <td align="right" class="footer">Admin Panel v1.0 Copyright 2010 by Pleyja</td>
                </tr>
              </table></div><div>
</div>
	  
	  
            
          		

	
<?php
				} else {
?>

<div id="login_box">
  <form id="form1" name="form1" method="post" action="action.php?action=login">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td align="center" valign="middle"><strong>Admin Panel Login</strong></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>
<?php
		if (isset($_SESSION['error'])) { echo "<br /><center><strong><font color='red'>".$_SESSION['error']."</font></strong></center><br />"; } else { echo "<br /><br /><br />"; }
		unset($_SESSION['error']);
?>

			
		</td>
      </tr>
      <tr>
        <td align="center">Username:</td>
      </tr>
      <tr>
        <td align="center" valign="top"><input name="username" type="text" class="input" id="textfield" /></td>
      </tr>
      <tr>
        <td align="center" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td align="center" valign="top">Password:</td>
      </tr>
      <tr>
        <td align="center" valign="top"><input name="password" type="password" class="input" id="textfield2" /></td>
      </tr>
      <tr>
        <td align="center" valign="top"><br />
          <input type='submit' name='login' value='' class='login_bgImage' /></td>
      </tr>
    </table>
  </form>
</div>

<?php
				}
?>

</body>
</html>
