<?PHP
/********************************************************************************+\
** -+- LeetWEB Last Edition ~ The way to run a private server
*+*******************************************************************************
** -+- Copyright (C) 2011 Nilz. All rechten worden voorbehouden
** -+- http://www.leethotel.com
**
** -+- Parts Copyright (C) 2011 Joopie. All rechten worden voorbehouden
** -+- http://www.jospiek.nl
\+*******************************************************************************/
$must_login = true;
include("Includes/Global.php");
	
	if (isset($_GET['mission']))
	{
		$mission = Filter($_POST['mission']);
		mysql_query('UPDATE `users` SET `motto` = "'.$mission.'" WHERE `username` = "'.$username.'" LIMIT 1');
		echo $mission;
		exit;
	}

$pagename = "Home";	
$pageid = "home";
?>
<!doctype html>
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
		<title><?PHP echo $shortname; ?>: <?PHP echo $pagename; ?></title>
		
		<link href="<?PHP echo $path; ?>/Web/style/global.css" type="text/css" rel="stylesheet">
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
		<link rel="icon" type="image/x-icon" href="<?PHP echo $path; ?>/Web/logo.ico" />
	</head>
	<body>
		<div class="begin static center">
			<div class="top">
				<div class="logo"><a href="/"><img src="<?PHP echo $path; ?>/Web/leet.png" alt=""></a></div>
				
				<div class="balk">
					
					<ul>
						<li class="title">Welcome to <?PHP echo $sitename; ?>!</li>
						<li class="menuitem" onclick="location.href = '<?PHP echo $path; ?>/logout.php';"><p class="icon ilogout"></p>Log out</li>
						<li class="menuitem" onclick="location.href = '<?PHP echo $path; ?>/settings.php';"><p class="icon isettings"></p>Settings</li>
						<li class="menuitem" onclick="location.href = '<?PHP echo $path; ?>/nieuws.php';"><p class="icon inews"></p>News</li>
						<li class="menuitem" onclick="location.href = '<?PHP echo $path; ?>/me.php';"><p class="icon ihome"></p>Home</li>

					</ul>
					
				</div>
			</div>

			<div id="enter-hotel">				<div id="open">					<a href="<?PHP echo $path; ?>/client.php" target="ClientWndw" onclick="window.open('<?PHP echo $path; ?>/client.php','ClientWndw','width=980,height=597');return false;">Enter <?PHP echo $sitename; ?><i></i></a><b></b>				</div>			</div>
			
			<div class="page">
				<div class="userinfo static">
					<div class="enter_help"><?PHP echo Systeem("users_online"); ?> users online</div>
					<div class="status">
						<p class="icredits"><?PHP echo $user['credits']; ?></p>
						<p class="ipixels"><?PHP echo $user['activity_points']; ?></p>
					</div>

					<div class="bar">
						<div class="userimage">
						<?PHP if($user['motto'] == "crikey") { ?>
						<img alt="<?PHP echo $user['username']; ?>" src="http://img4.cdn1.habbo.com/c_images/stickers/sticker_croco.gif" style="margin-top: 57px"/>
						<?PHP } else { ?>
						<img alt="<?PHP echo $user['username']; ?>" src="http://www.habbo.com/habbo-imaging/avatarimage?figure=<?PHP echo $user['look']; ?>" /> <?PHP } ?>
						</div>

						<div class="text">

						<div class="input"><b id="username"><?PHP echo $user['username']; ?>:</b> <input type="text" name="mission" id="mission" value="<?PHP echo $user['motto']; ?>"></div>						<script type="text/javascript">
						$(function()
						{
							var username = $("#username").text();
							$("#mission").css('width', 420 - (username.length * 8) + "px");
							$('#mission').blur(function(){var mission = $('#mission').val();
							$.ajax(
						{
							type: "POST",
							url: "./me.php?mission=true",
							data: "mission="+mission,
							success: function(msg){
							$('#mission').val(msg);}});
						});
							});
						</script>
						</div>
					</div>
				</div>

				<div class="box">
					<div class="title">Latest news</div>
					<div class="content news">
<?PHP
$i = 1;
$sql = mysql_query("SELECT * FROM `leet_news` ORDER BY `id` DESC LIMIT 1");
while($news = mysql_fetch_array($sql))
{ 
?>
<div class="topstory" style="background: url(http://images.habbo.com/c_images/Top_Story_Images/ts_sanddragon.gif) center center no-repeat;">

							<h3><b><?PHP echo $news['title']; ?></b></h3>
							<p><?PHP echo $news['snippet']; ?></p>
							<p><a href="<?PHP echo $path; ?>/nieuws.php?id=<?PHP echo $news['id']; ?>">Read more &raquo;</a></p> 							
						</div>
<?PHP } ?>

						
						<div class="items">
<?PHP
$i = 1;
$sql = mysql_query("SELECT * FROM `leet_news` ORDER BY `id` DESC LIMIT 3");
while($news = mysql_fetch_array($sql)) { 
	$i++;
	if(IsEven($i)) {
	$oddeven = "even";
	} else {
	$oddeven = "odd";
	}
?>
<div class="item <?PHP echo $oddeven; ?>">

<p style="float: right;"><a href="<?PHP echo $path; ?>/nieuws.php?id=<?PHP echo $news['id']; ?>">Read more &raquo;</a></p><h3><b><?PHP echo $news['title']; ?></b></h3><p><?PHP echo $news['snippet']; ?></p>

</div>
<?PHP } ?>				
						</div>
						
						<div style="clear: both;"></div>
					</div>
				</div>
								
			</div>
		</div>
		<div class="copyright static center">
		<?PHP include("Includes/Footer.php"); ?>
		</div>
	</body>
</html>