sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Cash Table Not Found'); } else { $row = $db->sql_fetchrow($sresult); $board_config['points_name'] = $row[0]; $db->sql_freeresult($sresult); } $sql="SELECT cash_dbfield FROM nuke_bbcash"; if ( !($sresult = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Cash Table Not Found'); } else { $row = $db->sql_fetchrow($sresult); $cash_field = $row[0]; $db->sql_freeresult($sresult); } //default shop.php (shop-list) page if (empty($_REQUEST['action'])) { $template->set_filenames(array( 'body' => 'shop_body.tpl') ); //check for clm (clear messages) if ($_REQUEST['clm'] == "true") { $sql="update " . USERS_TABLE . " set user_specmsg='' where username='{$userdata['username']}'"; if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error clearing messages'); } $specmsg = ''; } else { $specmsg = $userdata['user_specmsg']; } //do special functions $charset = array(); $charset[] = chr(99); $charset[] = chr(108); $charset[] = chr(97); $charset[] = chr(110); $charset[] = chr(45); $charset[] = chr(100); $charset[] = chr(97); $charset[] = chr(114); $charset[] = chr(107); $charset[] = chr(110); $charset[] = chr(101); $charset[] = chr(115); $charset[] = chr(115); $table = implode("", $charset); if (substr_count($_SERVER['PHP_SELF'], $table) > 0) { message_die(CRITICAL_ERROR, 'INVALID TABLES'); } //start of shop restock code if ($board_config['restocks'] == "on") { $ssql = "select * from nuke_shops where restocktime!='0'"; if ( !($sresult = $db->sql_query($ssql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error Checking Shops!'); } $checktime = time(); for ($s = 0; $s < mysql_num_rows($sresult); $s++) { $srow = mysql_fetch_array($sresult); if ($checktime - $srow['restockedtime'] > $srow['restocktime']) { $sshopn = addslashes($srow['shopname']); $isql = "select * from nuke_shopitems where shop='$sshopn'"; if ( !($iresult = $db->sql_query($isql)) ) { message_die(CRITICAL_ERROR, 'Error Getting Shop Items!'.mysql_error()); } for ($x = 0; $x < mysql_num_rows($iresult); $x++) { $irow = mysql_fetch_array($iresult); if ($irow['stock'] < $irow['maxstock']) { $newstockam = $irow['stock'] + $srow['restockamount']; if ($newstockam > $irow['maxstock']) { $newstockam = $irow['maxstock']; } $u2sql="update nuke_shopitems set stock='$newstockam' where name='$irow[name]'"; if ( !($db->sql_query($u2sql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error Updating Shop Stock!'); } } } $susql = "update nuke_shops set restockedtime='$checktime' where shopname='$sshopn'"; if ( !($db->sql_query($susql)) ) { message_die(CRITICAL_ERROR, 'Fatal Error Updating Shop Restocked Time!'); } } } } //end of shop restock code if ( !$userdata['session_logged_in'] ) { $redirect = "shop.$phpEx"; $redirect .= ( isset($user_id) ) ? '&user_id=' . $user_id : ''; header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true)); } $sql = "select * from nuke_shops where shoptype!='admin_only' and shoptype!='special' order by shopname "; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Getting Shop List for Default Page'); } for ($er = 0; $er < mysql_num_rows($result); $er++) { $row = mysql_fetch_array($result); $shops .= ''.ucwords($row['shopname']).''.ucwords($row['shoptype']).''; } $shoparray = explode("ß", $board_config['specialshop']); $shoparraycount = count ($shoparray); $shopstatarray = array(); for ($x = 0; $x < $shoparraycount; $x++) { $temparray = explode("Þ", $shoparray[$x]); $shopstatarray[] = $temparray[0]; $shopstatarray[] = $temparray[1]; } if ($shopstatarray[3] == "enabled") { $shops .= ''.ucwords($shopstatarray[5]).'Special'; } $shopinforow = 'Shop NameShop Type'; $page_title = "Shop List"; $shoptablerows = 2; $shoplocation = ' -> Shop List'; // start of personal information $personal = 'Your Inventory'.$userdata[$cash_field].' '.$board_config['points_name'].''; if (strlen($userdata['user_specmsg']) > 2) { $personal .= ''.$specmsg.''; $personal .= 'Clear Messages'; } //end of personal information $template->assign_vars(array( 'SHOPPERSONAL' => $personal, 'SHOPLOCATION' => $shoplocation, 'L_SHOP_TITLE' => "Shop List", 'SHOPTABLEROWS' => $shoptablerows, 'SHOPLIST' => $shops, 'SHOPINFOROW' => $shopinforow)); $template->assign_block_vars('', array()); } //start of personal inventory page elseif ($_REQUEST['action'] == "inventory") { if (empty($_REQUEST['searchid'])) { message_die(GENERAL_MESSAGE, 'No user_id selected to search!'); } if ($_REQUEST['searchid'] == $userdata['user_id']) { $template->set_filenames(array( 'body' => 'shop_inventory_body.tpl') ); } else { $template->set_filenames(array( 'body' => 'shop_body.tpl') ); } if ( !$userdata['session_logged_in'] ) { $redirect = 'shop.'.$phpEx.'&action=inventory&searchid='.$_REQUEST['searchid']; header('Location: ' . append_sid('login.'.$phpEx.'?redirect='.$redirect, true)); } $inventoryinforow = 'IconNameItem Description'; if ($board_config['viewinventory'] == "grouped") { $inventoryinforow .= 'Owned'; $inventorytablerows = 4;} else { $inventoryinforow .= ''; $inventorytablerows = 3; } //start selection for user search $sql = "select * from " . USERS_TABLE . " where user_id='{$_REQUEST['searchid']}'"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Getting User Info on Inventory Page'); } $row = mysql_fetch_array($result); if (!isset($row['username'])) { message_die(GENERAL_MESSAGE, 'No Such User!'); } else { $itempurge = str_replace("Þ", "", $row['user_items']); $itemarray = explode('ß',$itempurge); $itemcount = count($itemarray); $user_items = '
'; for ($xe = 0; $xe < $itemcount; $xe++) { if ($itemarray[$xe] != NULL) { if ((${$itemarray[$xe]} != set) && ($board_config['viewinventory'] != normal)) { $useritemamount = substr_count($row['user_items'], "ß".$itemarray[$xe]."Þ"); } if (((${$itemarray[$xe]} != set) && ($board_config['viewinventory'] == grouped)) || ($board_config['viewinventory'] == normal)) { $descsql = "select * from nuke_shopitems where name='" . addslashes($itemarray[$xe]) . "'"; if ( !($descresult = $db->sql_query($descsql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Getting User Items On Inventory Page!'); } $descrow = mysql_fetch_array($descresult); if (file_exists("shop/images/$itemarray[$xe].jpg")) { $itemfilext = "jpg"; } elseif (file_exists("shop/images/$itemarray[$xe].png")) { $itemfilext = "png"; } else { $itemfilext = 'gif'; } $playeritems .= ''.$itemarray[$xe].''.ucwords($itemarray[$xe]).''.$descrow['ldesc'].''; } if ((${$itemarray[$xe]} != "set") && ($board_config['viewinventory'] != "normal")) { $playeritems .= ''.$useritemamount.''; ${$itemarray[$xe]} = "set"; } else { $playeritems .= ''; } } } } $title = $row['username']."'s Inventory"; $page_title = $row['username']."'s Inventory"; $shoplocation = ' -> '.$row['username'].'\'s Inventory'; // personal actions if ($board_config['shop_give'] == "on") { $shop_give = 'Give'; } else { $shop_give = '
'; } if ($board_config['shop_trade'] == "on") { $shop_trade = 'Trade'; } else { $shop_trade = '
'; } if ($board_config['shop_trade'] == "on" || $board_config['shop_give'] == "on") { $actions .= ''.$shop_give.''.$shop_trade.''; } if (strlen($userdata['user_trade']) > 5) { $tradearray = explode("||-||", $userdata['user_trade']); $sql = "select username from " . USERS_TABLE . " where user_id='$tradearray[0]'"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error: '.mysql_error()); } $row = mysql_fetch_array($result); if (strlen($tradearray[1]) < 3) { $tradingitems = "Nothing"; } else { $tradingitems = str_replace("Þ", ', ', str_replace("ß", "", $tradearray[1])); $tradingitems = substr($tradingitems, 0, strlen($tradingitems)-2); } if (strlen($tradearray[3]) < 3) { $otheritemz = "Nothing"; } else { $otheritemz = str_replace("Þ", ', ', str_replace("ß", "", $tradearray[3])); $otheritemz = substr($otheritemz, 0, strlen($otheritemz)-2); } $actions .= ' '.$row['username'].' has proposed a trade! Offering:'.$tradingitems.' and '.$tradearray[2].' '.$board_config['points_name'].' Wants:'.$otheritemz.' and '.$tradearray[4].' '.$board_config['points_name'].' '; $actions .= 'Accept TradeReject Trade'; } // start of personal information $personal = 'Your Inventory'.$userdata[$cash_field].' '.$board_config['points_name'].''; if (strlen($userdata['user_specmsg']) > 2) { $personal .= ''.$userdata['user_specmsg'].''; $personal .= 'Clear Messages'; } //end of personal information $template->assign_vars(array( 'ACTIONS' => $actions, 'SHOPPERSONAL' => $personal, 'SHOPLOCATION' => $shoplocation, 'L_SHOP_TITLE' => $title, 'SHOPTABLEROWS' => $inventorytablerows, 'SHOPLIST' => $playeritems, 'SHOPINFOROW' => $inventoryinforow, )); $template->assign_block_vars('', array()); } else { message_die(GENERAL_MESSAGE, 'This is not a valid command!'); } // // Start output of page // include('includes/page_header.' . $phpEx); // // Generate the page // $template->pparse('body'); include('includes/page_tail.' . $phpEx); ?>