<?php session_start(); require_once 'config.php'; require_once 'functions-product.php'; if (!isset($_SESSION['ewu_username'])) { header('location:index.php?notloged'); exit; } if (isset($_GET['id']) && is_numeric($_GET['id'])) { $pid = $_GET['id']; $good = get_product_by_pid($pid); if ($good == null) { $pid = 0; } else { if ($good['owner'] != $_SESSION['ewu_username']) { header('location:index.php?notowner'); } else { if ($good['state'] != 's' && $good['state'] != 'w') { header('location:index.php?noaccess'); } else { $good['images'] = trim($good['images'], ';'); $images = explode(';', $good['images']); $price = $good['price'] / 100; $time = date('Y-m-d', $good['time']); $name = $good['name']; $depreciation = $good['depreciation']; $campus = $good['campus']; $type = $good['type']; $category = $good['category']; $description = htmlspecialchars($good['description']);
<?php session_start(); require_once 'config.php'; require_once 'functions-product.php'; require_once 'functions-comment.php'; require_once 'functions-account.php'; $area_array = json_decode(AREA_LIST); $category_array = json_decode(CATEGORY_LIST); $type_array = json_decode(TYPE_LIST); if (isset($_GET['id']) && is_numeric($_GET['id'])) { $pid = $_GET['id']; $detail = get_product_by_pid($pid); if ($detail == null) { $pid = 0; } else { if ($detail['state'] == 'd') { $pid = 0; } else { $detail['images'] = trim($detail['images'], ';'); $images = explode(';', $detail['images']); $price = $detail['price'] / 100; $time = date('Y-m-d', $detail['time']); $name = htmlspecialchars($detail['name']); $depreciation = 10 - $detail['depreciation'] . ' 成新'; $campus = $detail['campus']; $type = $detail['type']; $category = $detail['category']; $description = str_replace(array("\r\n", "\r", "\n"), '<br/>', htmlspecialchars($detail['description'])); } }