<?php
/**
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
* @version $Id 3 2008-08-25 18:35 $
*/
!defined('IN_MUDDER') && exit('Access Denied');

if(!check_submit('mysubmit')) {

    $arr_status = array('1' => '申请中', '2'=>'处理中', '3' => '已发货', '4' => '已退款');
    $status = array_key_exists($status, $arr_status) ? $status : '1';
    $total = $db->get_value("SELECT COUNT(*) FROM {$dbpre}exchange WHERE uid='{$user->uid}' AND status='$status'");
    if($total > 0) {
        $offset = 20;
        $limit = get_limit($page, $offset);
        $query = $db->query("SELECT * FROM {$dbpre}exchange WHERE uid='{$user->uid}' AND status='$status' ORDER BY exchangetime LIMIT $limit");
        while($gift = $db->fetch_array($query)) {
            $gift['status_name'] = $arr_status[$gift['status']];
            $gift['exchangetime'] = date('Y-m-d H:i:s', $gift['exchangetime']);
            $gifts[] = $gift;
        }
        $multipage = multi($total, $offset, $page, 'index.php?ac=exchange&status='.$suatus);
    }

} else {

}
?>