View file gta/city1/user_home.php

File size: 13.57Kb
<?php
include "./../ini3.php";
include "./../includes/header$h.php";
include "./../includes/inc_online.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'];
$gold=$data['gold'];
$antikiller=$data['antikiller'];
$lox=$data['lox'];
$kvest=$data['kvest'];

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";


$uh_q=mysql_fetch_array(mysql_query("select * from user_home where userid='".$id."';"));
if($ban==0)
{



$uh_guns=$uh_q['guns'];
$uh_cars=$uh_q['cars'];
$uh_money=$uh_q['money'];
$uh_userid=$uh_q['userid'];
$biznes=$uh_q['biznes'];
$eurob=$uh_q['eurobiznes'];

if($biznes==0)$cena=15000;
elseif($biznes==1)$cena=30000;
elseif($biznes==2)$cena=55000;
elseif($biznes==3)$cena=75000;
elseif($biznes==4)$cena=100000;
elseif($biznes==5)$cena=200000;
elseif($biznes==6)$cena=3000;
elseif($biznes==7)$cena=4000;
elseif($biznes==8)$cena=6000;
elseif($biznes==9)$cena=2500;
if($kvest==10)$cena=ceil($cena*0.7);

if($eurob==0)$cena2=300;
elseif($eurob==1)$cena2=600;
elseif($eurob==2)$cena2=1500;
elseif($eurob==3)$cena2=3000;
elseif($eurob==4)$cena2=5000;

if(empty($uh_cars) && empty($uh_guns) && empty($uh_money) && empty($uh_userid))
mysql_query("insert into user_home values(0,'$id','','','0','0','0');");

mysql_query("update users set last='".time()."',city='1' where id='".$id."';");
print "<b>[Зд: $health %][<img src='a href=\./../../pic/energy.gif' title='Энергия'/>: $energy %][Зщ: $secur %]</b><br/>";


print "<b>".$lang['game_city1']."</b><br/>";

switch ($mode)
{
  case "cars":
 if($p=="1")
{
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>:<br/>";
echo "<form action=\"user_home.php?id=$id&amp;pass=$pass&amp;a=v&amp;mode=cars\" method=\"post\">";
print "<select name=\"tachka\">";
for($i=0;$i<$count_cars;$i++)
{
print "<option value=\"".$cars_count[$i]."\">".$cars_count[$i]."</option>";
}
print "</select>";
echo "<input class=\"button\" type=\"submit\" value=\"".$lang['bands_take']."\"/>";
    echo "</form><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></body>
</html>");

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($p=="2")
{
if(empty($tachka))
{
if(!empty($cars))
{
$cars_count = explode(".", $cars);
$count_cars=count($cars_count);
print $lang['uv_cars']." <b>($count_cars)</b>:<br/>";
echo "<form action=\"user_home.php?id=$id&amp;pass=$pass&amp;a=d&amp;mode=cars\" method=\"post\">
<postfield name=\"tachka\" value=\"$(tachka)\"/>";
print "<select name=\"tachka\">";
for($i=0;$i<$count_cars;$i++)
{
print "<option value=\"".$cars_count[$i]."\">".$cars_count[$i]."</option>";
}
print "</select>";
echo "<input class=\"button\" type=\"submit\" value=\"".$lang['bands_add']."\"/>";
    echo "</form><br/>";
}
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></body>
</html>");

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&amp;pass=$pass&amp;p=1&amp;mode=cars\">".$lang['uh_take_car_from_garage']."</a><br/>";
print "<a href=\"user_home.php?id=$id&amp;pass=$pass&amp;p=2&amp;mode=cars\">".$lang['uh_add_car_into_garage']."</a><br/>";

print "&gt;<a href=\"user_home.php?id=$id&amp;pass=$pass\">".$lang['sl_your_home']."</a><br/>";

    break;
  case "guns":
if($p=="1")
{
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>:<br/>";
echo "<form action=\"user_home.php?id=$id&amp;pass=$pass&amp;a=v&amp;mode=guns\" method=\"post\">
<postfield name=\"puwka\" value=\"$(puwka)\"/>";
print "<select name=\"puwka\">";
for($i=0;$i<$count_guns;$i++)
{
print "<option value=\"".$guns_count[$i]."\">".$guns_count[$i]."</option>";
}
print "</select>";
echo "<input class=\"button\" type=\"submit\" value=\"".$lang['bands_take']."\"/>";
echo "</form><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></body>
</html>");

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($p=="2")
{
if(empty($puwka))
{
if(!empty($guns))
{
$guns_count = explode(".", $guns);
$count_guns=count($guns_count);
print $lang['uv_cars']." <b>($count_guns)</b>:<br/>";
echo "<form action=\"user_home.php?id=$id&amp;pass=$pass&amp;a=d&amp;mode=guns\" method=\"post\">
<postfield name=\"puwka\" value=\"$(puwka)\"/>";
print "<select name=\"puwka\">";
for($i=0;$i<$count_guns;$i++)
{
print "<option value=\"".$guns_count[$i]."\">".$guns_count[$i]."</option>";
}
print "</select>";
echo "<input class=\"button\" type=\"submit\" value=\"".$lang['bands_add']."\"/>";
echo "</form><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></body>
</html>");

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&amp;pass=$pass&amp;p=1&amp;mode=guns\">".$lang['uh_take_gun_from_sklad']."</a><br/>";
print "<a href=\"user_home.php?id=$id&amp;pass=$pass&amp;p=2&amp;mode=guns\">".$lang['uh_add_gun_into_sklad']."</a><br/>";

print "&gt;<a href=\"user_home.php?id=$id&amp;pass=$pass\">".$lang['sl_your_home']."</a><br/>";

    break;
	case "update":
	print "Здесь ты можешь улучшать свой дом<br/>";

	print "<b>Бизнес</b><br/>";

print "Позволяет зарабатывать деньги каждый час<br/>";
print "<b>Сейчас уровень:</b> $biznes из 10<br/>";
print "<b>Сейчас ты зарабатываешь:</b> $zar <img src='a href=\./../../pic/money.gif' title='Деньги'/> в час<br/>";
if($biznes<6){print "Стоимость: <b>$cena <img src='a href=\./../../pic/money.gif' title='Деньги'/></b><br/>";
echo "<div class='button'><a href=\"user_home.php?id=$id&amp;pass=$pass&amp;mode=biznes&amp;p=1\" class='button_medium'>Улучшить</a></div><br/>";
}
elseif($biznes>=6 && $biznes<9){print "Стоимость: <b>$cena <img src='a href=\./../../pic/euro.gif' title='Евро'/></b><br/>";
echo "<div class='button'><a href=\"user_home.php?id=$id&amp;pass=$pass&amp;mode=biznes&amp;p=2\" class='button_medium'>Улучшить</a></div><br/>";
}
if($biznes==9){print "Стоимость: <b>$cena <img src='a href=\./../../pic/gold.png' title='Золото'/></b><br/>";
echo "<div class='button'><a href=\"user_home.php?id=$id&amp;pass=$pass&amp;mode=biznes&amp;p=3\" class='button_medium'>Улучшить</a></div><br/>";
}
print "---<br/>";
	print "<b>Контрабанда</b><br/>";

print "Позволяет зарабатывать евро каждый час<br/>";
print "<b>Сейчас уровень:</b> $eurob из 5<br/>";
print "<b>Сейчас ты зарабатываешь:</b> $zar2 <img src='a href=\./../../pic/euro.gif' title='Евро'/> в час<br/>";
if($eurob<5){print "Стоимость: <b>$cena2 <img src='a href=\./../../pic/gold.png' title='Золото'/></b><br/>";
print "<div class='button'><a href=\"user_home.php?id=$id&amp;pass=$pass&amp;mode=eurobiznes\" class='button_medium'>Улучшить</a></div><br/>";
}
	break;
	case "biznes":
	if($p==1 && $biznes<6 && $money>=$cena){
	$money=$money-$cena;
++$biznes;
mysql_query("update users set money='$money' where id='$id';");
mysql_query("update user_home set biznes='$biznes' where userid='$id';");
print "Бизнес улучшен!<br/>";
}
	elseif($p==2 && $biznes>=6 && $biznes<9 && $euro>=$cena){
	$euro=$euro-$cena;
++$biznes;
mysql_query("update users set euro='$euro' where id='$id';");
mysql_query("update user_home set biznes='$biznes' where userid='$id';");
print "Бизнес улучшен!<br/>";
}
	elseif($p==3 && $biznes==9 && $gold>=$cena){
	$gold=$gold-$cena;
++$biznes;
mysql_query("update users set gold='$gold' where id='$id';");
mysql_query("update user_home set biznes='$biznes' where userid='$id';");
print "Бизнес улучшен!<br/>";
}

	break;
	case "eurobiznes":
		if($eurob<5 && $gold>=$cena2){
	$gold=$gold-$cena2;
++$eurob;
mysql_query("update users set gold='$gold' where id='$id';");
mysql_query("update user_home set eurobiznes='$eurob' where userid='$id';");
print "Контрабанда улучшена!<br/>";
}
	break;
default:
print "<u>[".$lang['uh_logovo']."]</u><br/>";
print $lang['uh_enter'];
print "<a href=\"./../profile.php?id=$id&amp;pass=$pass\">".$lang['uh_your_profile']."</a><br/>";
print "<a href=\"user_home.php?id=$id&amp;pass=$pass&amp;mode=cars\">".$lang['uh_your_cars']."</a><br/>";
print "<a href=\"user_home.php?id=$id&amp;pass=$pass&amp;mode=guns\">".$lang['uh_your_guns']."</a><br/>";
print "<a href=\"user_home.php?id=$id&amp;pass=$pass&amp;mode=update\">Улучшения</a><br/>";
  break;
}


print "---<br/>&gt;<a href=\"index.php?id=$id&amp;pass=$pass\">".$lang['in_city']."</a>";
print "<br/>&gt;&gt;<a href=\"./../game.php?id=$id&amp;pass=$pass\">".$lang['menu']."</a>";
print "<br/>---";

mysql_close();
include "./../includes/footer2.php";
}

elseif($ban==1)
{
die ($lang['empty_login']."</body>
</html>");

}
?>