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


require_once('../global.php');
if($hkzone !== true){ header("Location: index.php?throwBack=true"); exit; }
if(!session_is_registered(acp)){ header("Location: index.php?p=login"); exit; }

$pagename = "Transactions";

if(isset($_POST['query'])){

	$query = Filter($_POST['query']);

	$get_logs = mysql_query("SELECT * FROM cms_transactions WHERE userid = '".$query."' ORDER BY id DESC") or die(mysql_error());
	$results = mysql_num_rows($get_logs);

	if($results > 0){
		$msg = "<div class='alert success'>Voici les transactions de cet/cette Habbo.</div>";
	} else {
		$msg = "<div class='alert'>Aucun résultat.</div>";
	}

}

require_once('subheader.php');
require_once('header.php');
?>
<table cellpadding='0' cellspacing='8' width='100%' id='tablewrap'>
<tr> <td width='22%' valign='top' id='leftblock'>
 <div>
 <!-- LEFT CONTEXT SENSITIVE MENU -->
<?php require_once('usermenu.php'); ?>
 <!-- / LEFT CONTEXT SENSITIVE MENU -->
 </div>
 </td>
 <td width='78%' valign='top' id='rightblock'>
 <div><!-- RIGHT CONTENT BLOCK -->
 

<form action='index.php?p=transactions&do=search' method='post' name='theAdminForm' id='theAdminForm'>
<div class='tableborder'>
<div class='tableheaderalt'>Transaction Logs</div>

<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
<tr>
<td class='tablerow1'  width='40%'  valign='middle'><strong>User ID</strong><div class='graytext'>L'ID de l'utilisateur que de journaux de transactions que vous souhaitez afficher. Pour rechercher l'ID d'un utilisateur, utilisez <a href='index.php?p=uid'>le User ID tool</a>.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><input type='text' name='query' value="<?php echo $query; ?>" size='30' class='textinput'></td>
</tr>

<tr>
<tr><td align='center' class='tablesubheader' colspan='2' ><input type='submit' value='Voir les logs' class='realbutton' accesskey='s'></td></tr>
</form></table></div><br />

<?php if($results > 0){ ?>
 <div class='tableborder'>
 <div class='tableheaderalt'>Résultats</div>
 <table cellpadding='4' cellspacing='0' width='100%'>
 <tr>
  <td class='tablesubheader' width='25%' align='center'>Date</td>
  <td class='tablesubheader' width='50%' align='center'>Description</td>
  <td class='tablesubheader' width='25%' align='center'>Activité</td>
 </tr>
<?php

while($row = mysql_fetch_assoc($get_logs)){
	printf(" <tr>
  <td class='tablerow1' align='center'>%s</td>
  <td class='tablerow2' align='center'>%s</td>
  <td class='tablerow2' align='center'>%s</td>
</tr>", $row['date'], $row['descr'], $row['amount']);
}
?>
 
 </table>
</div>
<?php } ?>
	 </div><!-- / RIGHT CONTENT BLOCK -->
	 </td></tr>
</table>
</div><!-- / OUTERDIV -->
<div align='center'><br />
<?php
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
printf('Time: %.3f', $totaltime);
?>
</div>