<?
session_start();
if(empty($login)){
print "<script>top.location.href='index.php';</script>";
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Language" content="ru">
<LINK REL=StyleSheet HREF='style.css' TYPE='text/css'>


<BODY bgcolor=#dedede leftMargin=0 topMargin=0 MARGINWIDTH="0" 
MARGINHEIGHT="0">


<?
include "conf.php";
include "functions.php";
if (ereg("[<>\\/-]",$act) or ereg("[<>\\/-]",$change)) {print "?!"; exit();}
$act=htmlspecialchars($act);
$result = mysql_query("SELECT * FROM users WHERE login='$login'");
$db = mysql_fetch_array($result);




?>
	</td>
    <td align=center valign=top bgcolor=#dedede>

	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="im/menu-1.gif" height=28 align=center valign=middle bgcolor=#333333>

<? include "reklama.php"; ?>
</td>
  </tr>
</table>
<table width="100%"><td></td><td width="200" align="right"><input type=button value="Вернуться" class=nav onclick="javascript:location.href='main.php?act=inv&razdel=obj'"></td></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="im/down.gif"><img src="im/spacer.gif" height=8 border=0></td>
  </tr>
</table>
	<!-- text -->


<table width="100%" height=5 border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td background="im/menu-31.gif" height=5 align=right valign=middle><img src="im/spacer.gif" height=5 border=0></td>
  </tr>
</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align=center valign=top bgcolor=#dedede>

<table width="95%" border="0" cellspacing="0" cellpadding="0">
  <tr>


<!-- qwert -->
   <!-- 5 -->
 <?   if($act=="obraz"){
        if (ereg("[<>\\/-]",$act) or ereg("[<>\\/-]",$avatar)) {print "?!"; exit();}
        $act=htmlspecialchars($act);
        $avatar=htmlspecialchars($avatar);
    if($db["sex"] == "male"){$sex = "m";}
	else if($db["sex"] == "female"){$sex = "f";}
	if(!empty($sex)){

for($i=1;$i<=14;$i++){
print "<td width=10%><a href='main.php?act=inv&razdel=obj&choseAvatar=1&avatar=$i'><img src='img/obraz/$sex/$i.gif' alt='Выбрать этот образ' border=0 ></a></td>";
	if($i == 7){print "</tr><td width=10%><tr>";}
}

	}

   } 


    if($act=="Mail"){
        if (ereg("[<>]",$act) or ereg("[<>]",$old_mail) or ereg("[<>]",$changeMail) or ereg("[<>]",$waring) or ereg("[<>]",$new_mail) or ereg("[<>]",$new_mail2)) {print "Недопустимые символы!!!"; exit();} 
        $act=htmlspecialchars($act);
        $changeMail=htmlspecialchars($changeMail);
        $waring=htmlspecialchars($waring);
        $old_mail=htmlspecialchars($old_mail);
        $new_mail=htmlspecialchars($new_mail);
        $new_mail2=htmlspecialchars($new_mail2);


    if($changeMail==1){
		if($old_mail == ""){
                $waring="Не указан старый e-mail!";
		}
		else if($old_mail != $db["mail"]){
                $waring="Неверно указан старый e-mail!";
		}
		else if($new_mail == ""){
                $waring="Не указан новый e-mail!";
		}
                else if(isset($new_mail) && $new_mail != "" && !eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",$new_mail)){
                $waring="Неправильный адрес e-mail!";
                }
                else if($new_mail!=$new_mail2){
                $waring="Адреса email в полях не совпадают!";
                }
                else {
		$s = mysql_query("UPDATE users SEt mail = '$new_mail' WHERE login='$login'");
		$mail = $db["mail"];
		$name = $db["name"];
		if($name == ""){$name = "имя неизвестно";}
		$date = date("d.m.Y H:i");
		$msg = "Здравствуйте, $name!\n";
		$msg .= "$date был сменен e-mail, указанный при регистрации персонажа $login он-лайн игры АнтиБК+.\n";
		$msg .= "Новый e-mail: $new_mail\n\n\n\n";
		$msg .= "С уважением. администрация АнтиБК+.";
		mail($mail, "Смена e-mail у персонажа $login", $msg);
        $waring="E-Mail успешно сменен.";
	}}



?></table>
<form action='?act=Mail&changeMail=1' name=changeMail method="POST">
<?if (!empty($waring)) {print "<font color=red><b>$waring</b></font>";}?>
<hr width=40% color=#000000 size=1 noshade align=center>
<center><b>Смена e-mail</b><BR>
<hr width=40% color=#000000 size=1 noshade align=center>
Старый e-mail:<BR>
<input type=text maxlength=35 name=old_mail class=new><BR>
Новый e-mail:<BR>
<input type=text maxlength=35 name=new_mail class=new><BR>
Новый e-mail(еще раз):<BR>
<input type=text maxlength=35 name=new_mail2 class=new><BR>
<input type=submit value="Поехали!" class=but></center>
<hr color=#000000 width=40% align=center size=1 noshade>
</form>
    <? } 



 if($act=="pass"){
if (ereg("[<>]",$act) or ereg("[<>]",$old_pass) or ereg("[<>]",$changePass) or ereg("[<>]",$waring) or ereg("[<>]",$new_pass) or ereg("[<>]",$new_pass2)) {print "Недопустимые символы!!!"; exit();}
$act=htmlspecialchars($act);
$changePass=htmlspecialchars($changePass);
$waring=htmlspecialchars($waring);
$old_pass=htmlspecialchars($old_pass);
$new_pass=htmlspecialchars($new_pass);
$new_pass2town=htmlspecialchars($new_pass2);


	if($changePass==1){
        if (ereg("[<>]",$act) or ereg("[<>]",$old_pass) or ereg("[<>]",$new_pass) or ereg("[<>]",$new_pass2)) {print "Недопустимые символы!!!"; exit();}
	$old_pass_db = base64_decode($db["password"]);
		if($old_pass == ""){
                $waring="Не указан старый пароль!";
		}
		else if($old_pass != $old_pass_db){
                $waring="Неверно указан старый пароль!";
		}
                else if(strlen($new_pass)<6 || strlen($new_pass)>20 || !ereg("[a-zA-Zа-яА-Я0-9]$",$new_pass)){
                $waring="Новый пароль должен быть от 6-ти до 20-ти символов, и состоять только из букв русского и английского алфавита, а также из цифр!";
                }
		else if($new_pass != $new_pass2){
                $waring="Пароли в полях не совпадают!";
		}
                else {
		$new_pass_db = base64_encode($new_pass);
		$S = mysql_query("UPDATE users SET password='$new_pass_db' WHERE login='$login'");
		$mail = $db["mail"];
		$name = $db["name"];
		if($name == ""){$name = "имя неизвестно";}
		$date = date("d.m.Y H:i");
		$msg = "Здраствуйте, $name!\n";
		$msg .= "$date был сменен пароль к персонажу $login он-лайн игры АнтиБК+.\n";
		$msg .= "Новый пароль: $new_pass\n\n\n\n";
		$msg .= "С уважением. администрация АнтиБК+.";
		mail($mail, "Смена пароля у персонажа $login", $msg);
        $waring="Пароль сменен. Новый пароль выслан на Ваш e-mail";
	}}


 ?></table>
<form action='?act=pass&changePass=1' name=changePass method="POST">
<?if (!empty($waring)) {print "<font color=red><b>$waring</b></font>";}?>
<hr width=40% color=#000000 size=1 noshade align=center>
<center><b>Смена пароля</b><BR>
<hr width=40% color=#000000 size=1 noshade align=center>
Старый пароль:<BR>
<input type=password maxlength=20 name=old_pass class=new><BR>
Новый пароль:<BR>
<input type=password maxlength=20 name=new_pass class=new><BR>
Новый пароль(еще раз):<BR>
<input type=password maxlength=20 name=new_pass2 class=new><BR>
<input type=submit value="Поехали!" class=but></center>
<hr color=#000000 width=40% align=center size=1 noshade>
</form>
<? } ?>

<!-- 3 -->

<!-- 2 -->
<?


?>
<!-- 2 -->

<!-- 1 -->
<? if($act=="info"){
if($change==1){
if (ereg("[<>]",$real_name) or ereg("[<>]",$town) or ereg("[<>]",$icq) or ereg("[<>]",$color) or ereg("[<>]",deviz) or ereg("[<>]",$hobie) or ereg("[<>]",$url)) {print "Недопустимые символы!!!"; exit();}
$real_name=htmlspecialchars($real_name);
$town=htmlspecialchars($town);
$icq=htmlspecialchars($icq);
$color=htmlspecialchars($color);
$deviz=htmlspecialchars($deviz);
$hobie=htmlspecialchars($hobie);
$hobie=str_replace("\n","<BR>",$hobie);
if($url == "http://"){$url = "";}
if(strlen($hobie)>500){
$waring="Слишком большой размер поля \"Хобби, увлечения\". Максимальный размер: 500 символов."; 
}
else {
$SQL="update users set name='$real_name',icq='$icq',url='$url',color='$color',town='$town',deviz='$deviz',hobie='$hobie' where login='$login'";
$q=mysql_query($SQL);}
if($q){
$waring="Сохранено удачно.";
}
}
$result = mysql_query("SELECT * FROM users WHERE login='$login'");
$db = mysql_fetch_array($result);
$s_hob = $db["hobie"]; 
$s_hob = str_replace("<BR>","\n",$s_hob);
$url = $db["url"];
if(!empty($db["url"])){$url = $db["url"];} else{$url = "http://";}
 ?>
</table>
<?if (!empty($waring)) {print "<font color=red><b>$waring</b></font><br>";}?>
<table align="center" border=0 cellpadding=0 cellspacing=0 width=500>
<tr>
<td width=20><img src='img/cor2_l_t.gif'></td>
<td bgcolor=#cccccc><img src='img/20_20.gif'></td>
<td width=20><img src='img/cor2_r_t.gif'></td><td>
</tr>
</table>
<table border="0" align="center" width="500" cellspacing="0" cellpadding="0" bgcolor=#cccccc>

<form name=reg action=?act=info&change=1 method='post'>
<tr>

    <td width=8 height=8  background="im/down.gif"><img src="im/spacer.gif" height=8 width=8 border=0></td>
    <td  background="im/down.gif"><img src="im/spacer.gif" height=8 border=0></td>
    <td  width=8 height=8  background="im/down.gif"><img src="im/spacer.gif" height=8 width=8 border=0></td>
</tr>
    <tr>
      <td width="364" height="20" valign="top"><font size="3" face="Verdana">&nbsp;&nbsp;&nbsp;Реальное
        имя:<img border="0" src="img/20_20.gif" width="20" height="20"></font></td>
      <td width="363" height="20" valign="top"><input value="<?echo $db["name"]?>" type="normal" name="real_name" maxlength=15 size="25" style="BACKGROUND-COLOR: #cccccc; BORDER-BOTTOM: #000000 1px solid;
BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; COLOR: black; FONT-FAMILY: verdana; FONT-SIZE: 11px;"><img border="0" src="img/20_20.gif" width="20" height="20"></td>
    </tr>
    <tr>
     <td width="364" height="20" valign="top"><font size="3" face="Verdana">&nbsp;&nbsp;&nbsp;ICQ:<img border="0" src="img/20_20.gif" width="20" height="20"></font></td>
      <td width="363" height="20" valign="top"><input value="<?echo $db["icq"]?>" type="normal" name="icq" maxlength=15 size="25" style="BACKGROUND-COLOR: #cccccc; BORDER-BOTTOM: #000000 1px solid;
BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; COLOR: black; FONT-FAMILY: verdana; FONT-SIZE: 11px;"><img border="0" src="img/20_20.gif" width="20" height="20"></td>
    </tr>
    <tr>
     <td width="364" height="20" valign="top"><font size="3" face="Verdana">&nbsp;&nbsp;&nbsp;Дом. страница:<img border="0" src="img/20_20.gif" width="20" height="20"></font></td>
      <td width="363" height="20" valign="top"><input value="<?echo $url;?>" type="normal" name="url" maxlength=50 size="25" style="BACKGROUND-COLOR: #cccccc; BORDER-BOTTOM: #000000 1px solid;
BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; COLOR: black; FONT-FAMILY: verdana; FONT-SIZE: 11px;"><img border="0" src="img/20_20.gif" width="20" height="20"></td>
    </tr>

 <tr>
      </td><td width="364" height="20" valign="top"><font size="3" face="Verdana">
        &nbsp;&nbsp;&nbsp;Цвет сообщений:<img border="0" src="img/20_20.gif" width="20" height="20"></font></td>
      <td width="363" height="20" valign="top">
<select size="1" name="color" style="BACKGROUND-COLOR: #cccccc; BORDER-BOTTOM: #000000 1px solid;
BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; COLOR: black; FONT-FAMILY: verdana; FONT-SIZE: 11px;">
          <option<?if($db["color"]=='black'){echo" selected";}?> value="black" style="color:black">черный</option>
          <option<?if($db["color"]=='#990000'){echo" selected";}?> value="#990000" style="color:#990000">красный</option>
          <option<?if($db["color"]=='orange'){echo" selected";}?> value="orange" style="color:orange">оранжевый</option>
          <option<?if($db["color"]=='#009900'){echo" selected";}?> value="#009900" style="color:#009900">зеленый</option>
          <option<?if($db["color"]=='blue'){echo" selected";}?> value="blue" style="color:blue">голубой</option>
          <option<?if($db["color"]=='#000099'){echo" selected";}?> value="#000099" style="color:#000099">синий</option>
          <option<?if($db["color"]=='violet'){echo" selected";}?> value="violet" style="color:violet">фиолетовый</option>

 </select><img border="0" src="img/20_20.gif" width="20" height="20">

      </td>
    </tr>

    <tr>
      <td width="364" height="20" valign="top"><font size="3" face="Verdana">&nbsp;&nbsp;&nbsp;Город:<img border="0" src="img/20_20.gif" width="20" height="20"></font></td>
      <td width="363" height="20" valign="top"><input value="<?echo $db["town"]?>" type="normal" name="town" maxlength=25 size="25" style="BACKGROUND-COLOR: #cccccc; BORDER-BOTTOM: #000000 1px solid;
BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; COLOR: black; FONT-FAMILY: verdana; FONT-SIZE: 11px;"><img border="0" src="img/20_20.gif" width="20" height="20"></td>
    </tr>
    <tr>
      <td width="364" height="20" valign="top"><font size="3" face="Verdana">&nbsp;&nbsp;&nbsp;Девиз:<img border="0" src="img/20_20.gif" width="20" height="20"></font></td>
      <td width="363" height="20" valign="top"><input value="<?echo $db["deviz"]?>" type="normal" name="deviz" size="25" maxlength=50 style="BACKGROUND-COLOR: #cccccc; BORDER-BOTTOM: #000000 1px solid;
BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; COLOR: black; FONT-FAMILY: verdana; FONT-SIZE: 11px;"><img border="0" src="img/20_20.gif" width="20" height="20"></td>
    </tr>
    <tr>
      <td width="364" height="120" valign="top"><font size="3" face="Verdana">&nbsp;&nbsp;&nbsp;Хобби, увлечения:<img border="0" src="img/20_20.gif" width="20" height="20"></font></td>
      <td width="363" height="120" valign="top">
                  <p><textarea rows="6" name="hobie" cols="42" style="BACKGROUND-COLOR: #cccccc; BORDER-BOTTOM: #000000 1px solid;
BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; COLOR: black; FONT-FAMILY: verdana; FONT-SIZE: 11px;"><? echo $s_hob; ?></textarea></p>

      </td>
    </tr>
    <tr>
      <td width="727" height="20" valign="top" colspan="2">
        <p align="center"><input type="submit" value="Сохранить" name="" style="BACKGROUND-COLOR: #cccccc; BORDER-BOTTOM: #000000 1px solid;
BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; COLOR: black; FONT-FAMILY: verdana; FONT-SIZE: 11px;"></p>
      </td>
    </tr>
    </table>
<table align="center" border=0 cellpadding=0 cellspacing=0 width=500>
<tr>
<td width=20><img src='img/cor2_l_b.gif'></td>
<td bgcolor=#cccccc><img src='img/20_20.gif'></td>
<td width=20><img src='img/cor2_r_b.gif'></td>
</tr>
</table>
  </center>
</div>
</form>
<? } ?>
<!-- 1 -->
<!-- qwert -->
	</td>
  </tr>
</table>

<!-- stop -->
</td>
  </tr>
</table>
	
	</td>
  </tr>
</table>
	</td>
    <td  width=8 background="im/right.gif"><img src="im/spacer.gif" width=8 border=0></td>
  </tr>
  <tr>
    <td width=8 height=8  background="im/down.gif"><img src="im/spacer.gif" height=8 width=8 border=0></td>
    <td  background="im/down.gif"><img src="im/spacer.gif" height=8 border=0></td>
    <td  width=8 height=8  background="im/down.gif"><img src="im/spacer.gif" height=8 width=8 border=0></td>
  </tr>
</table>
