📄 itemshop.php
字号:
$icon = $get_stuff[$iconid];
}
$item = $get_stuff[$itemid];
$checkitid = $get_stuff[$itid];
if ( $inbattle != 0 )
{
$sell = "";
}
else if ( $checkitid == 0 || ( $checkitid = "" ) )
{
$sell = "";
}
else
{
$sell = " - <a href={$ibforums->base_url}&act=itemshop&CODE=14&itemid=".$get_stuff[$itid]."&catid=".$catstuff['catorder'].">{$ibforums->lang['sell']}</a>";
}
$desc = $get_stuff[$descriptionid];
$cost = $get_stuff[$pointsid];
$refund = $get_stuff[$pointsid] * $get_refund['refund'];
$refund = ( integer )$refund;
$catstuff['CELL_COLOUR'] = $cnt % 2 ? "row1" : "row2";
++$cnt;
$this->output .= $this->html->items_personel_row( $catstuff, $icon, $item, $sell, $desc, $cost, $refund );
}
$DB->query( "SELECT * FROM ibf_items_user WHERE userid='".$this->member['id']."'" );
while ( $row_2 = $DB->fetch_row( ) )
{
$bankval = $row_2['bankval'];
}
$DB->query( "SELECT bankval FROM ibf_items_user WHERE bankval>0" );
$cached = array( );
while ( $result = $DB->fetch_row( ) )
{
$totalbankval = $totalbankval + $result['bankval'];
++$totalclients;
}
$this->output .= $this->html->items_personel_end( $bankval, $totalbankval, $totalclients );
$this->output .= $this->html->item_shop_start( );
$DB->query( "SELECT * FROM ibf_items_cats WHERE type=0 ORDER BY name" );
while ( $shop = $DB->fetch_row( ) )
{
$shopname = $shop['name'];
$shopdesc = $shop['description'];
$shoporder = $shop['catorder'];
$shopprofit = $shop['profit'];
$shopsold = $shop['sold'];
$shop['CELL_COLOUR'] = $cnt % 2 ? "row1" : "row2";
++$cnt;
$this->output .= $this->html->item_shop_row( $shop, $shopname, $shopdesc, $shoporder, $shopprofit, $shopsold );
}
$DB->query( "SELECT * FROM ibf_items_cats WHERE type=0 ORDER BY name" );
while ( $totalshop = $DB->fetch_row( ) )
{
$totalshopprofit += $totalshop['profit'];
$totalshopsold += $totalshop['sold'];
}
$this->output .= $this->html->item_shop_end( $totalshopprofit, $totalshopsold );
$DB->query( "SELECT * FROM ibf_items_cats WHERE type=1 ORDER BY name" );
$checktable = $DB->fetch_row( );
if ( $checktable['type'] != 0 )
{
$this->output .= $this->html->item_shop_pers_start( );
}
$perscat = $DB->query( "SELECT * FROM ibf_items_cats WHERE type=1 ORDER BY name" );
while ( $pers = $DB->fetch_row( $perscat ) )
{
if ( $checktable['type'] != 0 )
{
$persname = $pers['name'];
$persdesc = $pers['description'];
$persorder = $pers['catorder'];
$persowner = $pers['ownerid'];
$persprofit = $pers['profit'];
$perssold = $pers['sold'];
$get_personwer = $DB->query( "SELECT name FROM ibf_members WHERE id='{$persowner}'" );
$get_personwername = $DB->fetch_row( );
$shopowner = $get_personwername['name'];
$pers['CELL_COLOUR'] = $cnt % 2 ? "row1" : "row2";
++$cnt;
$this->output .= $this->html->item_shop_pers_row( $pers, $persname, $persdesc, $persorder, $shopowner, $persowner, $persprofit, $perssold );
}
}
$DB->query( "SELECT * FROM ibf_items_cats WHERE type=1 ORDER BY name" );
while ( $totalpers = $DB->fetch_row( ) )
{
$totalpresprofit += $totalpers['profit'];
$totalpressold += $totalpers['sold'];
}
if ( $checktable['type'] != 0 )
{
$this->output .= $this->html->item_shop_pers_end( $totalpresprofit, $totalpressold );
}
if ( $ibforums->input['cat'] == 1 )
{
$DB->query( "SELECT * FROM ibf_items_cats WHERE id='1'" );
$get_name = $DB->fetch_row( );
$this->output .= $this->html->items_start( $get_name );
$DB->query( "SELECT * FROM ibf_items WHERE cat=1 ORDER BY name ASC" );
while ( $row_3 = $DB->fetch_row( ) )
{
if ( $row_3['stock'] == 0 )
{
$purchase = "<font color=red>[{$ibforums->lang['soldout']}]</font>";
}
else if ( $inbattle != 0 )
{
$purchase = "<font color=red>[{$ibforums->lang['inbattle']}]</font>";
}
else if ( $money < $row_3['cost'] )
{
$purchase = "<font color=red>[{$ibforums->lang['notenough']}]</font>";
}
else if ( $type < $row_3['type'] )
{
$purchase = "<font color=red>[{$ibforums->lang['typereq']}]</font>";
}
else if ( $level < $row_3['levelreq'] )
{
$purchase = "<font color=red>[{$ibforums->lang['lowlevel']}]</font>";
}
else
{
$purchase = "<a href={$ibforums->base_url}&act=itemshop&CODE=10&cat=".$row_3['cat']."&itemid=".$row_3['itemid'].">{$ibforums->lang['purchase']}</a>";
}
$row_3['CELL_COLOUR'] = $cnt % 2 ? "row1" : "row2";
++$cnt;
$this->output .= $this->html->items_row( $row_3, $purchase );
}
$DB->query( "SELECT sold,profit FROM ibf_items WHERE cat=1" );
while ( $info = $DB->fetch_row( ) )
{
$profit += $info['profit'];
$sold += $info['sold'];
}
$this->output .= $this->html->items_end( $profit, $sold );
}
if ( $ibforums->input['cat'] == 2 )
{
$DB->query( "SELECT * FROM ibf_items_cats WHERE id='2'" );
$get_name = $DB->fetch_row( );
$this->output .= $this->html->items_start( $get_name );
$DB->query( "SELECT * FROM ibf_items WHERE cat=2 ORDER BY name ASC" );
while ( $row_3 = $DB->fetch_row( ) )
{
if ( $row_3['stock'] == 0 )
{
$purchase = "<font color=red>[{$ibforums->lang['soldout']}]</font>";
}
else if ( $inbattle != 0 )
{
$purchase = "<font color=red>[{$ibforums->lang['inbattle']}]</font>";
}
else if ( $money < $row_3['cost'] )
{
$purchase = "<font color=red>[{$ibforums->lang['notenough']}]</font>";
}
else if ( $type < $row_3['type'] )
{
$purchase = "<font color=red>[{$ibforums->lang['typereq']}]</font>";
}
else if ( $level < $row_3['levelreq'] )
{
$purchase = "<font color=red>[{$ibforums->lang['lowlevel']}]</font>";
}
else
{
$purchase = "<a href={$ibforums->base_url}&act=itemshop&CODE=10&cat=".$row_3['cat']."&itemid=".$row_3['itemid'].">{$ibforums->lang['purchase']}</a>";
}
$row_3['CELL_COLOUR'] = $cnt % 2 ? "row1" : "row2";
++$cnt;
$this->output .= $this->html->items_row( $row_3, $purchase );
}
$DB->query( "SELECT sold,profit FROM ibf_items WHERE cat=2" );
while ( $info = $DB->fetch_row( ) )
{
$profit += $info['profit'];
$sold += $info['sold'];
}
$this->output .= $this->html->items_end( $profit, $sold );
}
if ( $ibforums->input['cat'] == 3 )
{
$DB->query( "SELECT * FROM ibf_items_cats WHERE id='3'" );
$get_name = $DB->fetch_row( );
$this->output .= $this->html->items_start( $get_name );
$DB->query( "SELECT * FROM ibf_items WHERE cat=3 ORDER BY name ASC" );
while ( $row_3 = $DB->fetch_row( ) )
{
if ( $row_3['stock'] == 0 )
{
$purchase = "<font color=red>[{$ibforums->lang['soldout']}]</font>";
}
else if ( $inbattle != 0 )
{
$purchase = "<font color=red>[{$ibforums->lang['inbattle']}]</font>";
}
else if ( $money < $row_3['cost'] )
{
$purchase = "<font color=red>[{$ibforums->lang['notenough']}]</font>";
}
else if ( $type < $row_3['type'] )
{
$purchase = "<font color=red>[{$ibforums->lang['typereq']}]</font>";
}
else if ( $level < $row_3['levelreq'] )
{
$purchase = "<font color=red>[{$ibforums->lang['lowlevel']}]</font>";
}
else
{
$purchase = "<a href={$ibforums->base_url}&act=itemshop&CODE=10&cat=".$row_3['cat']."&itemid=".$row_3['itemid'].">{$ibforums->lang['purchase']}</a>";
}
$row_3['CELL_COLOUR'] = $cnt % 2 ? "row1" : "row2";
++$cnt;
$this->output .= $this->html->items_row( $row_3, $purchase );
}
$DB->query( "SELECT sold,profit FROM ibf_items WHERE cat=3" );
while ( $info = $DB->fetch_row( ) )
{
$profit += $info['profit'];
$sold += $info['sold'];
}
$this->output .= $this->html->items_end( $profit, $sold );
}
if ( 3 < $ibforums->input['cat'] )
{
$DB->query( "SELECT * FROM ibf_items_cats WHERE catorder='".$ibforums->input['cat']."'" );
$get_name = $DB->fetch_row( );
$this->output .= $this->html->items_start( $get_name );
$DB->query( "SELECT * FROM ibf_items WHERE cat='".$ibforums->input['cat']."' ORDER BY name ASC" );
while ( $row_3 = $DB->fetch_row( ) )
{
if ( $row_3['stock'] == 0 )
{
$purchase = "<font color=red>[{$ibforums->lang['soldout']}]</font>";
}
else if ( $inbattle != 0 )
{
$purchase = "<font color=red>[{$ibforums->lang['inbattle']}]</font>";
}
else if ( $money < $row_3['cost'] )
{
$purchase = "<font color=red>[{$ibforums->lang['notenough']}]</font>";
}
else if ( $type < $row_3['type'] )
{
$purchase = "<font color=red>[{$ibforums->lang['typereq']}]</font>";
}
else if ( $level < $row_3['levelreq'] )
{
$purchase = "<font color=red>[{$ibforums->lang['lowlevel']}]</font>";
}
else
{
$purchase = "<a href={$ibforums->base_url}&act=itemshop&CODE=10&cat=".$row_3['cat']."&itemid=".$row_3['itemid'].">{$ibforums->lang['purchase']}</a>";
}
$row_3['CELL_COLOUR'] = $cnt % 2 ? "row1" : "row2";
++$cnt;
$this->output .= $this->html->items_row( $row_3, $purchase );
}
$DB->query( "SELECT sold,profit FROM ibf_items_cats WHERE catorder='".$ibforums->input['cat']."'" );
while ( $info = $DB->fetch_row( ) )
{
$profit += $info['profit'];
$sold += $info['sold'];
}
$this->output .= $this->html->items_end( $profit, $sold );
}
$this->page_title = $ibforums->lang['page_itemshop'];
$this->nav = array(
$ibforums->lang['page_itemshop']
);
}
function do_buy( )
{
global $ibforums;
global $DB;
global $std;
global $print;
$DB->query( "SELECT * FROM ibf_items WHERE itemid='".$ibforums->input['itemid']."'" );
$get_item = $DB->fetch_row( );
if ( $get_item['stock'] == 0 )
{
$this->output = $this->html->error_start( );
$this->output .= $this->html->error_stock( );
$this->output .= $this->html->error_end( );
}
else
{
$DB->query( "SELECT userid FROM ibf_items_user WHERE userid='".$this->member['id']."'" );
$get_user = $DB->fetch_row( );
if ( $get_user['userid'] == $this->member['id'] )
{
$db_string = $DB->compile_db_update_string( array(
"item".$ibforums->input['cat']."" => $get_item['name'],
"points".$ibforums->input['cat']."" => $get_item['cost'],
"description".$ibforums->input['cat']."" => $get_item['descr'],
"icon".$ibforums->input['cat']."" => $get_item['icon'],
"itid".$ibforums->input['cat']."" => $ibforums->input['itemid']
) );
$DB->query( "UPDATE ibf_items_user SET {$db_string} WHERE userid='".$this->member['id']."'" );
}
else
{
$db_string = $DB->compile_db_insert_string( array(
"userid" => $this->member['id'],
"bankval" => 0,
"btime" => 0,
"item".$ibforums->input['cat']."" => $get_item['name'],
"points".$ibforums->input['cat']."" => $get_item['cost'],
"description".$ibforums->input['cat']."" => $get_item['descr'],
"icon".$ibforums->input['cat']."" => $get_item['icon'],
"itid".$ibforums->input['cat']."" => $ibforums->input['itemid']
) );
$DB->query( "INSERT INTO ibf_items_user (".$db_string['FIELD_NAMES'].") VALUES (".$db_string['FIELD_VALUES'].")" );
}
$DB->query( "SELECT money FROM ibf_members WHERE id='".$this->member['id']."'" );
$get_money = $DB->fetch_row( );
$updatemoney = $get_money['money'] - $get_item['cost'];
$DB->query( "UPDATE ibf_members SET money='{$updatemoney}' WHERE id='".$this->member['id']."'" );
$updatestock = $get_item['stock'] - 1;
$updatesold = $get_item['sold'] + 1;
$updateprofit = $get_item['profit'] + $get_item['cost'];
$db_string_2 = $DB->compile_db_update_string( array(
"stock" => $updatestock,
"sold" => $updatesold,
"profit" => $updateprofit
) );
$DB->query( "UPDATE ibf_items SET {$db_string_2} WHERE itemid='".$ibforums->input['itemid']."'" );
$DB->query( "SELECT sold,profit FROM ibf_items_cats WHERE catorder='".$ibforums->input['cat']."'" );
$get_shop = $DB->fetch_row( );
$updatetotalsold = $get_shop['sold'] + 1;
$updatetotalprofit = $get_shop['profit'] + $get_item['cost'];
$db_string_3 = $DB->compile_db_update_string( array(
"sold" => $updatetotalsold,
"profit" => $updatetotalprofit
) );
$DB->query( "UPDATE ibf_items_cats SET {$db_string_3} WHERE catorder='".$ibforums->input['cat']."'" );
$print->redirect_screen( $ibforums->lang['thank_buy'], "act=itemshop" );
}
$this->page_title = $ibforums->lang['page_itemshop'];
$this->nav = array(
$ibforums->lang['page_itemshop']
);
}
function do_sell( )
{
global $ibforums;
global $DB;
global $std;
global $print;
$DB->query( "SELECT * FROM ibf_items_options" );
$get_refund = $DB->fetch_row( );
$DB->query( "SELECT * FROM ibf_items_user WHERE userid='".$this->member['id']."'" );
$sell_item = $DB->fetch_row( );
$refund = $sell_item["points".$ibforums->input['catid'].""] * $get_refund['refund'];
$refund = ( integer )$refund;
$DB->query( "SELECT money FROM ibf_members WHERE id='".$this->member['id']."'" );
$get_money = $DB->fetch_row( );
$updatemoney = $get_money['money'] + $refund;
$DB->query( "UPDATE ibf_members SET money='{$updatemoney}' WHERE id='".$this->member['id']."'" );
$DB->query( "SELECT stock FROM ibf_items WHERE itemid='".$sell_item["itid".$ibforums->input['catid'].""]."'" );
$get_stock = $DB->fetch_row( );
$updatestock = $get_stock['stock'] + 1;
$DB->query( "UPDATE ibf_items SET stock='{$updatestock}' WHERE itemid='".$sell_item["itid".$ibforums->input['catid'].""]."'" );
$db_string = $DB->compile_db_update_string( array(
"item".$ibforums->input['catid']."" => $ibforums->lang['item_noitem'],
0,
"description".$ibforums->input['catid']."" => $ibforums->lang['item_nodescription'],
"",
0
) );
$DB->query( "UPDATE ibf_items_user SET {$db_string} WHERE userid='".$this->member['id']."'" );
$print->redirect_screen( $ibforums->lang['thank_sell'], "act=itemshop" );
}
}
itemshop( );
$idx = new itemshop( );
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -