PHP:
<?
session_start(); //yeni session baюlat
include 'inc/statistic.php';
if (!isset($_SESSION['id']))
{
header ("location: logout.php");
exit('incorrect');
}
include 'inc/config.system.php';
include 'inc/config.game.php';
//mysql fetch
$res = mysql_fetch_assoc(count_query("SELECT *
FROM user
WHERE id = '".$_SESSION['id']."'"));
$house_cost = pl_cost($res['pl_house'],'house');
$fence_cost = pl_cost($res['pl_fence'],'fence');
$road_cost = pl_cost($res['pl_road'],'road');
$nbh_cost = pl_cost($res['pl_nbh'],'nbh');
if ($_GET['b']==1 && $res['gold']>=$house_cost)
{
count_query("UPDATE user
SET pl_house=pl_house+1, gold=gold-'$house_cost'
WHERE id = '".$_SESSION['id']."'");
Header("Location: z_palace.php");
exit;
}
if ($_GET['b']==2 AND $res['gold']>=$fence_cost AND $res['pl_house']>$res['pl_fence'])
{
count_query("UPDATE user
SET pl_fence=pl_fence+1, gold=gold-'$fence_cost'
WHERE id = '".$_SESSION['id']."'");
Header("Location: z_palace.php");
exit;
}
if ($_GET['b']==3 AND $res['gold']>=$road_cost AND $res['pl_house']>$res['pl_road'])
{
count_query("UPDATE user
SET pl_road=pl_road+1, gold=gold-'$road_cost'
WHERE id = '".$_SESSION['id']."'");
Header("Location: z_palace.php");
exit;
}
if ($_GET['b']==4 AND $res['gold']>=$nbh_cost AND $res['pl_house']>$res['pl_nbh'])
{
count_query("UPDATE user
SET pl_nbh=pl_nbh+1, gold=gold-'$nbh_cost'
WHERE id = '".$_SESSION['id']."'");
Header("Location: z_palace.php");
exit;
}
if ($_GET['i']==1 AND $res['ignicit']>=20)
{
if($res['pl_chest_t']>time()) //item expire sьresi
{
$time=$res['pl_chest_t']+2419200;
}
else
{
$time=time()+2419200;
}
count_query("UPDATE user
SET pl_chest_t='$time', ignicit=ignicit-20
WHERE id = '".$_SESSION['id']."'");
Header("Location: z_palace.php");
exit;
}
if ($_GET['i']==2 AND $res['ignicit']>=20)
{
if($res['pl_grg_t']>time()) //item expire sьresi
{
$time=$res['pl_grg_t']+2419200;
}
else
{
$time=time()+2419200;
}
count_query("UPDATE user
SET pl_grg_t='$time', ignicit=ignicit-20
WHERE id = '".$_SESSION['id']."'");
Header("Location: z_palace.php");
exit;
}
if ($_GET['i']==3 AND $res['ignicit']>=20) //taюlarэ kontrol et
{
if($res['pl_book_t']>time())
{
$time=$res['pl_book_t']+2419200;
}
else
{
$time=time()+2419200;
}
count_query("UPDATE user
SET pl_book_t='$time', ignicit=ignicit-20
WHERE id = '".$_SESSION['id']."'");
Header("Location: z_palace.php");
exit;
}
?>
Код:
Notice: Undefined index: b in C:\xampp\htdocs\z_palace.php on line 22
Notice: Undefined index: b in C:\xampp\htdocs\z_palace.php on line 30
Notice: Undefined index: b in C:\xampp\htdocs\z_palace.php on line 38
Notice: Undefined index: b in C:\xampp\htdocs\z_palace.php on line 46
Notice: Undefined index: i in C:\xampp\htdocs\z_palace.php on line 58
Notice: Undefined index: i in C:\xampp\htdocs\z_palace.php on line 74
Notice: Undefined index: i in C:\xampp\htdocs\z_palace.php on line 90
PHP:
22 if ($_GET['b']==1 && $res['gold']>=$house_cost)
30 if ($_GET['b']==2 AND $res['gold']>=$fence_cost AND $res['pl_house']>$res['pl_fence'])
38 if ($_GET['b']==3 AND $res['gold']>=$road_cost AND $res['pl_house']>$res['pl_road'])
46 if ($_GET['b']==4 AND $res['gold']>=$nbh_cost AND $res['pl_house']>$res['pl_nbh'])
58 if ($_GET['i']==1 AND $res['ignicit']>=20)
74 if ($_GET['i']==2 AND $res['ignicit']>=20)
90 if ($_GET['i']==3 AND $res['ignicit']>=20) //taюlarэ kontrol et