<?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/account.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">Аккаунт</span></div>
										<br />
										<div style="text-align:center; font-size:18px;padding-left:10px;padding-top:3px;padding-bottom:3px;background-color:#E8DCC4;" width="100%">Основное данные</div>
										<form action="" method="post" id="profileForm" onsubmit="return false;">
											<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>
													<td style="padding:11px 20px" colspan="3">
														<table class="maintable" border="0" width="100%" cellspacing="0" cellpadding="4">
														<tbody>
															<tr align="center"></tr>
															<tr bgcolor="#f0e8d5">
																<td>
																	<div align="left">Вас пригласил:</div>
																</td>
																<td>
																	<div align="right"><?=$User['RefName']; ?></div>
																</td>
															</tr>
															<tr>
																<td>
																	<div align="left">Ваш Логин:</div>
																</td>
																<td>
																	<div align="right"><?=$User['Login']; ?></div>
																</td>
															</tr>
															<tr bgcolor="#f0e8d5">
																<td>
																	<div align="left">Ваш E-mail:</div>
																</td>
																<td>
																	<div align="right"><?=$User['Email']; ?></div>
																</td>
															</tr>
															<tr>
																<td>
																	<div align="left">Дата регистрации:</div>
																</td>
																<td>
																	<div align="right"><?=date("d.m.Y (H:i)", $User['DateReg']); ?></div>
																</td>
															</tr>
															<tr bgcolor="#f0e8d5">
																<td>
																	<div align="left">Пополнено:</div>
																</td>
																<td>
																	<div align="right"><?=$User['MoneyEnter']; ?></div>
																</td>
															</tr>
															<tr>
																<td>
																	<div align="left">Выведено:</div>
																</td>
																<td>
																	<div align="right"><?=$User['MoneyVivod']; ?></div>
																</td>
															</tr>															
															<tr bgcolor="#f0e8d5">
																<td>
																	<div align="left">Рефералы:</div>
																</td>
																<td>
																	<div align="right"><?=CountRefUser($_SESSION['id']); ?> чел.</div>
																</td>
															</tr>
															<tr>
																<td>
																	<div align="left">Реферальный процент:</div>
																</td>
																<td>
																	<div align="right"><?=(8 + $RefPercent[$User['Level']]); ?>%</div>
																</td>
															</tr>
															<tr bgcolor="#f0e8d5">
																<td>
																	<div align="left">Доход от рефералов (руб.):</div>
																</td>
																<td>
																	<div align="right"><?=$User['RefMoney']/100; ?></div>
																</td>
															</tr>
															<tr id="purse">
																<td>
																	<div align="left">Смена Кошелька (Payeer)</div>
																</td>
																<td>
																	
																		<?php if($User['Purse'] == '') { ?>

																			<input type="text" name="purse" maxlength="9" value="" autocomplit="off" placeholder="P12345678">
																			<span class="button" onclick="process('profileForm','/process/account.php?action=purse','purse .button_small','purse .error','purse','',76)">Сохранить</span>
																		
																			<? } else echo $User['Purse']; ?>
																		<div class="error"></div>
																	
																</td>
																
															</tr>
															<tr bgcolor="#f0e8d5">
																<td>
																	<div align="left">Старый пароль</div>
																</td>
																<td>			
																	<div class="right">
																		<input type="password" name="oldpass" maxlength="20" class="w210" value="" placeholder="Старый пароль">
																	</div>
																</td>
															</tr>
															<tr>
																<td>
																	<div class="left">Новый пароль</div>
																</td>
																<td>
																	<div class="right">
																		<input type="password" name="newpass" maxlength="20" class="w210" value="" placeholder="Новый пароль">
																	</div>
																</td>
															</tr>
															<tr bgcolor="#f0e8d5">
																<td>
																	<div class="left">Повторите новый пароль</div>
																</td>
																<td>
																	<div class="right">
																		<input type="password" name="newpassdubl" maxlength="20" class="w210" value="" placeholder="Повторите новый пароль">
																	</div>
																</td>
															</tr>
															<tr class="mt20">
																<td>
																	<div id="newpassErr" class="error"></div>
																	<div align="center" style="margin-top: 20px;margin-left: 260px;">
																		<span class="button" onclick="process('profileForm','/process/account.php?action=newpass','newpassErr','newpassErr','newpass')">Сохранить</span>
																	</div>																	
																</td>
															</tr>
														</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>																					
										</form>
									</td>
								</tr>
							</tbody>
						</table>
					</td><!-- CONTENT USER -->
				</tr>
			</tbody>
		</table>
	</td>
</tr>
<!-- CLOSE CENTER -->
