Файл: LinkUser/LinkUserShop.php
Строк: 516
<?php
if(isset($_GET['shop'])){
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_shop`"),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_shop` ORDER BY `id` DESC LIMIT $start, $user[set]");
echo '<ul>';
while($post=mysql_fetch_array($q))
{
echo '<li><a class="btn" href="?LinkUserShop&'.$post['link'].'='.$post['id'].'"><img width="24" height="24" src="images/icons_shop/'.$post['ico'].'.png" alt=""/> '.$post['name'].'</a></li>';
}
echo '</ul>';
if ($k_page>1)str("?LinkUserShop&shop&",$k_page,$page);
}elseif(isset($_GET['razdel']) && num($_GET['razdel'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_shop_razdel` WHERE `type` = '".num($_GET['razdel'])."' AND (`level` < '$user[level]' OR `level` = '$user[level]') LIMIT 1"),0)!=0){
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_shop_razdel` WHERE `type` = '".num($_GET['razdel'])."'"),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_shop_razdel` WHERE `type` = '".num($_GET['razdel'])."' ORDER BY `id` DESC LIMIT $start, $user[set]");
echo '<ul>';
while($post=mysql_fetch_array($q))
{
$posts = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_shop_razdels` WHERE `path` = '".$post['id']."'"));
echo '<li><div style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px;">
<div style="padding: 4px;"><a style="color: #fff; text-decoration: none;" href="?LinkUserShop&link='.$post['id'].'">
<div style="margin-top: 4px;"><img width="16" height="16" alt="o" src="'.$post['v3'].'"/>
<span>Уровень: '.$posts['level'].'</span><span class="fr"><span>
<span class="beauty nobr textshadow"><img width="16" height="16" alt="крутость" title="крутость" src="images/icons/beauty.png"> <span>'.$post['glamm'].'</span></span>
</span><br/></span></div></a></div>
<div style="clear: both;"></div><div style="margin: 8px 0; padding-left: 4px;">
<a style="text-decoration: none;" href="?LinkUserShop&link='.$post['id'].'">';
if($post['v1'])echo '<img height="48" width="48" alt="o" src="'.$post['v1'].'">';
if($post['v2'])echo '<img height="48" width="48" alt="o" src="'.$post['v2'].'">';
if($post['v3'])echo '<img height="48" width="48" alt="o" src="'.$post['v3'].'">';
if($post['v4'])echo '<img height="48" width="48" alt="o" src="'.$post['v4'].'">';
if($post['v5'])echo '<img height="48" width="48" alt="o" src="'.$post['v5'].'">';
if($post['v6'])echo '<img height="48" width="48" alt="o" src="'.$post['v6'].'">';
echo '</a></div>';
echo ''.($user['level']>=$posts['level']?'<a class="btnwom" href="?Error">
<img src="images/icons/tick.png" width="16" height="16" alt="o"/>
Купить<span class="fr"><span class="money nobr textshadow"><img width="16" height="16" src="images/icons/ruby.png" alt=""/> <span class="required">'.$post['cena'].'</span></span></span>
</a>':'').'';
echo '</div></li>';
}
echo '</ul>';
if ($k_page>1)str("?LinkUserShop&razdel=".num($_GET['razdel'])."&",$k_page,$page);
}elseif(isset($_GET['link']) && num($_GET['link'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_shop_razdels` WHERE `path` = '".num($_GET['link'])."' LIMIT 1"),0)!=0){
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_shop_razdels` WHERE `path` = '".num($_GET['link'])."' "),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_shop_razdels` WHERE `path` = '".num($_GET['link'])."' ORDER BY `id` DESC LIMIT $start, $user[set]");
echo '<ul>';
while($post=mysql_fetch_array($q))
{
$pos ='set'.$post['path'].'/'.$post['img'].'';
$fe = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_things` WHERE `user` = '".$user['id']."' AND `imgs` = '".$pos."'"));
echo '<li>
<div style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px;">
<img class="portrait pt6 pl6 pr6" width="48" height="48" alt="шмот" src="images/items/set'.$post['path'].'/'.$post['img'].'.png">
<div class="pt12">
<span class="whiteBoldLink">'.$post['name'].'</span>
<span class="fr pr6 whiteLink">
<span>
<span class="beauty nobr textshadow"><img width="16" height="16" alt="крутость" title="крутость" src="images/icons/beauty.png"> <span>'.$post['glamm'].'</span></span>
</span>
</span>
</div>
<div style="clear: both;"></div>';
$pos ='set'.$post['path'].'/'.$post['img'].'';
if($fe['imgs'] == $pos){
}else{
echo ''.($user['level']>=$post['level']?'<a class="btnwom" href="?LinkUserShop&id='.$post['id'].'&iss='.$post['img'].'">
<img src="images/icons/tick.png" width="16" height="16" alt="o"/>
Купить
<span class="fr"><span class="money nobr textshadow"><img width="16" height="16" src="images/icons/ruby.png" alt=""/> <span>'.$post['cena'].'</span></span></span>
</a>':'<a class="btnwom" href="?LinkUserShop">
<img src="images/icons/tick.png" width="16" height="16" alt="o"/>
Требуется уровень '.$post['level'].'
<span class="fr"><span class="money nobr textshadow"><img width="16" height="16" src="images/icons/ruby.png" alt=""/> <span>'.$post['cena'].'</span></span></span>
</a>').'';
}
echo '</div></li>';
}
echo '</ul>';
if ($k_page>1)str("?LinkUserShop&link=".num($_GET['link'])."&",$k_page,$page);
}elseif(isset($_GET['album']) && num($_GET['album'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_album_shop` LIMIT 1"),0)!=0){
if(isset($_GET['Ok']))echo '<div class="feedbackPanel">"<span class="title">Успешно куплено!</span>"<div style="clear:both;"></div></div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_album_shop`"),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_album_shop` ORDER BY `id` DESC LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<li style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px;">
<img class="portrait pl6 pt6" width="48" height="48" alt="o" src="/images/jewel/marka'.$post['type'].'.png"/>
<div class="pt12">
<span class="whiteBoldLink pl12">'.$post['name'].'</span>
</div>
<div style="clear:both;"></div>
<a class="btnwom" href="?LinkUserShop&shop_album='.$post['id'].'">
<img src="/images/icons/tick.png" width="16" height="16" alt="o"/>
Купить
<span>
<img height="16" width="16" alt="o" src="/images/jewel/marka'.$post['type'].'.png">
</span> <span class="fr"><span class="money nobr textshadow">
<img width="16" height="16" src="/images/icons/ruby.png" alt=""/> <span>'.$post['ruby'].'</span></span></span>
</a>
</li>';
}
if($k_page>1)str("?LinkUserShop&album=".num($_GET['album'])."&",$k_page,$page);
}elseif(isset($_GET['id']) && isset($_GET['iss']) && num($_GET['id'])!=NULL && num($_GET['iss'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_shop_razdels` WHERE `id` = '".num($_GET['id'])."' AND `img` = '".num($_GET['iss'])."' AND (`level` < '$user[level]' OR `level` = '$user[level]') LIMIT 1"),0)!=0){
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_shop_razdels` WHERE `id` = '".num($_GET['id'])."' AND `img` = '".num($_GET['iss'])."'"));
if($user['level']>=$fer['level']){
$fe = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_things` WHERE `user` = '".$user['id']."' AND `name` = '".$fer['name']."'"));
$pos ='set'.$fer['path'].'/'.$fer['img'].'';
if($fe['imgs'] == $pos){
header("Location: ?LinkUserShop");
exit;
}else{
if($ver8['col2'] == $ver8['col']){
mysql_query("UPDATE `mystyle_zadaniya_user` SET `type` = 'yes' WHERE `limit` = '8' AND `user` = '".$user['id']."'");
}else{
$stc = 1;
mysql_query("UPDATE `mystyle_zadaniya_user` SET `col2` = '".($ver8['col2']+$stc)."' WHERE `limit` = '8' AND `user` = '".$user['id']."'");
}
$need=$fer['cena'];
if($user['ruby']>=$need){
$set = 'set'.$fer['path'].'/'.$fer['img'].'';
$v = num($_GET['iss']);
update_ruby('ruby',$need);
$in = 'no';
update_things('name',$fer['name'],'imgs',$set,'glam',$fer['glamm'],'cena',$fer['cena'],'user',$user['id'],'type',$fer['type'],'in',$in,'ver',$v);
header("Location: ?LinkUserShop&ids=".$fer['id']."&siss=".$fer['img']."");
exit;
}else{
err_ruby($need-$user['ruby']);
}
}
}else{
header("Location: ?LinkUserShop");
exit;
}/////////level
}elseif(isset($_GET['shop_album']) && num($_GET['shop_album'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_album_shop` WHERE `id` = '".num($_GET['shop_album'])."' LIMIT 1"),0)!=0){
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_album_shop` WHERE `id` = '".num($_GET['shop_album'])."'"));
$need=$fer['ruby'];
if($user['ruby']>=$need){
shop_album('type',$fer['type'],'user',$user['id'],'glamm',$fer['glam'],'ruby',$fer['ruby']);
update_ruby('ruby',$need);
update_user('beauty',$fer['glam']);
header("Location: ?LinkUserShop&album=5&Ok");
exit;
}else{
err_ruby($need-$user['ruby']);
}
}elseif(isset($_GET['ids']) && isset($_GET['siss']) && num($_GET['ids'])!=NULL && num($_GET['siss'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_shop_razdels` WHERE `id` = '".num($_GET['ids'])."' AND `img` = '".num($_GET['siss'])."' AND (`level` < '$user[level]' OR `level` = '$user[level]') LIMIT 1"),0)!=0){
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_shop_razdels` WHERE `id` = '".num($_GET['ids'])."' AND `img` = '".num($_GET['siss'])."'"));
$set = 'set'.$fer['path'].'/'.$fer['img'].'';
echo '<div>
<div class="feedbackPanel">
<img width="48" height="48" class="portrait" src="images/items/'.$set.'.png">
<span>Поздравляем, Вы только что купили</span>
<span class="title">'.$fer['name'].'</span>, чтоб одеть эту вещь перейдите в Мой шмот:
<div style="clear:both;"></div></div></div><li>
<a class="btn" href="?things=1"><img width="24" height="24" src="images/icons/shirt.png" alt="моя одежда"/>Мой шмот</a></li>';
}elseif(isset($_GET['bone']) && num($_GET['bone'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_bone` WHERE `type` = '".num($_GET['bone'])."' LIMIT 1"),0)!=0){
if(isset($_GET['Ok']))echo '<div class="feedbackPanel">"<span class="title">Успешно куплено!</span>"<div style="clear:both;"></div></div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_bone` WHERE `type` = '".num($_GET['bone'])."' "),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_bone` WHERE `type` = '".num($_GET['bone'])."' ORDER BY `id` DESC LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<li><div><div style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px;">
<img class="portrait pl6" width="48" height="48" alt="Препараты" src="/images/sweets/'.$post['img'].'">
<div class="whiteBoldLink pt6 pl12">
<span>'.$post['name'].'</span><span class="fr">опыт
<span class="expirience">+'.$post['exp'].'%</span></span></div>
<div class="whiteLink pl12">Длительность <span>'.time_left($post['time']).'</span></div>
<div style="clear: both;"></div>';
if($user['bone_exp']){}else{
echo '<a class="btnwom" href="?LinkUserShop&bone_start='.$post['id'].'">
<img src="/images/icons/tick.png" width="16" height="16" alt="o"/> Купить
<span class="fr"><span class="money nobr textshadow"><img width="16" height="16" src="/images/icons/ruby.png" alt=""/>
<span class="required">'.$post['cena'].'</span></span></span></a>';
}
echo '</div></div></li>';
}
if($k_page>1)str("?LinkUserShop&bone=".num($_GET['bone'])."&",$k_page,$page);
}elseif(isset($_GET['bone_start']) && num($_GET['bone_start'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_bone` WHERE `id` = '".num($_GET['bone_start'])."' LIMIT 1"),0)!=0){
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_bone` WHERE `id` = '".num($_GET['bone_start'])."'"));
$need=$fer['cena'];
if($user['bone_exp']){}else{
if($user['ruby']>=$need){
update_ruby('ruby',$need);
$times_bone = $fer['time']+$time;
update_user('bone_time',$times_bone);
update_us('bone_exp',$fer['exp']);
update_us('bone_name',$fer['name']);
update_us('bone_img',$fer['img']);
if($ver9['col2'] == $ver9['col']){
mysql_query("UPDATE `mystyle_zadaniya_user` SET `type` = 'yes' WHERE `limit` = '9' AND `user` = '".$user['id']."'");
}else{
$stc = 1;
mysql_query("UPDATE `mystyle_zadaniya_user` SET `col2` = '".($ver9['col2']+$stc)."' WHERE `limit` = '9' AND `user` = '".$user['id']."'");
}
header("Location: ?LinkUserShop&bone=4&Ok");
exit;
}else{
err_ruby($need-$user['ruby']);
}
} /// time
}elseif(isset($_GET['Accelerator']) && num($_GET['Accelerator'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_accelerator` WHERE `liv` = '".num($_GET['Accelerator'])."' LIMIT 1"),0)!=0){
if(isset($_GET['Ok']))echo '<div class="feedbackPanel">"<span class="title">Успешно куплено!</span>"<div style="clear:both;"></div></div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_accelerator` WHERE `liv` = '".num($_GET['Accelerator'])."' "),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_accelerator` WHERE `liv` = '".num($_GET['Accelerator'])."' LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<li><div style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px; background-color: #004272">';
echo '<img class="portrait pt6 pl6 pr6" width="48" height="48" src="/images/commands/'.$post['img'].'" alt=""/>';
echo '<div class="pt6"><span class="whiteBoldLink">Петух: '.$post['comand'].'</span>';
if($user_accelerator['id_accelerator'] == $post['id']){
echo '<span class="textshadow"> Выбран</span>';
}
if($user['level']>=$post['level']){
echo '<span class="fr pr6"><span><span class="money nobr textshadow">
<img width="16" height="16" src="/images/icons/coins.png" alt=""/>
<span>'.$post['money'].'</span></span></span> <span><span class="expirience nobr textshadow">
<img height="16" width="16" src="/images/icons/level.png"> <span>'.$post['exp'].'</span></span></span></span>';
}else{}
echo '</div>';
if($user['level']>=$post['level']){}else{
echo '<span class="textshadow">С '.$post['level'].' уровня</span>';
}
echo '<div style="clear:both"></div></div></li>';
if($user['level']>=$post['level']){
if($post['type'] == 'no'){
if($user_accelerator['id_accelerator'] == $post['id']){}else{
echo '<a class="btnwom" href="?LinkUserShop&Accelerator_start='.$post['id'].'">
<img src="/images/icons/tick.png" width="16" height="16" alt="o"/>
Купить
<span class="fr"><span class="money nobr textshadow"><img width="16" height="16" src="/images/icons/ruby.png" alt=""/> <span class="required">'.$post['ruby'].'</span></span></span>
</a>';
}
}
}else{}
}
if($k_page>1)str("?LinkUserShop&Accelerator=".num($_GET['Accelerator'])."&",$k_page,$page);
}elseif(isset($_GET['Accelerator_start']) && num($_GET['Accelerator_start'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_accelerator` WHERE `id` = '".num($_GET['Accelerator_start'])."' LIMIT 1"),0)!=0){
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_accelerator` WHERE `id` = '".num($_GET['Accelerator_start'])."'"));
$need=$fer['ruby'];
if($user_accelerator['id_accelerator'] == $fer['id']){
header("Location: ?LinkUserShop&shop&No");
}else{
if($user['ruby']>=$need){
update_ruby('ruby',$need);
if($user_accelerator['user']){ //////// Узнаем есть ли у него уже купленный петух
update_accelerator_update('id_accelerator',$fer['id'],'img',$fer['img'],'comand',$fer['comand'],'user',$user['id'],'time',$time,'money',$fer['money'],'exp',$fer['exp']);
}else{
update_accelerator('id_accelerator',$fer['id'],'img',$fer['img'],'comand',$fer['comand'],'user',$user['id'],'time',$time,'money',$fer['money'],'exp',$fer['exp']);
}
header("Location: ?LinkUserShop&Accelerator=6&Ok");
exit;
}else{
err_ruby($need-$user['ruby']);
}
}
}elseif(isset($_GET['toy']) && num($_GET['toy'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_toy` WHERE `liv` = '".num($_GET['toy'])."' LIMIT 1"),0)!=0){
if(isset($_GET['Ok']))echo '<div class="feedbackPanel">"<span class="title">Успешно куплен!</span>"<div style="clear:both;"></div></div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_toy` WHERE `liv` = '".num($_GET['toy'])."' "),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_toy` WHERE `liv` = '".num($_GET['toy'])."' LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<li><div style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px; background-color: #004272">';
echo '<img class="portrait pt6 pl6 pr6" width="48" height="48" src="images/play/'.$post['img'].'" alt=""/>';
echo '<div class="pt6"><span class="whiteBoldLink">'.$post['name'].'</span>';
if($user_toy['id_g'] == $post['id']){
echo '<span class="textshadow"> Выбран</span>';
}
if($user['level']>=$post['level']){
echo '<span class="fr pr6"><span><span class="money nobr textshadow">
<img width="16" height="16" src="/images/icons/coins.png" alt=""/>
<span>'.$post['money'].'</span></span></span> <span><span class="expirience nobr textshadow">
<img height="16" width="16" src="/images/icons/level.png"> <span>'.$post['exp'].'</span></span></span></span>';
}else{}
echo '</div>';
if($user['level']>=$post['level']){}else{
echo '<span class="textshadow">С '.$post['level'].' уровня</span>';
}
echo '<div style="clear:both"></div></div></li>';
if($user['level']>=$post['level']){
if($post['type'] == 'no'){
if($user_toy['id_g'] == $post['id']){}else{
echo '<a class="btnwom" href="?LinkUserShop&toy_start='.$post['id'].'">
<img src="/images/icons/tick.png" width="16" height="16" alt="o"/>
Купить
<span class="fr"><span class="money nobr textshadow"><img width="16" height="16" src="/images/icons/ruby.png" alt=""/> <span class="required">'.$post['ruby'].'</span></span></span>
</a>';
}
}
}else{}
}
if($k_page>1)str("?LinkUserShop&toy=".num($_GET['toy'])."&",$k_page,$page);
}elseif(isset($_GET['toy_start']) && num($_GET['toy_start'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_toy` WHERE `id` = '".num($_GET['toy_start'])."' LIMIT 1"),0)!=0){
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_toy` WHERE `id` = '".num($_GET['toy_start'])."'"));
$need=$fer['ruby'];
if($user_toy['id_g'] == $fer['id']){
header("Location: ?LinkUserShop&shop&No");
exit;
}else{
if($user['ruby']>=$need){
update_ruby('ruby',$need);
if($user_toy['user']){ //////// Узнаем есть ли у него уже купленный петух
update_toy_update('id_g',$fer['id'],'img',$fer['img'],'name',$fer['name'],'user',$user['id'],'time',$time,'money',$fer['money'],'exp',$fer['exp']);
}else{
update_toy('id_g',$fer['id'],'img',$fer['img'],'name',$fer['name'],'user',$user['id'],'time',$time,'money',$fer['money'],'exp',$fer['exp']);
}
header("Location: ?LinkUserShop&toy=3&Ok");
exit;
}else{
err_ruby($need-$user['ruby']);
}
}
}elseif(isset($_GET['food']) && num($_GET['food'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_food` WHERE `liv` = '".num($_GET['food'])."' LIMIT 1"),0)!=0){
if(isset($_GET['Ok']))echo '<div class="feedbackPanel">"<span class="title">Успешно куплен!</span>"<div style="clear:both;"></div></div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_food` WHERE `liv` = '".num($_GET['food'])."' "),0);
if ($k_post==0)
{
echo "Пусто!";
}
$k_page=k_page($k_post,$user['set']);
$page=page($k_page);
$start=$user['set']*$page-$user['set'];
$q=mysql_query("SELECT * FROM `mystyle_food` WHERE `liv` = '".num($_GET['food'])."' LIMIT $start, $user[set]");
while($post=mysql_fetch_array($q))
{
echo '<li><div style="border: 1px solid #005f8a; margin: 4px 0; border-radius: 4px; background-color: #004272">';
echo '<img class="portrait pt6 pl6 pr6" width="48" height="48" src="images/food/'.$post['img'].'" alt=""/>';
echo '<div class="pt6"><span class="whiteBoldLink">'.$post['name'].'</span>';
if($user_food['id_g'] == $post['id']){
echo '<span class="textshadow"> Выбран</span>';
}
if($user['level']>=$post['level']){
echo '<span class="fr pr6"><span><span class="money nobr textshadow">
<img width="16" height="16" src="/images/icons/coins.png" alt=""/>
<span>'.$post['money'].'</span></span></span> <span><span class="expirience nobr textshadow">
<img height="16" width="16" src="/images/icons/level.png"> <span>'.$post['exp'].'</span></span></span></span>';
}else{}
echo '</div>';
if($user['level']>=$post['level']){}else{
echo '<span class="textshadow">С '.$post['level'].' уровня</span>';
}
echo '<div style="clear:both"></div></div></li>';
if($user['level']>=$post['level']){
if($post['type'] == 'no'){
if($user_food['id_g'] == $post['id']){}else{
echo '<a class="btnwom" href="?LinkUserShop&food_start='.$post['id'].'">
<img src="/images/icons/tick.png" width="16" height="16" alt="o"/>
Купить
<span class="fr"><span class="money nobr textshadow"><img width="16" height="16" src="/images/icons/ruby.png" alt=""/> <span class="required">'.$post['ruby'].'</span></span></span>
</a>';
}
}
}else{}
}
if($k_page>1)str("?LinkUserShop&food=".num($_GET['food'])."&",$k_page,$page);
}elseif(isset($_GET['food_start']) && num($_GET['food_start'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `mystyle_food` WHERE `id` = '".num($_GET['food_start'])."' LIMIT 1"),0)!=0){
$fer = mysql_fetch_array(mysql_query("SELECT * FROM `mystyle_food` WHERE `id` = '".num($_GET['food_start'])."'"));
$need=$fer['ruby'];
if($user_food['id_g'] == $fer['id']){
header("Location: ?LinkUserShop&shop&No");
exit;
}else{
if($user['ruby']>=$need){
update_ruby('ruby',$need);
if($user_food['user']){ //////// Узнаем есть ли у него уже купленая дресировка
update_food_update('id_g',$fer['id'],'img',$fer['img'],'name',$fer['name'],'user',$user['id'],'time',$time,'money',$fer['money'],'exp',$fer['exp']);
}else{
update_food('id_g',$fer['id'],'img',$fer['img'],'name',$fer['name'],'user',$user['id'],'time',$time,'money',$fer['money'],'exp',$fer['exp']);
}
header("Location: ?LinkUserShop&food=2&Ok");
exit;
}else{
err_ruby($need-$user['ruby']);
}
}
}else{
header("Location: ?LinkUserShop&shop");
exit;
}
?>