<?php
#################################################################################
##              -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =-                 ##
## --------------------------------------------------------------------------- ##
##  Filename       deletion.tpl                                                ##
##  Developed by:  Dzoki                                                       ##
##  License:       TravianZ Project                                            ##
##  Copyright:     TravianZ (c) 2010-2025. All rights reserved.                ##
##                                                                             ##
#################################################################################
include_once("../GameEngine/Ranking.php");
if($_GET['uid'])
{
	$varray = $database->getProfileVillages($_GET['uid']);
	if($user)
	{
		$totalpop = 0;
		foreach($varray as $vil)
		{
			$totalpop += $vil['pop'];
		} ?>
		<style>
			.del {width:12px; height:12px; background-image: url(img/admin/icon/del.gif);}
		</style>
		<form action="" method="post">
			<input type="hidden" name="action" value="DelPlayer">
			<input type="hidden" name="uid" value="<?php echo $user['id'];?>">
			<input type="hidden" name="admid" id="admid" value="<?php echo $_SESSION['id']; ?>">
			<table id="member">
				<thead>
					<tr>
						<th colspan="4">Delete player</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td>Name:</td>
						<td><a href="?p=player&uid=<?php echo $user['id'];?>"><?php echo $user['username'];?></a></td>
						<td>Gold:</td>
						<td><?php echo $user['gold'];?></td>
					</tr>
					<tr>
						<td>Rank:</td>
						<td><?php $ranking->procRankArray();echo $ranking->getUserRank($user['id']); ?></td>
						<td>Population:</td>
						<td><?php echo $totalpop;?></td>
					</tr>
					<tr>
						<td>Villages:</td>
						<td>
							<?php
								$result = mysqli_query($GLOBALS["link"], "SELECT Count(*) as Total FROM ".TB_PREFIX."vdata WHERE owner = ".(int) $user['id']."");
								$num_rows = mysqli_fetch_array($result, MYSQLI_ASSOC)['Total'];
								echo $num_rows;
							?>
						</td>
						<td><b><font color='#71D000'>P</font><font color='#FF6F0F'>l</font><font color='#71D000'>u</font><font color='#FF6F0F'>s</font></b>:</td>
						<td>
							<?php
								$plus = date('d.m.Y H:i',$user['plus']);
								echo $plus;
							?>
						</td>
					</tr>
					<tr>
						<td>Alliance:</td>
						<td><?php echo $database->getAllianceName($user['alliance']);?></td>
						<td>Status:</td>
						<td>-</td>
					</tr>
					<tr>
						<td colspan="4" class="empty"></td>
					</tr>
					<tr>
						<td>Password:</td>
						<td><input type="password" name="pass"></td>
						<td colspan="2"><input type="submit" class="c5" value="Delete player"></td>
					</tr>
				</tbody>
			</table>
		</form><?php
	}
}
else
{
	include("404.tpl");
}
?>
