<?php

/*
* @package BANANA WARS
* @copyright: (c) 2017 G.P. aka Mvcshka (mvcshka@yandex.ru)
* @license: GNU General Public License version 2; see LICENSE.txt
* @files: /page/stats.php
*
*/

if(!isset($_SESSION['id']))
{
	Header("Location: /");
	exit;
}

?>


<!-- OPEN CENTER -->
<tr>
    <td align="left" valign="top">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tbody>
                <tr>
                    <td width="284" align="left" valign="top">
                        <?php require('theme/users_block.php');?>
                    </td><!-- MENU USER -->
                    <td align="left" valign="top">
                    <?php require('theme/menu.php'); ?>
                    <div style="height:15px"></div>
                    <table width="672" cellspacing="0" cellpadding="0" style="padding-left:10px;padding-right:10px;">
                        <tbody>
                            <tr></tr>
                            <tr>
                                <td align="left" valign="top">
                                    <div style="background:url('/images/title.jpg') no-repeat center;text-align:center"><span style="background-color:#F0E8D5;padding-right:15px;padding-left:15px;font-size:18px">Статистика BananaWars</span></div>
                                    <br />
                                    <!-- Описание контента -->
									<table border="0" cellspacing="0" cellpadding="0" bgcolor="#E8DCC4" width="100%">
										<tbody>
											<tr>
												<td height="8px" width="8px"><img width="9" height="9" src="/images/form-up-left.gif"></td>
												<td></td>
												<td align="right"><img width="9" height="9" src="/images/form-up-right.gif"></td>
											</tr>
											<tr>
												<tr><td align="center" colspan="4"><b>Последние 20 выплат</b></td></tr>
												<td style="padding:11px 20px" colspan="4">
													<table class="maintable" border="0" width="100%" cellspacing="0" cellpadding="4">
														<tbody>
															<tr align="left" bgcolor="#CEC2AA">
																<td><b>#</b></td>
																<td><b>Логин</b></td>
																<td><b>Сумма</b></td>
																<td><b>дата</b></td>
															</tr>
															<?php

															$q = $mysql->query("SELECT * FROM db_vivod ORDER BY Uid DESC LIMIT 20");
															while($r = $q->fetch()) {

															?>
															<tr class="bgtable">
																<td></td>
																<td><img src="/images/icons/user.gif"/> <?=$r['Login']; ?></td>
																<td><img src="/images/icons/money_dark.jpg"/> <?=$r['SummaGold'] * 0.01; ?></td>
																<td><img src="/images/icons/time.gif" /> <?=date("d.m.Y", $r['DateAdd']); ?></td>
															</tr>
															<?php } ?>
														
														</tbody>
													</table>
												</td>
											</tr>
											<tr>
												<td height="8px" width="8px"><img width="9" height="9" src="/images/form-bottom-left.gif"></td>
												<td></td>
												<td align="right"><img width="9" height="9" src="/images/form-bottom-right.gif"></td>
											</tr>
										</tbody>
									</table>

									<table border="0" cellspacing="0" cellpadding="0" bgcolor="#E8DCC4" width="100%">
										<tbody>
											<tr>
												<td height="8px" width="8px"><img width="9" height="9" src="/images/form-up-left.gif"></td>
												<td></td>
												<td align="right"><img width="9" height="9" src="/images/form-up-right.gif"></td>
											</tr>
											<tr>
												<tr><td align="center" colspan="4"><b>Последние 20 пополнений</b></td></tr>
												<td style="padding:11px 20px" colspan="4">
													<table class="maintable" border="0" width="100%" cellspacing="0" cellpadding="4">
														<tbody>
															<tr align="left" bgcolor="#CEC2AA">
																<td><b>#</b></td>
																<td><b>Логин</b></td>
																<td><b>Сумма</b></td>
																<td><b>дата</b></td>
															</tr>
															<?php

															$q = $mysql->query("SELECT * FROM db_enter WHERE Status = '1' ORDER BY Uid DESC LIMIT 20");
															while($r = $q->fetch()) {

															?>
															<tr>
																<td></td>
																<td><img src="/images/icons/user.gif"/> <?=$r['Login']; ?></td>
																<td><img src="/images/icons/buster.jpg"/> <?=$r['Summa'] * 1; ?></td>
																<td><img src="/images/icons/time.gif" /> <?=date("d.m.Y", $r['DateAdd']); ?></td>
															</tr>
															<?php } ?>
														
														</tbody>
													</table>
												</td>
											</tr>
											<tr>
												<td height="8px" width="8px"><img width="9" height="9" src="/images/form-bottom-left.gif"></td>
												<td></td>
												<td align="right"><img width="9" height="9" src="/images/form-bottom-right.gif"></td>
											</tr>
										</tbody>
									</table>

									<table border="0" cellspacing="0" cellpadding="0" bgcolor="#E8DCC4" width="100%">
										<tbody>
											<tr>
												<td height="8px" width="8px"><img width="9" height="9" src="/images/form-up-left.gif"></td>
												<td></td>
												<td align="right"><img width="9" height="9" src="/images/form-up-right.gif"></td>
											</tr>
											<tr>
												<tr><td align="center" colspan="4"><b>Последние 20 регистраций</b></td></tr>
												<td style="padding:11px 20px" colspan="4">
													<table class="maintable" border="0" width="100%" cellspacing="0" cellpadding="4">
														<tbody>
															<tr align="left" bgcolor="#CEC2AA">
																<td><b>#</b></td>
																<td><b>Логин</b></td>
																<td><b>Пригласил</b></td>
																<td><b>дата</b></td>
															</tr>
															<?php

																$dd = time() - 86400;
																$q = $mysql->query("SELECT * FROM db_users ORDER BY DateReg DESC LIMIT 20");
																while($r = $q->fetch()) {

															?>
															<tr class="bgtable">
																<td><?=$r['Uid']; ?></td>
																<td><?=$r['Login']; ?></td>
																<td><?=$r['RefName']; ?></td>
																<td><?=date("d.m.Y (H:i)", $r['DateReg']); ?></td>
															</tr>
															<?php } ?>
															<!--td colspan="4"><span class="red"> ещё не было!</span></td-->
														</tbody>
													</table>
												</td>
											</tr>
											<tr>
												<td height="8px" width="8px"><img width="9" height="9" src="/images/form-bottom-left.gif"></td>
												<td></td>
												<td align="right"><img width="9" height="9" src="/images/form-bottom-right.gif"></td>
											</tr>
										</tbody>
									</table>
                                </td>
                            </tr>
                        </tbody>
                    </table>                                
                    </td><!-- CONTENT USER -->
                </tr>
            </tbody>
        </table>
    </td>
</tr>
<!-- CLOSE CENTER -->	