Вход Регистрация
Файл: complekt.php
Строк: 185
<?php
session_start
();
include (
'private/mysql.php');
include (
'tmp/head.php');




switch(
$sd){
default:
    echo 
"Комплекты(Магазин) | <a href='/auction'>Аукцион</a><hr>";
    
    
$q mysql_query("SELECT * FROM `complekt`");
    
    echo 
"<ul class='list_page'><div class='linem'></div>";
    
    While(
$w mysql_fetch_assoc($q)){
        
        echo 
"<li><a style='color:$w[sort]' href='?sd=view&id=$w[id]'>$w[name] <span style='float:right'>$w[level] ур.</span></a></li>";    
        
    }


    echo 
"</ul><div class='linem2'></div>";


break;

case 
'view':
$k mysql_query("SELECT * FROM `complekt` WHERE `id`='$id' ORDER BY `level` DESC");
$ke mysql_num_rows($k);
if(
$ke=='0'){
    
header('Location: complekt.php');
    exit;
}
$n mysql_fetch_assoc($k);

echo 
"<center><font color=$n[sort]>$n[name] $n[level] ур.</font></center><hr>";

$q mysql_query("SELECT * FROM `shop` WHERE `complekt`='$id' and `tip`='weapon'");

While(
$w mysql_fetch_assoc($q)){

        echo 
"<span style='float:left'><img src='/img/shmot/$w[img]' width='50'></span><small>&nbsp;$w[name] $w[level] ур.<br>&nbsp;Урон: $w[min_u] - $w[max_u] ";
        
$s mysql_query("SELECT * FROM `item` WHERE `user`='$uid' and `tip`='weapon' and `status`='odet'");
        
$se mysql_num_rows($s);
        if(
$se>='1'){
            
$sw mysql_fetch_assoc($s);
            
$au $w['min_u']+$w['max_u'];
            
$au1 $sw['min_u']+$sw['max_u'];
            if(
$au<$au1){
                
$ck $au1-$au;
                echo 
"(<font color=red>-$ck</font>)";
            }
            if(
$au1<$au){
                
$ck $au-$au1;
                echo 
"(<font color=lightgreen>+$ck</font>)";
            }
        }
        echo 
"<br>&nbsp;[<a href='complekt.php?sd=buy&c=$id&id=$w[id]'>Купить <small><img src='img/silver.png'> $w[silver]</small></a>]</small><hr>";
    
}

$q mysql_query("SELECT * FROM `shop` WHERE `complekt`='$id' and `tip`='shield'");

While(
$w mysql_fetch_assoc($q)){

        echo 
"<span style='float:left'><img src='/img/shmot/$w[img]' width='50'></span><small>&nbsp;$w[name] $w[level] ур.<br>&nbsp;Живучесть: $w[hp] ";
        
$s mysql_query("SELECT * FROM `item` WHERE `user`='$uid' and `tip`='shield' and `status`='odet'");
        
$se mysql_num_rows($s);
        if(
$se>='1'){
            
$sw mysql_fetch_assoc($s);
            if(
$w['hp']<$sw['hp']){
                
$ck $sw['hp']-$w['hp'];
                echo 
"(<font color=red>-$ck</font>)";
            }
            if(
$sw['hp']<$w['hp']){
                
$ck $w['hp']-$sw['hp'];
                echo 
"(<font color=lightgreen>+$ck</font>)";
            }
        }
        echo 
"<br>&nbsp;[<a href='complekt.php?sd=buy&c=$id&id=$w[id]'>Купить <small><img src='img/silver.png'> $w[silver]</small></a>]</small><hr>";
    
}

$q mysql_query("SELECT * FROM `shop` WHERE `complekt`='$id' and `tip`='helmet'");

While(
$w mysql_fetch_assoc($q)){

        echo 
"<span style='float:left'><img src='/img/shmot/$w[img]' width='50'></span><small>&nbsp;$w[name] $w[level] ур.<br>&nbsp;Живучесть: $w[hp] ";
        
$s mysql_query("SELECT * FROM `item` WHERE `user`='$uid' and `tip`='helmet' and `status`='odet'");
        
$se mysql_num_rows($s);
        if(
$se>='1'){
            
$sw mysql_fetch_assoc($s);
            if(
$w['hp']<$sw['hp']){
                
$ck $sw['hp']-$w['hp'];
                echo 
"(<font color=red>-$ck</font>)";
            }
            if(
$sw['hp']<$w['hp']){
                
$ck $w['hp']-$sw['hp'];
                echo 
"(<font color=lightgreen>+$ck</font>)";
            }
        }
        echo 
"<br>&nbsp;[<a href='complekt.php?sd=buy&c=$id&id=$w[id]'>Купить <small><img src='img/silver.png'> $w[silver]</small></a>]</small><hr>";
    
}

$q mysql_query("SELECT * FROM `shop` WHERE `complekt`='$id' and `tip`='amulet'");

While(
$w mysql_fetch_assoc($q)){

        echo 
"<span style='float:left'><img src='/img/shmot/$w[img]' width='50'></span><small>&nbsp;$w[name] $w[level] ур.<br>&nbsp;Живучесть: $w[hp] ";
        
$s mysql_query("SELECT * FROM `item` WHERE `user`='$uid' and `tip`='amulet' and `status`='odet'");
        
$se mysql_num_rows($s);
        if(
$se>='1'){
            
$sw mysql_fetch_assoc($s);
            if(
$w['hp']<$sw['hp']){
                
$ck $sw['hp']-$w['hp'];
                echo 
"(<font color=red>-$ck</font>)";
            }
            if(
$sw['hp']<$w['hp']){
                
$ck $w['hp']-$sw['hp'];
                echo 
"(<font color=lightgreen>+$ck</font>)";
            }
        }
        echo 
"<br>&nbsp;[<a href='complekt.php?sd=buy&c=$id&id=$w[id]'>Купить <small><img src='img/silver.png'> $w[silver]</small></a>]</small><hr>";
    
}

$q mysql_query("SELECT * FROM `shop` WHERE `complekt`='$id' and `tip`='ple4i'");

While(
$w mysql_fetch_assoc($q)){

        echo 
"<span style='float:left'><img src='/img/shmot/$w[img]' width='50'></span><small>&nbsp;$w[name] $w[level] ур.<br>&nbsp;Живучесть: $w[hp] ";
        
$s mysql_query("SELECT * FROM `item` WHERE `user`='$uid' and `tip`='ple4i' and `status`='odet'");
        
$se mysql_num_rows($s);
        if(
$se>='1'){
            
$sw mysql_fetch_assoc($s);
            if(
$w['hp']<$sw['hp']){
                
$ck $sw['hp']-$w['hp'];
                echo 
"(<font color=red>-$ck</font>)";
            }
            if(
$sw['hp']<$w['hp']){
                
$ck $w['hp']-$sw['hp'];
                echo 
"(<font color=lightgreen>+$ck</font>)";
            }
        }
        echo 
"<br>&nbsp;[<a href='complekt.php?sd=buy&c=$id&id=$w[id]'>Купить <small><img src='img/silver.png'> $w[silver]</small></a>]</small><hr>";
    
}

$q mysql_query("SELECT * FROM `shop` WHERE `complekt`='$id' and `tip`='armor'");

While(
$w mysql_fetch_assoc($q)){

        echo 
"<span style='float:left'><img src='/img/shmot/$w[img]' width='50'></span><small>&nbsp;$w[name] $w[level] ур.<br>&nbsp;Живучесть: $w[hp] ";
        
$s mysql_query("SELECT * FROM `item` WHERE `user`='$uid' and `tip`='armor' and `status`='odet'");
        
$se mysql_num_rows($s);
        if(
$se>='1'){
            
$sw mysql_fetch_assoc($s);
            if(
$w['hp']<$sw['hp']){
                
$ck $sw['hp']-$w['hp'];
                echo 
"(<font color=red>-$ck</font>)";
            }
            if(
$sw['hp']<$w['hp']){
                
$ck $w['hp']-$sw['hp'];
                echo 
"(<font color=lightgreen>+$ck</font>)";
            }
        }
        echo 
"<br>&nbsp;[<a href='complekt.php?sd=buy&c=$id&id=$w[id]'>Купить <small><img src='img/silver.png'> $w[silver]</small></a>]</small><hr>";
    
}

$q mysql_query("SELECT * FROM `shop` WHERE `complekt`='$id' and `tip`='gloves'");

While(
$w mysql_fetch_assoc($q)){

        echo 
"<span style='float:left'><img src='/img/shmot/$w[img]' width='50'></span><small>&nbsp;$w[name] $w[level] ур.<br>&nbsp;Живучесть: $w[hp] ";
        
$s mysql_query("SELECT * FROM `item` WHERE `user`='$uid' and `tip`='gloves' and `status`='odet'");
        
$se mysql_num_rows($s);
        if(
$se>='1'){
            
$sw mysql_fetch_assoc($s);
            if(
$w['hp']<$sw['hp']){
                
$ck $sw['hp']-$w['hp'];
                echo 
"(<font color=red>-$ck</font>)";
            }
            if(
$sw['hp']<$w['hp']){
                
$ck $w['hp']-$sw['hp'];
                echo 
"(<font color=lightgreen>+$ck</font>)";
            }
        }
        echo 
"<br>&nbsp;[<a href='complekt.php?sd=buy&c=$id&id=$w[id]'>Купить <small><img src='img/silver.png'> $w[silver]</small></a>]</small><hr>";
    
}

$q mysql_query("SELECT * FROM `shop` WHERE `complekt`='$id' and `tip`='pants'");

While(
$w mysql_fetch_assoc($q)){

        echo 
"<span style='float:left'><img src='/img/shmot/$w[img]' width='50'></span><small>&nbsp;$w[name] $w[level] ур.<br>&nbsp;Живучесть: $w[hp] ";
        
$s mysql_query("SELECT * FROM `item` WHERE `user`='$uid' and `tip`='pants' and `status`='odet'");
        
$se mysql_num_rows($s);
        if(
$se>='1'){
            
$sw mysql_fetch_assoc($s);
            if(
$w['hp']<$sw['hp']){
                
$ck $sw['hp']-$w['hp'];
                echo 
"(<font color=red>-$ck</font>)";
            }
            if(
$sw['hp']<$w['hp']){
                
$ck $w['hp']-$sw['hp'];
                echo 
"(<font color=lightgreen>+$ck</font>)";
            }
        }
        echo 
"<br>&nbsp;[<a href='complekt.php?sd=buy&c=$id&id=$w[id]'>Купить <small><img src='img/silver.png'> $w[silver]</small></a>]</small><hr>";
    
}

$q mysql_query("SELECT * FROM `shop` WHERE `complekt`='$id' and `tip`='boots'");

While(
$w mysql_fetch_assoc($q)){

        echo 
"<span style='float:left'><img src='/img/shmot/$w[img]' width='50'></span><small>&nbsp;$w[name] $w[level] ур.<br>&nbsp;Живучесть: $w[hp] ";
        
$s mysql_query("SELECT * FROM `item` WHERE `user`='$uid' and `tip`='boots' and `status`='odet'");
        
$se mysql_num_rows($s);
        if(
$se>='1'){
            
$sw mysql_fetch_assoc($s);
            if(
$w['hp']<$sw['hp']){
                
$ck $sw['hp']-$w['hp'];
                echo 
"(<font color=red>-$ck</font>)";
            }
            if(
$sw['hp']<$w['hp']){
                
$ck $w['hp']-$sw['hp'];
                echo 
"(<font color=lightgreen>+$ck</font>)";
            }
        }
        echo 
"<br>&nbsp;[<a href='complekt.php?sd=buy&c=$id&id=$w[id]'>Купить <small><img src='img/silver.png'> $w[silver]</small></a>]</small><hr>";
    
}

echo 
"← <a href='complekt.php'>назад</a>";

break;

case 
'buy':

$q mysql_query("SELECT * FROM `shop` WHERE `id`='$id'");
$e mysql_num_rows($q);
$w mysql_fetch_assoc($q);
if(
$e == '0'){
    
header('Location: complekt.php?');
    exit;
}

if(
$user['level'] < $w['level']){
    
header('Location: complekt.php');
    exit;
}


if(
$user['silver'] < $w['silver']){
    echo 
"У вас недостаточно денег для покупки.<br><a href='complekt.php'>Назад</a>";
    include (
'tmp/foot.php');
    exit;
}




mysql_query("INSERT INTO `item` SET 
`user`='
$uid',
`name`='
$w[name]',
`tip`='
$w[tip]',
`complekt`='
$w[complekt]',
`sort`='
$w[sort]',
`level`='
$w[level]',
`almaz`='
$w[almaz]',
`silver`='
$w[silver]',
`img`='
$w[img]',
`hp`='
$w[hp]',
`mp`='
$w[mp]',
`min_u`='
$w[min_u]',
`max_u`='
$w[max_u]',
`status`='not'"
);

mysql_query("UPDATE `users` SET `silver`=`silver`-'$w[silver]' WHERE `id`='$uid'");

$c = (int)mysql_real_escape_string(htmlspecialchars(strip_tags($_GET['c'])));

echo 
"Вы купили <b>$w[name]</b><br><a href='complekt.php?sd=view&id=$c'>Вернуться</a>";


break;


}
include (
'tmp/foot.php');
?>
Онлайн: 0
Реклама