downloads.php
来自「全新且完善的强大网上商店系统」· PHP 代码 · 共 61 行
PHP
61 行
<?php
/*
[SOOBIC!]
Version: 1.5
Author: Soolan (soolan@qq.com)
Copyright: soolan (www.soobic.com)
Last Modified: 2005/4/1 10:00
*/
if (!strstr($PHP_SELF, 'account_history_info.php')) {
$orders_query = $db->query("select orders_id from $table_orders where customers_id = '" . (int)$customer_id . "' order by orders_id desc limit 1");
$orders = $db->fetch_array($orders_query);
$last_order = $orders['orders_id'];
} else {
$last_order = $order_id;
}
$downloads_query = $db->query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, op.products_name, opd.orders_products_download_id, opd.orders_products_filename, opd.download_count, opd.download_maxdays from $table_orders o, $table_orders_products op, $table_orders_products_download opd where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''");
if ($db->num_rows($downloads_query) > 0) {
?>
<tr>
<td><b><?echo HEADING_DOWNLOAD?></b></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<?php
while ($downloads = $db->fetch_array($downloads_query)) {
list($dt_year, $dt_month, $dt_day) = explode('-', $downloads['date_purchased_day']);
$download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads['download_maxdays'], $dt_year);
$download_expiry = date('Y-m-d H:i:s', $download_timestamp);
?>
<tr>
<?php
if ( ($downloads['download_count'] > 0) && (file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) && ( ($downloads['download_maxdays'] == 0) || ($download_timestamp > time())) ) {
echo ' <td ><a href="' . tep_href_link('download.php', 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">' . $downloads['products_name'] . '</a></td>' . "\n";
} else {
echo ' <td >' . $downloads['products_name'] . '</td>' . "\n";
}
echo ' <td>' . TABLE_HEADING_DOWNLOAD_DATE . tep_date_long($download_expiry) . '</td>' . "\n" .
' <td align="right">' . $downloads['download_count'] . TABLE_HEADING_DOWNLOAD_COUNT . '</td>' . "\n" .
' </tr>' . "\n";
}
?>
</tr>
</table></td>
</tr>
<?php
if (!strstr($PHP_SELF, 'account_history_info')) {
?>
<tr>
<td><p><?php printf(FOOTER_DOWNLOAD, '<a href="' . tep_href_link('account.php', '', 'SSL') . '">' . HEADER_TITLE_MY_ACCOUNT . '</a>'); ?></p></td>
</tr>
<?php
}
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?