Файл: chats/city1/user_home.php
Строк: 486
<?php
require( "../inc/conf.inc.php" );
require( "../inc/check.php" );
include "./../includes/header.php";
include "../includes/inc_online.php";
include "../russian/lang_main.php"; //языковой файл
if(!empty($id))
{
$q = mysql_query("select golod,nums,guns,cars,id,login,pass,mafcredits,level,police,health from users where id='".$id."';");
}
$data = mysql_fetch_array($q);
$id=$data['id'];
$login=$data['login'];
$mafcredits=$data['mafcredits'];
$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'];
$golod=$data['golod'];
$uh_q=mysql_fetch_array(mysql_query("select userid,guns,cars,mafcredits from user_home where userid='".$id."';"));
$uh_guns=$uh_q['guns'];
$uh_cars=$uh_q['cars'];
$uh_mafcredits=$uh_q['mafcredits'];
$uh_userid=$uh_q['userid'];
if(empty($uh_cars) && empty($uh_guns) && empty($uh_mafcredits) && empty($uh_userid))
mysql_query("insert into user_home values(0,'$id','','','');");
mysql_query("update users set last='".time()."',city='1' where id='".$id."';");
print "<div><b>".$lang['game_city1']."</b><br>Город трущоб</div>";
switch ($mode)
{
case "cars":
if($a=="v")
{
if(empty($tachka))
{
if(!empty($uh_cars))
{
$cars_count = explode(".", $uh_cars);
$count_cars=count($cars_count);
print $lang['uv_cars']." <b>($count_cars)</b>:</small><br/>";
echo "<form method="post" action="user_home.php?id=$id&pass=$pass&a=v&mode=cars">";
print "<select name="tachka">";
for($i=0;$i<$count_cars;$i++)
{
print "<option value="".$cars_count[$i]."">".$cars_count[$i]."</option>";
}
echo "<input value="Взять" type="submit" class="cp">rn</form>";
//print "</select><br/><small>
//<anchor>".$lang['bands_take']."
///////////<go href="user_home.php?id=$id&pass=$pass&a=v&mode=cars" method="post">
//<postfield name="tachka" value="$(tachka)"/>
//</go>
//</anchor><br/>";
}
else
{
print $lang['uh_garage_empty'];
}
}
else
{
$cars_count = explode(".", $uh_cars);
$count_cars=count($cars_count);
if(!in_array($tachka,$cars_count)) die($lang['fa_car_false']."<br/><anchor>".$lang['back']."<prev/></anchor></small></p></card></wml>");
if(empty($cars)) mysql_query("update users set cars='$tachka' where id='".$id."';");
else mysql_query("update users set cars='$cars.$tachka' where id='".$id."';");
$cars_count = explode(".", $uh_cars);
$count_cars=count($cars_count);
if($count_cars<=1)
{
$uh_cars=str_replace("$tachka","","$uh_cars");
mysql_query("update user_home set cars='$uh_cars' where userid='".$id."';");
}
elseif($count_cars>1 && $cars_count[0]!=$tachka)
{
$uh_cars=str_replace(".$tachka","","$uh_cars");
mysql_query("update user_home set cars='$uh_cars' where userid='".$id."';");
}
elseif($count_cars>1 && $cars_count[0]==$tachka)
{
$uh_cars=str_replace("$tachka.","","$uh_cars");
mysql_query("update user_home set cars='$uh_cars' where userid='".$id."';");
}
print "<b>$tachka</b> ".$lang['uh_now_at_you']."<br/>";
}
}
elseif($a=="d")
{
if(empty($tachka))
{
if(!empty($cars))
{
$cars_count = explode(".", $cars);
$count_cars=count($cars_count);
print $lang['uv_cars']." <b>($count_cars)</b>:</small><br/>";
echo "<form method="post" action="user_home.php?id=$id&pass=$pass&a=d&mode=cars">";
print "<select name="tachka">";
for($i=0;$i<$count_cars;$i++)
{
print "<option value="".$cars_count[$i]."">".$cars_count[$i]."</option>";
}
echo "<input value="Закрыть гараж" type="submit" class="cp">rn</form>";
}
////////////////////////////////////////
//echo "<form method="post" action="user_home.php?id=$id&pass=$pass&a=d&mode=cars">";
//{
//print "<option value="".$cars_count[$i]."">".$cars_count[$i]."</option>";
//}
//echo "<input value="Сохранить" type="submit" class="cp">rn</form>";
else
{
print $lang['uh_you_without_cars'];
}
}
else
{
$cars_count = explode(".", $cars);
if(!in_array($tachka,$cars_count)) die($lang['fa_car_false']."<br/><anchor>".$lang['back']."<prev/></anchor></small></p></card></wml>");
if(empty($uh_cars)) mysql_query("update user_home set cars='$tachka' where userid='".$id."';");
else mysql_query("update user_home set cars='$uh_cars.$tachka' where userid='".$id."';");
$count_cars=count($cars_count);
if($count_cars<=1)
{
$cars=str_replace("$tachka","","$cars");
mysql_query("update users set cars='$cars' where id='".$id."';");
}
elseif($count_cars>1 && $cars_count[0]!=$tachka)
{
$cars=str_replace(".$tachka","","$cars");
mysql_query("update users set cars='$cars' where id='".$id."';");
}
elseif($count_cars>1 && $cars_count[0]==$tachka)
{
$cars=str_replace("$tachka.","","$cars");
mysql_query("update users set cars='$cars' where id='".$id."';");
}
print "<b>$tachka</b> ".$lang['uh_now_at_garage']."<br/>";
}
}
print "<a href="user_home.php?id=$id&pass=$pass&a=v&mode=cars">".$lang['uh_take_car_from_garage']."</a><br/>";
print "<a href="user_home.php?id=$id&pass=$pass&a=d&mode=cars">".$lang['uh_add_car_into_garage']."</a><br/>";
print "><a href="user_home.php?id=$id&pass=$pass">".$lang['sl_your_home']."</a><br/>";
break;
////////////////////////////////////////
//echo "<form method="post" action="user_home.php?id=$id&pass=$pass&a=v&mode=cars">";
//{
//print "<option value="".$cars_count[$i]."">".$cars_count[$i]."</option>";
//}
//echo "<input value="Сохранить" type="submit" class="cp">rn</form>";
case "guns":
if($a=="v")
{
if(empty($puwka))
{
if(!empty($uh_guns))
{
$guns_count = explode(".", $uh_guns);
$count_guns=count($guns_count);
print $lang['game_guns']." <b>($count_guns)</b>:</small><br/>";
echo "<form method="post" action="user_home.php?id=$id&pass=$pass&a=v&mode=guns">";
print "<select name="puwka">";
for($i=0;$i<$count_guns;$i++)
{
print "<option value="".$guns_count[$i]."">".$guns_count[$i]."</option>";
}
echo "<input value="Взять из сейфа" type="submit" class="cp">rn</form>";
//print "</select><br/><small>
//<anchor>".$lang['bands_take']."
/////////<go href="user_home.php?id=$id&pass=$pass&a=v&mode=guns" method="post">
//<postfield name="puwka" value="$(puwka)"/>
//</go>
//</anchor><br/>";
}
else
{
print $lang['uh_you_without_guns']."<br/>";
}
}
else
{
$guns_count = explode(".", $uh_guns);
$count_guns=count($guns_count);
if(!in_array($puwka,$guns_count)) die($lang['uh_sklad_without_guns']."<br/><anchor>".$lang['back']."<prev/></anchor></small></p></card></wml>");
if(empty($guns)) mysql_query("update users set guns='$puwka' where id='".$id."';");
else mysql_query("update users set guns='$guns.$puwka' where id='".$id."';");
$guns_count = explode(".", $uh_guns);
$count_guns=count($guns_count);
if($count_guns<=1)
{
$uh_guns=str_replace("$puwka","","$uh_guns");
mysql_query("update user_home set guns='$uh_guns' where userid='".$id."';");
}
elseif($count_guns>1 && $guns_count[0]!=$puwka)
{
$uh_guns=str_replace(".$puwka","","$uh_guns");
mysql_query("update user_home set guns='$uh_guns' where userid='".$id."';");
}
elseif($count_guns>1 && $guns_count[0]==$puwka)
{
$uh_guns=str_replace("$puwka.","","$uh_guns");
mysql_query("update user_home set guns='$uh_guns' where userid='".$id."';");
}
print "<b>$puwka</b> ".$lang['uh_now_at_you']."<br/>";
}
}
elseif($a=="d")
{
if(empty($puwka))
{
if(!empty($guns))
{
$guns_count = explode(".", $guns);
$count_guns=count($guns_count);
print $lang['uv_cars']." <b>($count_guns)</b>:</small><br/>";
echo "<form method="post" action="user_home.php?id=$id&pass=$pass&a=d&mode=guns">";
print "<select name="puwka">";
for($i=0;$i<$count_guns;$i++)
{
print "<option value="".$guns_count[$i]."">".$guns_count[$i]."</option>";
}
echo "<input value="Закрыть в сейф" type="submit" class="cp">rn</form>";
///print "</select><br/><small>
////<anchor>".$lang['bands_add']."
////<go href="user_home.php?id=$id&pass=$pass&a=d&mode=guns" method="post">
///<postfield name="puwka" value="$(puwka)"/>
///</go>
///</anchor><br/>";
}
else
{
print $lang['uh_sklad_without_guns']."<br/>";
}
}
else
{
$guns_count = explode(".", $guns);
if(!in_array($puwka,$guns_count)) die($lang['uh_sklad_without_guns']."<br/><anchor>".$lang['back']."<prev/></anchor></small></p></card></wml>");
if(empty($uh_guns)) mysql_query("update user_home set guns='$puwka' where userid='".$id."';");
else mysql_query("update user_home set guns='$uh_guns.$puwka' where userid='".$id."';");
$count_guns=count($guns_count);
if($count_guns<=1)
{
$guns=str_replace("$puwka","","$guns");
mysql_query("update users set guns='$guns' where id='".$id."';");
}
elseif($count_guns>1 && $guns_count[0]!=$puwka)
{
$guns=str_replace(".$puwka","","$guns");
mysql_query("update users set guns='$guns' where id='".$id."';");
}
elseif($count_guns>1 && $guns_count[0]==$puwka)
{
$guns=str_replace("$puwka.","","$guns");
mysql_query("update users set guns='$guns' where id='".$id."';");
}
print "<b>$puwka</b> ".$lang['uh_now_at_you_sklad']."<br/>";
}
}
print "<a href="user_home.php?id=$id&pass=$pass&a=v&mode=guns">".$lang['uh_take_gun_from_sklad']."</a><br/>";
print "<a href="user_home.php?id=$id&pass=$pass&a=d&mode=guns">".$lang['uh_add_gun_into_sklad']."</a><br/>";
print "><a href="user_home.php?id=$id&pass=$pass">".$lang['sl_your_home']."</a><br/>";
break;
case "mafcredits":
if($a=="v")
{
if(empty($babl) || $babl<0)
{
if(empty($uh_mafcredits) || $uh_mafcredits<=0) print $lang['uh_your_safe_empty'];
else
{
print $lang['uh_in_safe']." <b>$uh_mafcredits</b>$$.";
print $lang['bands_how_much_mafcredits_you_want']."</small><br/>";
print "<input name="babl" format="*N" size="3"/><br/><small>";
print "<anchor>".$lang['ok']."<go href="user_home.php?id=$id&pass=$pass&a=v&mode=mafcredits" method="post">
<postfield name="babl" value="$(babl)"/></go></anchor><br/>";
}
}
else
{
if(empty($uh_mafcredits) || $uh_mafcredits<=0 || $babl<0) print $lang['uh_your_safe_empty'];
else
{
$babl=cyr(htmlspecialchars(stripslashes(trim($babl))));
$mafcredits=$babl+$mafcredits;
$babl=$uh_mafcredits-$babl;
if(empty($babl) || $babl<=0) print $lang['uh_your_safe_empty'];
else
{
mysql_query("update user_home set mafcredits='".$babl."' where userid='".$id."';");
mysql_query("update users set mafcredits='".$mafcredits."' where id='".$id."';");
print $lang['uh_now_at_you']." <b>$mafcredits</b>$$<br/>";
}
}
}
}
elseif($a=="d")
{
if(empty($babl))
{
if(empty($mafcredits) || $mafcredits<=0 || $babl<0) print $lang['voo_no_mafcredits']."<br/>";
else
{
print $lang['city1_at_you']." <b>$mafcredits</b>$$.";
print $lang['uh_mafcredits_into_safe'].":</small><br/>";
print "<input name="babl" format="*N" size="3"/><br/><small>";
print "<anchor>".$lang['ok']."<go href="user_home.php?id=$id&pass=$pass&a=d&mode=mafcredits" method="post">
<postfield name="babl" value="$(babl)"/></go></anchor><br/>";
}
}
else
{
if(empty($mafcredits) || $mafcredits<=0 || $babl<0) print $lang['voo_no_mafcredits']."<br/>";
else
{
$babl=cyr(htmlspecialchars(stripslashes(trim($babl))));
$mafcredits=$mafcredits-$babl;
$uh_mafcredits=$uh_mafcredits+$babl;
if($mafcredits<=0) die($lang['voo_no_mafcredits']."<br/><anchor>".$lang['back']."<prev/></anchor></small></p></card></wml>");
mysql_query("update user_home set mafcredits='".$uh_mafcredits."' where userid='".$id."';");
mysql_query("update users set mafcredits='".$mafcredits."' where id='".$id."';");
print $lang['uh_in_safe']." <b>".$babl."</b>$$<br/>";
}
}
}
print "<a href="user_home.php?id=$id&pass=$pass&a=v&mode=mafcredits">".$lang['uh_take_mafcredits_from_safe']."</a><br/>";
print "<a href="user_home.php?id=$id&pass=$pass&a=d&mode=mafcredits">".$lang['uh_add_mafcredits_into_safe']."</a><br/>";
print "><a href="user_home.php?id=$id&pass=$pass">".$lang['sl_your_home']."</a><br/>";
break;
case "mails":
if($a!="see" && $a!="new")
{
print "-<a href="user_home.php?id=$id&pass=$pass&a=see&mode=mails">".$lang['uh_view_mes']."</a><br/>";
print "-<a href="user_home.php?id=$id&pass=$pass&a=new&mode=mails">".$lang['uh_write_mes']."</a><br/>";
print "-<a href="user_home.php?id=$id&pass=$pass&a=see&mode=mails&del=y">".$lang['uh_del_all_mes']."</a><br/>";
}
elseif($a=="see")
{
if(!empty($del))
{
mysql_query("DELETE FROM messagi WHERE komu='".$id."';");
print $lang['uh_mes_empty'];
}
$mess_q = mysql_query("select * from messagi where komu='$id' order by id desc limit 10;");
if(!empty($mess_q))
{
while($arrm=mysql_fetch_array($mess_q))
{
print $arrm['msg']."<br/>";
}
}
}
elseif($a=="new")
{
if(!empty($messaga) && !empty($who))
{
if(empty($messaga) || empty($who)) print $lang['mes_empty']."<br/>";
else
{
$who=htmlspecialchars(stripslashes(trim($who)));
$db=mysql_fetch_array(mysql_query("select login,id,pass from users where login='".$who."';"));
$dbid=$db['id'];
$dbpass=$db['pass'];
$dblogin=$db['login'];
if(empty($dbid)) die($lang['select_user_false']."<br/><anchor>".$lang['back']."<prev/></anchor></small></p></card></wml>");
$predl_que=mysql_query("select komu from messagi where kto='$id' and komu='$dbid';");
$predl_data = mysql_fetch_array($predl_que);
if(!empty($predl_data['komu'])) print $lang['patience']."<br/>";
else
{
print $lang['mes_succes1']." $dblogin ".$lang['mes_succes2']."<br/>";
$messaga=htmlspecialchars(stripslashes(trim($messaga)));
$messaga="<b>".$lang['mes_mes1']." $login:</b><br/>".$messaga."<br/>[<a href="./../mes.php?pass=$dbpass&id=$dbid&dbid=$id&mode=reply">".$lang['mes_reply']."</a>/<a href="./../mes.php?pass=$dbpass&id=$dbid&dbid=$id&mode=del">".$lang['mes_del']."</a>]";
mysql_query("insert into messagi values(0,'$id','$dbid','$messaga');");
}
}
}
else
{
//print $lang['uh_mes_whom'];
//print "</small><br/>";
//print "<input name="who" type="text"/><br/><small>";
//print $lang['uh_mes_text'];
//print "</small><br/>";
//print "<input name="messaga" type="text"/><br/><small>";
//print "<anchor>".$lang['ok']."
//<go href="user_home.php?id=$id&pass=$pass&mode=mails&a=new" method="post">
//<postfield name="messaga" value="$(messaga)"/>
//<postfield name="who" value="$(who)"/>
//</go>
//</anchor><br/>";
echo "<form method="post" action="user_home.php?id=$id&pass=$pass&mode=mails&a=new">";
print $lang['uh_mes_whom'];
print "<input name="who" type="text"/><br/>";
print $lang['uh_mes_text'];
print "<input name="messaga" type="text"/><br/>";
echo "<input value="Отправка" type="submit"/>";
echo "</form>";
}
}
print "><a href="user_home.php?id=$id&pass=$pass&mode=mails">".$lang['uh_your_mails']."</a><br/>";
print ">><a href="user_home.php?id=$id&pass=$pass">".$lang['sl_your_home']."</a><br/>";
break;
default:
print "<u>[".$lang['uh_logovo']."]</u><br/>";
print $lang['uh_enter'];
print "<br>";
print "<a href="user_home.php?id=$id&pass=$pass&mode=cars">".$lang['uh_your_cars']."</a><br/>";
print "<a href="user_home.php?id=$id&pass=$pass&mode=guns">".$lang['uh_your_guns']."</a><br/>";
print "<a href="user_home.php?id=$id&pass=$pass&mode=mafcredits">".$lang['uh_your_mafcredits']."</a><br/>";
print "<a href="user_home.php?id=$id&pass=$pass&mode=mails">".$lang['uh_your_mails']."</a><br/>";
break;
}
print "---<br/>><a href="index.php?id=$id&pass=$pass">".$lang['in_city']."</a>";
print "<br/>>><a href="./../game.php?id=$id&pass=$pass">".$lang['menu']."</a>";
print "<br/>---";
echo "<br/><a href="../enter.php?id={$id}&pass={$pass}&ref={$ref}">Прихожка</a><br/>";
mysql_close();
include "./../includes/footer.php";
?>