<?include('header.php');

if(!(isset($_SESSION["username"]) && isset($_SESSION["password"])))
{
	?>
	<script type="text/javascript">
	location.replace("login.php");
	</script>
	<noscript>
	<meta http-equiv="refresh" content="0; url=login.php">
	</noscript>
	<?
	exit();
}
?>
<?if($duser["system"]==1){?>
<div class="menucenter">
<?
if(isset($_POST[wmid]) and $_POST[pemail]!='')
{
        if( strtolower($_POST['code'])!= strtolower($_SESSION['logcaptcha']) OR !isset($_SESSION["logcaptcha"]))
        {
          echo "<div class='error'>Неверно введен код с картинки...</div>";
          require 'footer.php';
          exit();
        }
        $wmid=text($_POST["wmid"]);
        $pemail=$_POST["pemail"];
        if($wmid==NULL OR strlen($wmid)<=11)
        {
        echo "<div class='error'>Wmid должен быть менее 12 символов!!!</div>";
        include('footer.php');
        exit();
        }
        if(pemail==NULL OR strlen($pemail)<=12)
        {
        echo "<div class='error'>Кошелек должен быть менее 13 символов!!!</div>";
        include('footer.php');
        exit();
        }
        $user=text($_SESSION["username"]);
	$queryb = "UPDATE tb_users SET wmid='$wmid', pemail='$pemail', system='0' WHERE username='$user'";
	mysql_query($queryb) or die(mysql_error());
        echo"<div class=good>Ваш WMID: <b>$wmid</b> Ваш WMR кошелек: <b>$pemail</b></div>";
}
?>
<form action="nextwmid.php" method="POST">
<table class='reyt' width='100%' border='0' cellpadding='0' cellspacing='0'>
<thead><tr>
<th align=left>Параметр</th>
<th align=left>Значение параметра</th>
</tr></thead>
    <tr>
    <td width="150" align="left">Ваш WMID:</td>
    <td width="250" align="left"><input type="wmid" size="25" maxlength="12" name="wmid" value="" tabindex="1"></td>
    </tr>
    <tr>
    <td width="150" align="left">WMR кошелек:</td>
    <td width="250" align="left"><input type="pemail" size="25" maxlength="13" name="pemail" value="" tabindex="1"></td>
    </tr>
  <tr>
<td width="150" align="left"><font color="#dd0000"><b>Введите код:</b></font> <img src="logincap.php" align="absmiddle"></td>
<td width="250" align="left">
<input type='text' size='3' maxlength='4' name='code' autocomplete="off" onChange="getZakaz(this.form)" value="">
</td>
</tr>
  <tr>
    <td width="150" align="left">&nbsp;</td>
    <td width="250" align="left"><input type="submit" class="ok_wm" value=" Сохранить данные " class="submit" tabindex="4"></td>
  </tr>
</table>
</form>
<? } ?>
<? include('footer.php'); ?>
