function show_buy_html($commodity_id, $conn)
{
    require_once 'class/Config_commodity.php';
    require_once 'class/DBtraverser.php';
    $where = ' where ' . Config_commodity::id . ' = ' . "'" . $commodity_id . "'";
    $DBtraverser = new DBtraverser(Config_commodity::table_name, $where);
    $result = $DBtraverser->excute($conn);
    $array_commofity_info = mysqli_fetch_array($result, MYSQLI_ASSOC);
    if ($array_commofity_info) {
        require_once 'Include_picture.php';
        require_once 'class/Info_user.php';
        require_once 'class/Config_user.php';
        $acceptor_info_array = Info_user::get_user_info_by_id($conn, $_SESSION['CURRENT_LOGIN_ID']);
        $publisher_info_array = Info_user::get_user_info_by_id($conn, $array_commofity_info[Config_commodity::publisher]);
        $commodity_array_for_display = array('nickname' => $acceptor_info_array[Config_user::log_name], 'acceptor_phone' => $acceptor_info_array[Config_user::phone_number], 'publisher_name' => $publisher_info_array[Config_user::log_name], 'publisher_phone' => $array_commofity_info[Config_commodity::communication_number], 'title' => $array_commofity_info[Config_commodity::title], 'time' => get_time($array_commofity_info[Config_commodity::release_date]), 'price' => $array_commofity_info[Config_commodity::price], 'description' => $array_commofity_info[Config_commodity::description], 'description_img' => get_one_commodity_pic($conn, $array_commofity_info[Config_commodity::id]), 'img' => 'upload/avatar.png', 'id' => $commodity_id);
        return $commodity_array_for_display;
    }
}
include_once 'smarty_init.php';
require_once 'class/Config.php';
$conn = Config::connect();
$commodity_id = (int) $_REQUEST['id'];
$where = ' where ' . Config_commodity::id . ' = ' . "'" . $commodity_id . "'";
$DBtraverser = new DBtraverser(Config_commodity::table_name, $where);
$result = $DBtraverser->excute($conn);
$array_commofity_info = mysqli_fetch_array($result, MYSQLI_ASSOC);
if ($array_commofity_info) {
    require_once 'Include_picture.php';
    require_once 'class/Info_user.php';
    $array_pictures = get_commodity_pic($conn, $commodity_id);
    $array_message = get_leave_message($commodity_id, $conn);
    $userInfo = new Info_user();
    $username = $userInfo->get_user_logname($conn, $array_commofity_info[Config_commodity::publisher]);
    $commodity_array_for_display = array('nickname' => $username, 'title' => $array_commofity_info[Config_commodity::title], 'time' => get_time($array_commofity_info[Config_commodity::release_date]), 'price' => $array_commofity_info[Config_commodity::price], 'description' => $array_commofity_info[Config_commodity::description], 'description-img' => get_one_commodity_pic($conn, $array_commofity_info[Config_commodity::id]), 'img' => 'upload/avatar.png', 'id' => $commodity_id, 'star_numbers' => $array_commofity_info[Config_commodity::praise], 'message_numbers' => $array_commofity_info[Config_commodity::leave_message_time]);
    $smarty->assign('messages', $array_message);
    $smarty->assign('skill', $commodity_array_for_display);
    $smarty->assign('msg-total', $array_commofity_info[Config_commodity::leave_message_time]);
    $smarty->display('Reward&Market/market-skill.html');
} else {
}
mysqli_free_result($result);
function get_time($release_date)
{
    $now_time = time();
    $release_time = strtotime($release_date);
    return (int) (($now_time - $release_time) / 3600 / 24);
}
function get_leave_message($commodity_id, $conn)
{
Exemple #3
0
    require_once 'class/Config_transaction.php';
    require_once 'class/Config_commodity.php';
    require_once 'Include_picture.php';
    require_once 'class/Info_user.php';
    include 'smarty_init.php';
    $user_id = $_SESSION['CURRENT_LOGIN_ID'];
    $conn = Config::connect();
    $retval = found_transactions($conn);
    //逐个配置 array 三级关联数组  供界面使用
    $array = array();
    while (($temp_database_row_array = mysqli_fetch_array($retval, MYSQLI_ASSOC)) != null) {
        $buyer_id = $temp_database_row_array[Config_transaction::commodity_buyer_id];
        $holder_id = $temp_database_row_array[Config_transaction::commodity_holder_id];
        $trader = $buyer_id == $user_id ? $holder_id : $buyer_id;
        $trader_avatar_and_logname = Info_user::get_user_avatar_and_logname($conn, $trader);
        $array[] = array('url_header' => 'upload/avatar.png', 'url_pic' => get_one_commodity_pic($conn, $temp_database_row_array[Config_commodity::id]), 'acceptor' => $trader_avatar_and_logname[Config_user::log_name], 'title' => $temp_database_row_array[Config_commodity::title], 'price' => $temp_database_row_array[Config_commodity::price], 'id' => $temp_database_row_array[Config_commodity::id]);
    }
    $smarty->assign('accepts', $array);
    $smarty->display('My/my-accepted.html');
} else {
    include 'Login.php';
}
function found_transactions($conn)
{
    $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1;
    $where = ' where ' . Config_transaction::table_name . "." . Config_transaction::choosed_id . ' = ' . Config_commodity::table_name . "." . Config_commodity::id;
    if (isset($_GET['type'])) {
        if ($_GET['type'] == 'skill') {
            $where .= ' AND ' . Config_transaction::table_name . "." . Config_transaction::commodity_holder_id . ' = ' . "'" . $_SESSION['CURRENT_LOGIN_ID'] . "'";
        } else {
            $where .= ' AND ' . Config_transaction::table_name . "." . Config_transaction::commodity_buyer_id . ' = ' . "'" . $_SESSION['CURRENT_LOGIN_ID'] . "'";