include "header.php"; include_once "class_character.php"; # add include $char_loc = 0; $result = mysql_query("SELECT * FROM phaos_characters WHERE id = '{$PHP_PHAOS_CHARID}'"); if ($row = mysql_fetch_array($result)) { $char_loc = $row["location"]; } $shop_id = 0; $result = mysql_query("SELECT * FROM phaos_buildings WHERE location = '{$char_loc}'"); if ($row = mysql_fetch_array($result)) { $shop_id = $row["shop_id"]; } // make sure this requested shop is at the players location if (!shop_valid($char_loc, $shop_id)) { echo $lang_markt["no_sell"] . '</body></html>'; exit; } // we use the character to determine opponent level $character = new character($PHP_PHAOS_CHARID); if ($character->stamina_points <= 0 || $character->hit_points <= 0) { echo $lang_comb["stam_noo"] . '</body></html>'; exit; } ?> <table border=0 cellspacing=0 cellpadding=0 width="100%" height="100%"> <tr> <td align=center valign=top>
<?php include "header.php"; include_once "class_character.php"; $refresh = 0; //determine if the SideBar has to be refreshed $character = new character($PHP_PHAOS_CHARID); shop_valid($character->location, $shop_id); $current_time = time(); if (@$item_id) { // if you've previously selected an item to purchase $result = mysql_query("SELECT * FROM phaos_shop_inventory WHERE shop_id='{$shop_id}' AND item_id='{$item_id}'"); // $result = mysql_query ("SELECT * FROM phaos_misc_items WHERE id = '$item'"); $inv_row = mysql_fetch_array($result); // $price = $inv_row["sell"]; $number = intval($_REQUEST['number']); while ($number-- > 0) { // is your pack already too full? if ($character->invent_count() >= $character->max_inventory) { print "<big><b><font color=red>{$lang_shop['inv_full']}</font></b></big>\n\t\t\t\t<br> <br>\n\t\t\t\t<a href='town.php'>{$lang_shop['return']}</a>"; exit; } // is the item still in stock? if (--$inv_row["quantity"] >= 0) { // do you have enough gold to buy the item? if ($character->pay($inv_row["sell"])) { // reduce player gold if they have enough // give gold to owner $result = mysql_query("SELECT * FROM phaos_buildings WHERE shop_id='{$shop_id}' "); $shop_row = mysql_fetch_array($result); $owner = new character($shop_row["owner_id"]);
<?php include 'header.php'; $result = mysql_query("SELECT * FROM phaos_characters WHERE id = '{$PHP_PHAOS_CHARID}'"); if ($row = mysql_fetch_array($result)) { $char_loc = $row["location"]; } $result = mysql_query("SELECT * FROM phaos_buildings WHERE location = '{$char_loc}'"); if ($row = mysql_fetch_array($result)) { $shop_id = $row["shop_id"]; } shop_valid($char_loc, $shop_id); // make sure this requested shop is at the players location $sql = mysql_query("SELECT gold,bankgold FROM phaos_characters WHERE id='{$PHP_PHAOS_CHARID}'"); $row = mysql_fetch_assoc($sql); if (isset($_POST['submit'])) { // process bank here switch ($_POST['R1']) { case "deposit": if ($_POST['amount'] <= 0) { echo "<center>You must enter an amount to deposit!</center>"; } elseif ($_POST['amount'] > $row['gold']) { echo "<center>You dont have that much gold on hand!</center>"; } else { $newgold = $row['gold'] - $_POST['amount']; $newbank = $row['bankgold'] + $_POST['amount']; mysql_query("UPDATE phaos_characters SET gold='{$newgold}', bankgold='{$newbank}' WHERE id='{$PHP_PHAOS_CHARID}'"); echo "<center>You deposited " . number_format($_POST['amount']) . " gold into your account.</center>"; $refresh = 1; } break;