File size: 7.17Kb
<?php
include "ini3.php";
include "includes/header$h.php";
$id=cyr(htmlspecialchars(stripslashes(trim($id))));
$pass=cyr(htmlspecialchars(stripslashes(trim($pass))));
if(!empty($id))
{
$q = mysql_query("select * from users where id='".$id."';");
}
else
{
die ($lang['empty_login']."</body></html>");
}
$data = mysql_fetch_array($q);
$id=$data['id'];
$login=$data['login'];
$money=$data['money'];
$level=$data['level'];
$police=$data['police'];
$stage=$data['stage'];
$health=$data['health'];
$cars=$data['cars'];
$guns=$data['guns'];
$nums=$data['nums'];
$voo_por=$data['voodoo'];
$energy=$data['energy'];
$secur=$data['secur'];
$zav=$data['zav'];
$lsd=$data['lsd'];
$ban=$data['ban'];
$lvl=$data['lvl'];
$lox=$data['lox'];
$gold=$data['gold'];
$admin=$data['admin'];
$band=$data['band'];
if(md5($pass)!=$data['pass'])
{
die ($lang['empty_login']."</body></html>");
}
mysql_query("update users set last='".time()."',city='1' where id='".$id."';");
include "./../includes/inc_secur.php";
include "./../includes/inc_energy.php";
include "./../includes/inc_hospital.php";
include "./../includes/inc_police.php";
include "./../includes/inc_die.php";
include "./../includes/inc_voodoo.php";
include "./../includes/inc_attack.php";
include "./../includes/inc_mes.php";
print "<b>[Зд: $health %][<img src='a href=\./../../pic/energy.gif' title='Энергия'/>: $energy %][Зщ: $secur %]</b><br/>";
print "<u>[Почта]</u><br/>";
$clan=mysql_query("select * from bands where name='$band';");
$clan2=mysql_fetch_array($clan);
$cid=$clan2['id'];
$cname=$clan2['name'];
switch($mode){
default:
$all1 = mysql_num_rows(mysql_query("SELECT * FROM mail where komu='$id' and type='1'"));
print "<a href=\"mail.php?id=$id&pass=$pass&mode=1\">Входящие($all1)</a><br/>";
$all2 = mysql_num_rows(mysql_query("SELECT * FROM mail where komu='$id' and type='2'"));
print "<a href=\"mail.php?id=$id&pass=$pass&mode=2\">Системные($all2)</a><br/>";
if(!empty($cid)){$all4 = mysql_num_rows(mysql_query("SELECT * FROM mail where komu='$cname'"));
print "<a href=\"mail.php?id=$id&pass=$pass&mode=6\">Сообщения банды($all4)</a><br/>";
}
$all3 = mysql_num_rows(mysql_query("SELECT * FROM mail where kto='$id' and type='1'"));
print "<a href=\"mail.php?id=$id&pass=$pass&mode=3\">Исходящие($all3)</a><br/>";
print "<a href=\"mail.php?id=$id&pass=$pass&mode=4\">Отправить письмо</a><br/>";
break;
case "1":
$a=mysql_query("select * from mail where komu='$id' and type='1' order by id desc limit 10");
while($a1=mysql_fetch_array($a)){
$kto=$a1['kto'];
$text=$a1['text'];
$time=$a1['time'];
$b=mysql_fetch_array(mysql_query("select login from users where id='$kto'"));
$blogin=$b['login'];
include "gb/smile.php";
print "<b>$blogin</b> [$time]<br/>$text<br/>";
echo "<form action=\"mail.php?id=$id&pass=$pass&mode=4&komu=$blogin\" method=\"post\">";
echo "<input class=\"button_medium\" type=\"submit\" value=\"Ответить\"/></form><br/>";
}
echo "<form action=\"mail.php?id=$id&pass=$pass&mode=5&p=1\" method=\"post\">";
echo "<input class=\"button_medium\" type=\"submit\" value=\"Удалить все\"/></form><br/>";
break;
case "2":
$a=mysql_query("select * from mail where komu='$id' and type='2' order by id desc limit 15");
while($b=mysql_fetch_array($a)){
$text=$b['text'];
$time=$b['time'];
$time2=time()-$time;
$time3=floor($time2/60);
$time3_o=$time2%60;
$time4=floor($time3/60);
$time4_o=$time3%60;
$time5=floor($time4/24);
$time5_o=$time4%24;
if($time2<60)$time6="$time2 сек.";
elseif($time2>=60 && $time2<3600)$time6="$time3 мин. $time3_o сек.";
elseif($time2>=3600 && $time2<86400)$time6="$time4 ч. $time4_o мин.";
elseif($time2>=86400)$time6="$time5 дн. $time5_o ч.";
include "gb/smile.php";
print "<b>$time6 назад</b><br/>$text<br/>";
print "<br/>-----<br/>";
}
echo "<form action=\"mail.php?id=$id&pass=$pass&mode=5&p=2\" method=\"post\">";
echo "<input class=\"button\" type=\"submit\" value=\"Удалить все\"/></form><br/>";
break;
case "3":
$a=mysql_query("select * from mail where kto='$id' and type='1' order by id desc limit 10");
while($b=mysql_fetch_array($a)){
$komu=$b['komu'];
$text=$b['text'];
$time=$b['time'];
$b=mysql_fetch_array(mysql_query("select login from user where id='$komu'"));
$blogin=$b['login'];
include "gb/smile.php";
print "<b>$blogin</b> [$time]<br/>$text<br/>";
print "-----<br/>";
}
break;
case "4":
if($p==1){
$text1 = htmlspecialchars(stripslashes($text1));
if(empty($text1)){
print "Пустое сообщение<br/>";
}else{
$b=mysql_fetch_array(mysql_query("select id from users where login='$komu'"));
$bid=$b['id'];
$text1 = str_replace('И', 'и', $text1);
$text1 = str_replace('ш', 'Ш', $text1);
$datet=date("d.m H:i");
mysql_query("insert into mail values(0,'$id','$bid','$text1','1','$datet');");
print "Письмо отправлено<br/>";
}
}else{
echo "<form action=\"mail.php?id=$id&pass=$pass&mode=4&p=1\" method=\"post\">
<postfield name=\"komu\" value=\"$(komu)\"/>
<postfield name=\"text1\" value=\"$(text1)\"/>";
print "Кому:<br/>";
print "<input name=\"komu\" value=\"$komu\" maxlength=\"20\"/><br/>";
print "Сообщение<br/>";
print "<input name=\"text1\" value=\"$text1\" maxlength=\"500\"/><br/>";
echo "<input class=\"button_medium\" type=\"submit\" value=\"Отправить\"/>";
echo "</form>";
}
break;
case "5":
if($p==1){
if($s==1){
mysql_query("delete from mail where komu='$id' and type='1'");
print "Сообщения удалены<br/>";
}else{
print "Вы действительно хотите удалить все сообщения в папке <b>Входящие</b>";
echo "<form action=\"mail.php?id=$id&pass=$pass&mode=5&p=1&s=1\" method=\"post\">";
echo "<input class=\"button_medium\" type=\"submit\" value=\"Да\"/></form><br/>";
}
}
elseif($p==2){
if($s==1){
mysql_query("delete from mail where komu='$id' and type='2'");
print "Сообщения удалены<br/>";
}else{
print "Вы действительно хотите удалить все сообщения в папке <b>Системные</b>";
echo "<form action=\"mail.php?id=$id&pass=$pass&mode=5&p=2&s=1\" method=\"post\">";
echo "<input class=\"button_medium\" type=\"submit\" value=\"Да\"/></form><br/>";
}
}
break;
case "6":
$a=mysql_query("select * from mail where komu='$cname' and type='1' order by id desc limit 10");
while($a1=mysql_fetch_array($a)){
$kto=$a1['kto'];
$text=$a1['text'];
$time=$a1['time'];
$b=mysql_fetch_array(mysql_query("select login from users where id='$kto'"));
$blogin=$b['login'];
include "gb/smile.php";
print "<b>$blogin</b> [$time]<br/>$text<br/>";
echo "<form action=\"mail.php?id=$id&pass=$pass&mode=4&komu=$blogin\" method=\"post\">";
echo "<input class=\"button_medium\" type=\"submit\" value=\"Ответить\"/></form><br/>";
}
break;
}
print "<a href=\"game.php?id=$id&pass=$pass\">Назад</a><br/>";
mysql_close();
print "</body></html>";
mysql_close();
?>