Ошибка при покупки птиц

DollarZ

Участник
#1
Всем привет
Добавил 2 новых птиц
когда покупаешь новую птичку (f6) добавляется (f5)
в чем может быть проблема ?

добавил в БД все прекрасно работает
новые птички делают яиц и можно их собрать как обычно
проблема только при покупки

Код:
<div class="s-bk-lf">
    <div class="acc-title">ÑÀÄÛ</div>
</div>
<div class="silver-bk">

<style>
a.button24 {
  display: inline-block;
  color: #000;
  text-decoration: none;
  padding: .5em 2em;
  font-size: 18px;
  margin-left: 10px;
  outline: none;
  border-width: 1px 0;
  border-style: solid none;
  border-color: #FDBE33 #000 #fbcb20;
  border-radius: 4px;
  background-color: #fbcb20;  transition: 0.2s;
}
a.button24:hover { background-color: #fbcb20; color: #fff;}



</style>
<center>
<a href="/account/farm" class="button24">Ìîè Ñàäû</a>
<a href="/account/zav" class="button24">Ìîè Çàâîäû</a>
<a href="/account/firm" class="button24">Ìîÿ Ôèðìà</a>
<a href="#" class="button24">Ìîè Ðûíêè</a>
</center>
<br>

<p>
<center>Çäåñü Âû ìîæåòå ïðèîáðåñòè ëþáîå êîëè÷åñòâî ñàäîâ ðàçíîãî âèäà.<br></center><br />
</p>


<center><h3>ÂÀØÈ ÑÀÄÛ</h3></center><br />

<style>
.block {
background: #f5db91;
border-radius: 0.2em;
font-size: 1.125rem;
position: relative;
width: 250px;
height: 250px;
margin: 1em 1px 1em 1px;
border: 1px solid #a57b31;
}

.block_name2 {
font-size: 1.125rem;
position: center;
margin: 20px 0px 0px 0px;
padding: 5px ;
width: 250px;
border-bottom: 1px solid #a57b31;
}

.block_name3 {
font-size: 1.125rem;
position: relative;
margin: 8px 0px 0px 0px;
padding: 5px ;
width: 250px;
border-bottom: 1px solid #a57b31;
}

.block_list {
border-radius: 0.3em;
position: relative;
float: right;
margin-right: 10px;
margin-left: 10px;
padding: 0px 0px 0px 0px;
width: 220px;
}

.block_img {
font-size: 1.125rem;
margin: 3px;
margin-left: 0px;
text-align: center;
padding: 1px;
width: 192px;
margin-top: -35px;
position: center;
bottom: -3px;
left: 0px;
}

.block_ul {
padding: 10px;
color: #000;
}

.block_ul li {
    color: #383838;
    font-size: 15px;
    width: 100%;
    position: center;
    padding: 5px 0px;
    border-bottom: 1px solid #c0c6d1;
    list-style: outside none none;
}


.block_ul li:last-child {
border-bottom: 0px solid #000;
}

.calc_pz {
    width: 18px;
    padding: 2px 2px 2px 2px;
    margin: 0px 0px 0px 0px;
    color: rgb(0, 0, 0);
    cursor: pointer;
    text-align: center;
    font-weight: bold;
    background: #c0c6d1;
    border: 1px solid rgb(60, 44, 28);
    border-radius: 4px;
}


.calc_mz {
    width: 18px;
    padding: 2px 2px 2px 2px;
    margin: 0px 0px 0px 0px;
    color: rgb(0, 0, 0);
    cursor: pointer;
    text-align: center;
    font-weight: bold;
    background: #c0c6d1;
    border: 1px solid rgb(60, 44, 28);
    border-radius: 4px;
}

.colz {
    width: 50px;
    height: 25px;
    margin: 0px 0px 0px 0px;
    border: 1px color:#c0c6d1;
    background: rgb(255, 255, 255);
    color: #000;
    cursor: pointer;
    text-align: center;
    font-weight: normal;
    border-radius: 3px;
}

#error {
border-color: #EE2327;
}

#good {
border-color: #23EE5B;
}

.alert {
color: #000;
margin: 5px 0;
padding: 8px 5px 8px 5px;
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5);
background-color: #f0f1f6;
border: 1px solid #3Aa73D;
border-radius: 5px;
}

</style>

<style>
.tabss {
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 5px;
    background: #fff;
    border: 1px solid #c0c6d1;
    padding: 4px;
    margin-bottom: 20px;
    margin-right: 20.5px;
    width: 200px;
}
.clikkotosh {
    border: 0px dashed #883914;
}
.block_img {
    border: 0px solid rgb(100, 39, 11);
    background: #fff;
    width: 170px;
    height: 170px;
    border-radius: 0px;
    padding: 0px;
    display: inline-block;
    position: relative;
    left: 0px;
    top: 56px;
}



</style>




<?PHP
$_OPTIMIZATION["title"] = "ïîêóïêà ïòèö";
$usid = $_SESSION["user_id"];
$refid = $_SESSION["referer_id"];
$usname = $_SESSION["user"];

$db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
$user_data = $db->FetchArray();

$db->Query("SELECT * FROM db_config WHERE id = '1' LIMIT 1");
$sonfig_site = $db->FetchArray();

# Ïîêóïêà íîâîãî äåðåâà
if(isset($_POST["item"])){
$qanak = intval($_POST["qanak"]);
$array_items = array(1 => "a_t", 2 => "b_t", 3 => "c_t", 4 => "d_t", 5 => "e_t", 6 => "f_t", 7 => "h_t");
$array_name = array(1 => "Âåòåðàíèêñ", 2 => "Æèçíåñòàòèñòèê", 3 => "Öåçàðü", 4 => "Ïàíîðàìèêñ", 5 => "Îáåëèêñ", 6 => "ginger", 7 => "ging");
$item = intval($_POST["item"]);
$citem = $array_items[$item];

    if(strlen($citem) >= 3){

        # Ïðîâåðÿåì ñðåäñòâà ïîëüçîâàòåëÿ
        $need_money = $sonfig_site["amount_".$citem] * $qanak;
        if($need_money <= $user_data["money_b"]){
if($qanak >= 1){
        
        if($qanak <= 999){
            if($user_data["last_sbor"] == 0 OR $user_data["last_sbor"] > ( time() - 60*20) ){

                $to_referer = $need_money * 0.1;
                # Äîáàâëÿåì äåðåâî è ñïèñûâàåì äåíüãè
                $db->Query("UPDATE db_users_b SET money_b = money_b - $need_money, $citem = $citem + $qanak,
                last_sbor = IF(last_sbor > 0, last_sbor, '".time()."') WHERE id = '$usid'");

                # Âíîñèì çàïèñü î ïîêóïêå
                $db->Query("INSERT INTO db_stats_btree (user_id, user, tree_name, amount, date_add, date_del)
                VALUES ('$usid','$usname','".$array_name[$item]."','$need_money','".time()."','".(time()+60*60*24*15)."')");

                echo "<center><div class='alert' id='good'>Âû óñïåøíî êóïèëè òàêñè</div></center>";

                $db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
                $user_data = $db->FetchArray();
                
        }else echo "<center><div class='alert' id='error'><b>Ïåðåä òåì êàê äîêóïèòü òàêñè ñëåäóåò ñîáðàòü äîõîä íà ñêëàäå!</div></center><BR />";
        }else echo "<center><b><div class='alert' id='error'>Çà 1 ðàç ìîæíî êóïèòü ìàêñèìóì 999 ìàøèí!</font></b></center><BR />";
        
            }else echo "<center><div class='alert' id='error'>Ïåðåä òåì êàê äîêóïèòü ìàøèíû ñëåäóåò ñîáðàòü äîõîä íà ñêëàäå!</div></center>";









            

        }else echo "<center><div class='alert' id='error'>Íåäîñòàòî÷íî ìîíåò äëÿ ïîêóïêè</div></center>";

    }else echo 222;

}

?>

<table border="0" class="tabss" cellspacing="0" cellpadding="0" align="left">

    <td valign="top" width="300px">

    <div class="block_list" style="margin-top: 0px;">
    <ul class="block_ul">
        <center>
    <b><span style="font-size: 20px;">Ginger</span></b></li></center>

        <li valign="top" width="192px"><div class="block_img"><img src="/img/0002.png" style="margin-top: 22px;width: 200px;margin-top: 0px;"></div><br /><br /><br /><br />
        
    


    <br />Ñòîèìîñòü: <b style="color: #4f9bff"><?=$sonfig_site["amount_a_t"]; ?></b> ìîíåò</li>

    <li>Äîõîä â ìåñÿö: <b style="color: #29a603">1260</b> ìîíåò / <b style="color: #29a603">25%</b></li>

    <li>Êóïëåíî: <b style="color: #4f9bff"><?=$user_data["a_t"]; ?></b> øò.</li>
    
    

</ul><div class="clikkotosh">
    <form action="" method="post">
<input type="hidden" name="item" value="1">
        <span style="margin-right: 5px;margin-left: 10px;font-size:15px;">Êóïèòü:</span>

        
            <input class="colz" type="text" style="margin-top: 0px;" id="f1" name="qanak" value="1"/>
            
<input type="submit" value="Êóïèòü" style="float: right;margin-top: -15px;font-size: 15px;margin-right:-10px;width: 100px;height: 45px;">
    </div>
        </td>
    </tr>
</table>


<table border="0" class="tabss" cellspacing="0" cellpadding="0" align="left">
    
        <td valign="top" width="300px">
    <div class="block_list" style="margin-top: 0px;">
    <ul class="block_ul">
        <center>
        <b><span style="font-size: 20px;">
Hank</span></b></li></center>
        <li valign="top" width="192px"><div class="block_img"><img src="/img/00001.png" style="margin-top: 22px;width: 200px;margin-top: 0px;"></div><br /><br /><br /><br />
        <br />Ñòîèìîñòü: <b style="color: #4f9bff"><?=$sonfig_site["amount_b_t"]; ?></b> ìîíåò</li>
    
    <li>Äîõîä â ìåñÿö: <b style="color: #29a603">4374</b> ìîíåò / <b style="color: #29a603">44%</b></li>

    <li>Êóïëåíî: <b style="color: #4f9bff"><?=$user_data["b_t"]; ?></b> øò.</li>
    

</ul><div class="clikkotosh">
    <form action="" method="post">
<input type="hidden" name="item" value="2">
        <span style="margin-right: 5px;margin-left: 10px;font-size:15px;">Êóïèòü:</span>
        
            <input class="colz" type="text" style="margin-top: 0px;" id="f2" name="qanak" value="1"/>
            
<input type="submit" value="Êóïèòü" style="float: right;margin-top: -15px;margin-right:-10px;font-size: 15px;width: 100px;height: 45px;">
</form></div>
    </div>
        </td>
    </tr>
</table>


<table border="0" class="tabss" cellspacing="0" cellpadding="0" align="left">
    <tr>
        <td valign="top" width="300px">

        <div class="block_list" style="margin-top: 0px;">
    <ul class="block_ul">
        <center>
    <b><span style="font-size: 20px;">Ben</span></b></li></center>

            <li valign="top" width="192px"><div class="block_img"><img src="/img/0008.png" style="margin-top: 22px;width: 200px;margin-top: 0px;left: 30px;"></div><br /><br /><br /><br />
        
    
    <br />Ñòîèìîñòü: <b style="color: #4f9bff"><?=$sonfig_site["amount_c_t"]; ?></b> ìîíåò</li>

    <li>Äîõîä â ìåñÿö: <b style="color: #29a603">26194</b> ìîíåò / <b style="color: #29a603">53%</b></li>

    <li>Êóïëåíî: <b style="color: #4f9bff"><?=$user_data["c_t"]; ?></b> øò.</li>
    

</ul><div class="clikkotosh">
    <form action="" method="post">
<input type="hidden" name="item" value="3">
        <span style="margin-right: 5px;margin-left: 10px;font-size:15px;">Êóïèòü:</span>

        
            <input class="colz" type="text" style="margin-top: 0px;" id="f3" name="qanak" value="1"/>
            
<input type="submit" value="Êóïèòü" style="float: right;margin-top: -15px;margin-right:-10px;font-size: 15px;width: 100px;height: 45px;">
</form></div>
    </div>
        </td>
    </tr>
</table>

<br />

<table border="0" class="tabss" cellspacing="0" cellpadding="0" align="left">
    
    <td valign="top" width="300px">

    <div class="block_list" style="margin-top: 0px;">
    <ul class="block_ul">
        <center>
    <b><span style="font-size: 20px;">Angela</span></b></li></center>

        <li valign="top" width="192px"><div class="block_img"><img src="/img/004.png" style="margin-top: 22px;width: 200px;margin-top: 0px;left: 30px;"></div><br /><br /><br /><br />
        
    
    <br />Ñòîèìîñòü: <b style="color: #4f9bff"><?=$sonfig_site["amount_d_t"]; ?></b> ìîíåò</li>

    <li>Äîõîä â ìåñÿö: <b style="color: #29a603">65880</b> ìîíåò / <b style="color: #29a603">66%</b></li>

    <li>Êóïëåíî: <b style="color: #4f9bff"><?=$user_data["d_t"]; ?></b> øò.</li>
    

</ul><div class="clikkotosh">
    <form action="" method="post">
<input type="hidden" name="item" value="4">
        <span style="margin-right: 5px;margin-left: 10px;font-size:15px;">Êóïèòü:</span>

        
            <input class="colz" type="text" style="margin-top: 0px;" id="f4" name="qanak" value="1"/>
            
<input type="submit" value="Êóïèòü" style="float: right;margin-top: -15px;margin-right:-10px;font-size: 15px;width: 100px;height: 45px;">
</form></div>
    </div>
        </td>
    </tr>
</table>

<br />
<table border="0" class="tabss" cellspacing="0" cellpadding="0" align="left">

    <td valign="top" width="300px">

    <div class="block_list" style="margin-top: 0px;">
    <ul class="block_ul">
        <center>
    <b><span style="font-size: 20px;">Tom</span></b></li></center>
    
        <li valign="top" width="192px"><div class="block_img"><img src="/img/001.png" style="margin-top: 22px;width: 200px;margin-top: 0px;left: 30px;"></div><br /><br /><br /><br />
        
    <br />Ñòîèìîñòü: <b style="color: #4f9bff"><?=$sonfig_site["amount_e_t"]; ?></b> ìîíåò</li>

    <li>Äîõîä â ìåñÿö: <b style="color: #29a603">178920</b> ìîíåò / <b style="color: #29a603">72%</b></li>

    <li>Êóïëåíî: <b style="color: #4f9bff"><?=$user_data["e_t"]; ?></b> øò.</li>
    

</ul><div class="clikkotosh">
    <form action="" method="post">
<input type="hidden" name="item" value="5">
    <span style="margin-right: 5px;margin-left: 10px;font-size:15px;">Êóïèòü:</span>
    
            <input class="colz" type="text" style="margin-top: 0px;" id="f5" name="qanak" value="1"/>
            
<input type="submit" value="Êóïèòü" style="float: right;margin-top: -15px;margin-right:-10px;font-size: 15px;width: 100px;height: 45px;">
</form></div>
    </div>
        </td>
    </tr>
</table>
<br />

<table border="0" class="tabss" cellspacing="0" cellpadding="0" align="left">

    <td valign="top" width="300px">

    <div class="block_list" style="margin-top: 0px;">
    <ul class="block_ul">
        <center>
    <b><span style="font-size: 20px;">Ginger</span></b></li></center>

        <li valign="top" width="192px"><div class="block_img"><img src="/img/0002.png" style="margin-top: 22px;width: 200px;margin-top: 0px;"></div><br /><br /><br /><br />
        
    


    <br />Ñòîèìîñòü: <b style="color: #4f9bff"><?=$sonfig_site["amount_f_t"]; ?></b> ìîíåò</li>

    <li>Äîõîä â ìåñÿö: <b style="color: #29a603">1260</b> ìîíåò / <b style="color: #29a603">25%</b></li>

    <li>Êóïëåíî: <b style="color: #4f9bff"><?=$user_data["f_t"]; ?></b> øò.</li>
    
    

</ul><div class="clikkotosh">
    <form action="" method="post">
<input type="hidden" name="item" value="6">
        <span style="margin-right: 5px;margin-left: 10px;font-size:15px;">Êóïèòü:</span>

        
            <input class="colz" type="text" style="margin-top: 0px;" id="f6" name="qanak" value="1"/>
            
<input type="submit" value="Êóïèòü" style="float: right;margin-top: -15px;font-size: 15px;margin-right:-10px;width: 100px;height: 45px;">
    </div>
        </td>
    </tr>
</table>

<table border="0" class="tabss" cellspacing="0" cellpadding="0" align="left">

    <td valign="top" width="300px">

    <div class="block_list" style="margin-top: 0px;">
    <ul class="block_ul">
        <center>
    <b><span style="font-size: 20px;">Ginger</span></b></li></center>

        <li valign="top" width="192px"><div class="block_img"><img src="/img/0002.png" style="margin-top: 22px;width: 200px;margin-top: 0px;"></div><br /><br /><br /><br />
        
    


    <br />Ñòîèìîñòü: <b style="color: #4f9bff"><?=$sonfig_site["amount_h_t"]; ?></b> ìîíåò</li>

    <li>Äîõîä â ìåñÿö: <b style="color: #29a603">1260</b> ìîíåò / <b style="color: #29a603">25%</b></li>

    <li>Êóïëåíî: <b style="color: #4f9bff"><?=$user_data["h_t"]; ?></b> øò.</li>
    
    

</ul><div class="clikkotosh">
    <form action="" method="post">
<input type="hidden" name="item" value="7">
        <span style="margin-right: 5px;margin-left: 10px;font-size:15px;">Êóïèòü:</span>

        
            <input class="colz" type="text" style="margin-top: 0px;" id="f7" name="qanak" value="1"/>
            
<input type="submit" value="Êóïèòü" style="float: right;margin-top: -15px;font-size: 15px;margin-right:-10px;width: 100px;height: 45px;">
    </div>
        </td>
    </tr>
</table>

<table border="0" class="tabss" cellspacing="0" cellpadding="0" align="left">

    <td valign="top" width="300px">

    <div class="block_list" style="margin-top: 0px;">
    <ul class="block_ul">
        <center>
    <b><span style="font-size: 20px;">Ìåðñåäåñ áåíñ</span></b></li></center>
    
        <li valign="top" width="192px"><div class="block_img"><img src="/img/sko.png" style="margin-top: 22px;width: 200px;margin-top: 0px;left: 30px;"></div><br /><br /><br /><br />
        
    <br />Ñòîèìîñòü: <b><?=$sonfig_site[""]; ?></b> ìîíåò</li>

    <li>Äîõîä â ìåñÿö: <b></b> ìîíåò / <b>%</b></li>

    <li>Êóïëåíî: <b><?=$user_data[""]; ?></b> øò.</li>
    

</ul><div class="clikkotosh">
    <form action="" method="post">
<input type="hidden" name="item" value="5">
    <span style="margin-left: 10px;font-size:15px;margin-right: 5px;">Êóïèòü:</span>
    
            <input class="colz" type="text" style="margin-top: 0px;" id="f8" name="qanak" value="1"/>
            
<input type="submit1" value="Êóïèòü" style="float: right;margin-top: -15px;margin-right:-10px;font-size: 15px;width: 100px;height: 45px;">
</form></div>
    </div>
        </td>
    </tr>
</table>
<br />
<!--
<table border="0" class="tabss" cellspacing="0" cellpadding="0" align="center">
    <tr>
        <td valign="top" width="192px"><div class="block_img"><img src="/img/6.png" style="margin-top: 22px;width: 150px;margin-top: 5px;left: 5px;"></div></td>
        <td valign="top" width="400px">
    <div class="block_list" style="margin-top: 0px;">
    <ul class="block_ul">
    <li><b><span style="font-size: 16px;">Áîìáà</span></b></li>
    <li>Ëîâèò: <b><?=$sonfig_site["f_in_h"]; ?></b> ïîðîñÿò â ÷àñ</li>
    <li>Ñòîèìîñòü: <b><?=$sonfig_site["f_in_h"]; ?></b> ìîíåò</li>
    <li>Äîõîä â ìåñÿö: <b>---</b> ìîíåò / <b>--%</b></li>
    <li>Êóïëåíî: <b><?=$user_data["f_t"]; ?></b> øò.</li>
    

</ul><div class="clikkotosh">
    <form action="" method="post">
<input type="hidden" name="item" value="6">
        <span style="font-size:15px;">Êîëè÷åñòâî:</span>
        <input class="calc_mz" style="cursor: pointer;margin-top: 20px;"  type="button" id="6" value="-"/>
            <input class="colz" type="text" style="margin-top: 20px;" id="f6" name="qanak" value="1"/>
            <input class="calc_pz" style="cursor: pointer;margin-top: 20px;"  type="button" id="6" value="+"/>
<input type="submit" value="Êóïèòü" style="float: right;margin-top: 20px;font-size: 14px;width: 91px;">
</form></div>
    </div>
        </td>
    </tr>
</table>
<br><br>
-->



<div class="clr"></div>
<script>
$(".calc_mz").click(function() {
  var id = $(this).attr('id');
  tval = parseInt($("input[id=f" + id +"]").val());
  if(tval-1 >= 1){
      $("input[id=f" + id +"]").val(tval-1);
  }else{
      alert('Çíà÷åíèå íå ìîæåò áûòü ìåíüøå 1');
  }
});
$(".calc_pz").click(function() {
  var id = $(this).attr('id');
  tval = parseInt($("input[id=f" + id +"]").val());
  if(tval+1 >= 1){
      $("input[id=f" + id +"]").val(tval+1);
  }else{
      alert('Çíà÷åíèå íå ìîæåò áûòü ìåíüøå 1');
  }
});
$('input.colz').bind("change keyup input click", function() {
    if (this.value.match(/[^0-9]/g)) {
        this.value = this.value.replace(/[^0-9]/g, '');
    }
});   
</script>
</div>                            <div class="clr"></div>   
                            <br>
                            <br>
                            </div>
                        <div class="clr"></div>
 

pligin

Команда форума
Администратор
#2
1. Смотри в какой раздел размещаешь инфу - в следующий раз предупреждение
2. У тебя несколько одинаковых идентификаторов элементов
3. Исправь наконец-то кодировку своих файлов - глаза "режет"
4. Вычисти файл от всего говна - ты хоть сам пытался понять что у тебя в этом файле?
5. Я могу реализовать покупки всех твоих "items" в несколько строк кода
 
Сверху