<? include('checkcookie.php'); ?>
<h3>Заявки на восстановление пароля</h3>
<br>

<?
if (isset($_GET["id"]))
{
	$id=$_GET["id"];
	$option=$_GET["option"];

	if ($option=="del")
	{
		$queryz = "DELETE FROM tb_restorepass WHERE id='$id'";
	    	mysql_query($queryz) or die(mysql_error());

		echo "<font color=\"red\"><b>Заявка удалена.</b></font><br><br>";
	}
}

?>

<br><br>
<table  width="100%" cellspacing="0" cellpadding="0">
<tr>
<th width=50 align=center>№</th>
<th width=200 align=center>Имя пользователя</th>
<th></th>
<th></th>
</tr>

<?
$res=mysql_query("select sitename from tb_site where id='1'");
$res=mysql_fetch_array($res);
$sitename=$res["sitename"];

$tabla = mysql_query("SELECT * FROM tb_restorepass ORDER BY id ASC"); 
while ($registro = mysql_fetch_array($tabla)) { 

echo "
<tr>
<td width=50 align=center>". $registro["id"] ."</td>
<td width=200 align=center>". $registro["username"] ."</td>";
$user=$registro["username"];
$res=mysql_query("select wmid, password from tb_users where username='$user'");
$res=mysql_fetch_array($res);
$wmid=$res["wmid"];
$pass=$res["password"];
$mess="Информация для восстановления доступа к аккаунту. Ваш логин: $user. Ваш пароль: $pass. С Ув., Администрация $sitename";
?>
<td><a href='wmk:msgto?to=<?=$wmid ?>&msg=<?=$mess ?>&BringToFront=y'><button>&nbsp&nbsp&nbsp&nbspОтправить пароль на WMID&nbsp&nbsp&nbsp&nbsp</button></td>
<td>
<form method="post" action="adminmain.php?p=reqpass&id=<?= $registro["id"] ?>&option=del">
<input type="submit" value="Удалить заявку" class="button">
</form>
</td>
</tr>
<?
}
?>
</table>
