Much quicker item parser (335 items in 12ms instead of 2100ms)

Now checking if character is offline before changing gender.
Restructured Admin_shop.php, it will now show pending orders and the whole transaction log.
This commit is contained in:
Stefan Brannfjell
2014-06-17 02:35:48 +02:00
parent 52721610c4
commit d3807bfafe
6 changed files with 116 additions and 74 deletions

View File

@@ -3,17 +3,15 @@ require_once 'engine/init.php';
include 'layout/overall/header.php';
protect_page();
admin_only($user_data);
$orders_ammount = isset($_GET['orders_ammount']) && $_GET['orders_ammount'] > 0 && $_GET['orders_ammount'] <= 200 ? (int)$_GET['orders_ammount'] : 50;
$orders = mysql_select_multi('SELECT * FROM `znote_shop_orders` ORDER BY `id` DESC LIMIT ' . $orders_ammount);
$order_types = array(1 => 'Item', 2 => 'Premium Days', 3 => 'Sex Change', 4 => 'Custom');
$orders = mysql_select_multi('SELECT * FROM `znote_shop_orders` ORDER BY `id` DESC;');
$order_types = array(1 => 'Item', 2 => 'Premium Days', 3 => 'Gender Change', 4 => 'Name Change', 5 => 'Custom');
$items = getItemList();
?>
<h1>Admin Shop</h1>
<h2>Shop Orders</h2>
<p>Shows latest <?php echo $orders_ammount; ?> shop orders.</p>
<form action="" method="get">
<label for="orders_length">Enter ammount of orders to show:</label> <input type="number" max="200" min="1" name="orders_ammount" value="<?php echo $orders_ammount; ?>"/>
<input type="submit" value="Submit"/>
</form>
<h1>Shop Logs</h1>
<h2>Pending Orders</h2>
<p>These are pending orders, like items bought, but not received or used yet.</p>
<table>
<thead>
<th>Id</th>
@@ -29,13 +27,43 @@ $order_types = array(1 => 'Item', 2 => 'Premium Days', 3 => 'Sex Change', 4 => '
<td><?php echo $order['id']; ?></td>
<td><?php echo user_account_id_from_name($order['account_id']); ?></td>
<td><?php echo $order_types[$order['type']] ?></td>
<td><?php echo getItemNameById($order['itemid']) . ' (' . $order['itemid'] . ')' ?></td>
<td><?php echo '(' . $order['itemid'] . ') ', (isset($items[$order['itemid']])) ? $items[$order['itemid']] : ''; ?></td>
<td><?php echo $order['count'] ?></td>
<td><?php echo date('Y/m/d H:i', $order['time']) ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
$orders = mysql_select_multi("SELECT `id`, `account_id`, `type`, `itemid`, `count`, `points`, `time` FROM `znote_shop_logs` ORDER BY `id` DESC;");
?>
<h2>Order History</h2>
<p>This list contains all transactions bought in the shop.</p>
<table>
<thead>
<th>Id</th>
<th>Account</th>
<th>Type</th>
<th>Item</th>
<th>Count</th>
<th>points</th>
<th>Date</th>
</thead>
<tbody>
<?php foreach(($orders ? $orders : array()) as $order) { ?>
<tr>
<td><?php echo $order['id']; ?></td>
<td><?php echo $order['account_id']; ?></td>
<td><?php echo $order_types[$order['type']] ?></td>
<td><?php echo '(' . $order['itemid'] . ') ', (isset($items[$order['itemid']])) ? $items[$order['itemid']] : ''; ?></td>
<td><?php echo $order['count'] ?></td>
<td><?php echo $order['points'] ?></td>
<td><?php echo getClock($order['time'], true, false); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
include 'layout/overall/footer.php';
?>