<?php
#######################################################|#
#|                    HabboMCMS - TheRox
#|                    Powered by HoloCMS 
#|            Copyright 2011-2012 ALL RIGHTS RESERVED
#######################################################|#

require_once('../global.php');
require_once('../INC/class.session.php');

$ownerid = $_POST['ownerId'];
$widgetid = $_POST['widgetId'];
$message = Filter($_POST["message"]);
$sql = mysql_query("SELECT NOW()");
$date = mysql_result($sql, 0);

mysql_query("INSERT INTO cms_guestbook (message,time,widget_id,userid) VALUES ('".$message."','".$date."','".$widgetid."','".$my_id."')");

$row = mysql_fetch_assoc(mysql_query("SELECT * FROM cms_guestbook WHERE userid = '".$my_id."' ORDER BY id DESC LIMIT 1"));
$userrow = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE id = '".$row['userid']."'"));

?>

	<li id="guestbook-entry-<?php echo $row['id']; ?>" class="guestbook-entry">
		<div class="guestbook-author">
			<img src="http://www.habbo.co.uk/habbo-imaging/avatarimage?figure=<?php echo $userrow['look']; ?>&direction=2&head_direction=2&gesture=sml&size=s" alt="<?php echo $userrow['username'] ?>" title="<?php echo $userrow['username'] ?>"/>
		</div>
			<div class="guestbook-actions">
					<img src="./web-gallery/images/myhabbo/buttons/delete_entry_button.gif" id="gbentry-delete-<?php echo $row['id']; ?>" class="gbentry-delete" style="cursor:pointer" alt=""/>
					<br/>
			</div>
		<div class="guestbook-message">
			<div class="online">
				<a href="./user_profile.php?id=<?php echo $userrow['id']; ?>"><?php echo $userrow['username']; ?></a>
			</div>
			<p><?php echo HabboCMSTEXT($row["message"],false,true); ?></p>
		</div>
		<div class="guestbook-cleaner">&nbsp;</div>
		<div class="guestbook-entry-footer metadata"><?php echo $row['time']; ?></div>
	</li>