Autosave: 20260208-083439

This commit is contained in:
Flatlogic Bot 2026-02-08 08:34:40 +00:00
parent a9654314a0
commit 25206e6fea
29 changed files with 2511 additions and 493 deletions

13
admin/auth.php Normal file
View File

@ -0,0 +1,13 @@
<?php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
header("Location: ../login.php");
exit;
}
require_once __DIR__ . '/../db/config.php';
$db = db();
?>

118
admin/categories.php Normal file
View File

@ -0,0 +1,118 @@
<?php
require_once 'auth.php';
// Handle Delete
if (isset($_GET['delete'])) {
$stmt = $db->prepare("DELETE FROM categories WHERE id = ?");
$stmt->execute([$_GET['delete']]);
header("Location: categories.php");
exit;
}
// Handle Add/Edit
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = $_POST['id'] ?? null;
$name = $_POST['name'];
$icon = $_POST['icon'];
if ($id) {
$stmt = $db->prepare("UPDATE categories SET name=?, icon=? WHERE id=?");
$stmt->execute([$name, $icon, $id]);
} else {
$stmt = $db->prepare("INSERT INTO categories (name, icon) VALUES (?, ?)");
$stmt->execute([$name, $icon]);
}
header("Location: categories.php");
exit;
}
$categories = $db->query("SELECT * FROM categories ORDER BY id ASC")->fetchAll();
$edit_cat = null;
if (isset($_GET['edit'])) {
$stmt = $db->prepare("SELECT * FROM categories WHERE id = ?");
$stmt->execute([$_GET['edit']]);
$edit_cat = $stmt->fetch();
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>分类管理 - 豪软后台</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
<style>
body { background: #f8f9fa; }
.sidebar { min-height: 100vh; background: #212529; color: white; }
.sidebar a { color: rgba(255,255,255,0.7); text-decoration: none; padding: 12px 20px; display: block; }
.sidebar a:hover, .sidebar a.active { background: #343a40; color: white; }
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2 p-0 sidebar">
<div class="p-4 fs-4 fw-bold border-bottom border-secondary">豪软管理</div>
<a href="index.php"><i class="bi bi-speedometer2 me-2"></i> 仪表盘</a>
<a href="products.php"><i class="bi bi-box-seam me-2"></i> 商品管理</a>
<a href="categories.php" class="active"><i class="bi bi-grid me-2"></i> 分类管理</a>
<a href="orders.php"><i class="bi bi-cart me-2"></i> 订单管理</a>
<a href="settings.php"><i class="bi bi-gear me-2"></i> 站点设置</a>
<div class="mt-auto p-3">
<a href="../index.php" target="_blank" class="small"><i class="bi bi-house me-1"></i> 返回前台</a>
<a href="../logout.php" class="small text-danger"><i class="bi bi-box-arrow-right me-1"></i> 退出</a>
</div>
</div>
<div class="col-md-10 p-5">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2><?php echo $edit_cat ? '编辑分类' : '新增分类'; ?></h2>
</div>
<div class="card p-4 mb-5">
<form method="POST">
<?php if ($edit_cat): ?><input type="hidden" name="id" value="<?php echo $edit_cat['id']; ?>"><?php endif; ?>
<div class="row g-3">
<div class="col-md-5">
<label class="form-label">分类名称</label>
<input type="text" name="name" class="form-control" value="<?php echo $edit_cat['name'] ?? ''; ?>" required>
</div>
<div class="col-md-5">
<label class="form-label">图标 (Bootstrap Icon Class)</label>
<input type="text" name="icon" class="form-control" value="<?php echo $edit_cat['icon'] ?? 'bi-box'; ?>" placeholder="bi-wechat">
</div>
<div class="col-md-2 d-flex align-items-end">
<button type="submit" class="btn btn-primary w-100"><?php echo $edit_cat ? '更新' : '添加'; ?></button>
</div>
</div>
</form>
</div>
<div class="card p-4">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>图标</th>
<th>分类名称</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($categories as $c): ?>
<tr>
<td><i class="bi <?php echo $c['icon']; ?> fs-4"></i></td>
<td class="fw-bold"><?php echo $c['name']; ?></td>
<td>
<a href="?edit=<?php echo $c['id']; ?>" class="btn btn-sm btn-outline-info me-2">编辑</a>
<a href="?delete=<?php echo $c['id']; ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定删除?')">删除</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>

107
admin/index.php Normal file
View File

@ -0,0 +1,107 @@
<?php
require_once 'auth.php';
$stats = [];
$stats['orders_count'] = $db->query("SELECT COUNT(*) FROM orders")->fetchColumn();
$stats['total_sales'] = $db->query("SELECT SUM(total_amount) FROM orders WHERE status = 'completed'")->fetchColumn() ?: 0;
$stats['products_count'] = $db->query("SELECT COUNT(*) FROM products")->fetchColumn();
$stats['users_count'] = $db->query("SELECT COUNT(*) FROM users")->fetchColumn();
$recent_orders = $db->query("SELECT * FROM orders ORDER BY id DESC LIMIT 5")->fetchAll();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>管理后台 - 豪软世界</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
<style>
body { background: #f8f9fa; }
.sidebar { min-height: 100vh; background: #212529; color: white; }
.sidebar a { color: rgba(255,255,255,0.7); text-decoration: none; padding: 12px 20px; display: block; }
.sidebar a:hover, .sidebar a.active { background: #343a40; color: white; }
.card { border: none; box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075); border-radius: 10px; }
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2 p-0 sidebar">
<div class="p-4 fs-4 fw-bold border-bottom border-secondary">豪软管理</div>
<a href="index.php" class="active"><i class="bi bi-speedometer2 me-2"></i> 仪表盘</a>
<a href="products.php"><i class="bi bi-box-seam me-2"></i> 商品管理</a>
<a href="categories.php"><i class="bi bi-grid me-2"></i> 分类管理</a>
<a href="orders.php"><i class="bi bi-cart me-2"></i> 订单管理</a>
<a href="settings.php"><i class="bi bi-gear me-2"></i> 站点设置</a>
<div class="mt-auto p-3">
<a href="../index.php" target="_blank" class="small"><i class="bi bi-house me-1"></i> 返回前台</a>
<a href="../logout.php" class="small text-danger"><i class="bi bi-box-arrow-right me-1"></i> 退出</a>
</div>
</div>
<div class="col-md-10 p-5">
<h2 class="mb-4">数据总览</h2>
<div class="row g-4 mb-5">
<div class="col-md-3">
<div class="card p-4 bg-primary text-white">
<div class="small">累计订单</div>
<div class="fs-2 fw-bold"><?php echo $stats['orders_count']; ?></div>
</div>
</div>
<div class="col-md-3">
<div class="card p-4 bg-success text-white">
<div class="small">完成交易 (USDT)</div>
<div class="fs-2 fw-bold"><?php echo number_format($stats['total_sales'], 2); ?></div>
</div>
</div>
<div class="col-md-3">
<div class="card p-4 bg-info text-white">
<div class="small">在售商品</div>
<div class="fs-2 fw-bold"><?php echo $stats['products_count']; ?></div>
</div>
</div>
<div class="col-md-3">
<div class="card p-4 bg-warning text-dark">
<div class="small">注册用户</div>
<div class="fs-2 fw-bold"><?php echo $stats['users_count']; ?></div>
</div>
</div>
</div>
<div class="card p-4">
<h5 class="mb-4">最新订单</h5>
<table class="table align-middle">
<thead>
<tr>
<th>订单号</th>
<th>联系方式</th>
<th>金额</th>
<th>状态</th>
<th>日期</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($recent_orders as $o): ?>
<tr>
<td><code><?php echo $o['order_no']; ?></code></td>
<td><?php echo $o['contact_info']; ?></td>
<td><?php echo $o['total_amount']; ?> USDT</td>
<td>
<span class="badge bg-<?php echo $o['status'] === 'completed' ? 'success' : ($o['status'] === 'pending' ? 'warning' : 'info'); ?>">
<?php echo $o['status']; ?>
</span>
</td>
<td><?php echo date('m-d H:i', strtotime($o['created_at'])); ?></td>
<td><a href="orders.php?id=<?php echo $o['id']; ?>" class="btn btn-sm btn-outline-primary">查看</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

158
admin/orders.php Normal file
View File

@ -0,0 +1,158 @@
<?php
require_once 'auth.php';
// Handle Status Update
if (isset($_POST['update_status'])) {
$stmt = $db->prepare("UPDATE orders SET status = ? WHERE id = ?");
$stmt->execute([$_POST['status'], $_POST['order_id']]);
header("Location: orders.php" . (isset($_GET['id']) ? "?id=".$_POST['order_id'] : ""));
exit;
}
$view_order = null;
if (isset($_GET['id'])) {
$stmt = $db->prepare("SELECT * FROM orders WHERE id = ?");
$stmt->execute([$_GET['id']]);
$view_order = $stmt->fetch();
if ($view_order) {
$stmt = $db->prepare("SELECT oi.*, p.name FROM order_items oi JOIN products p ON oi.product_id = p.id WHERE oi.order_id = ?");
$stmt->execute([$view_order['id']]);
$view_order['items'] = $stmt->fetchAll();
}
}
$orders = $db->query("SELECT * FROM orders ORDER BY id DESC")->fetchAll();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>订单管理 - 豪软后台</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
<style>
body { background: #f8f9fa; }
.sidebar { min-height: 100vh; background: #212529; color: white; }
.sidebar a { color: rgba(255,255,255,0.7); text-decoration: none; padding: 12px 20px; display: block; }
.sidebar a:hover, .sidebar a.active { background: #343a40; color: white; }
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2 p-0 sidebar">
<div class="p-4 fs-4 fw-bold border-bottom border-secondary">豪软管理</div>
<a href="index.php"><i class="bi bi-speedometer2 me-2"></i> 仪表盘</a>
<a href="products.php"><i class="bi bi-box-seam me-2"></i> 商品管理</a>
<a href="categories.php"><i class="bi bi-grid me-2"></i> 分类管理</a>
<a href="orders.php" class="active"><i class="bi bi-cart me-2"></i> 订单管理</a>
<a href="settings.php"><i class="bi bi-gear me-2"></i> 站点设置</a>
<div class="mt-auto p-3">
<a href="../index.php" target="_blank" class="small"><i class="bi bi-house me-1"></i> 返回前台</a>
<a href="../logout.php" class="small text-danger"><i class="bi bi-box-arrow-right me-1"></i> 退出</a>
</div>
</div>
<div class="col-md-10 p-5">
<?php if ($view_order): ?>
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>订单详情: <?php echo $view_order['order_no']; ?></h2>
<a href="orders.php" class="btn btn-secondary">返回列表</a>
</div>
<div class="row g-4">
<div class="col-md-8">
<div class="card p-4 mb-4">
<h5 class="mb-4">商品列表</h5>
<table class="table">
<thead>
<tr>
<th>商品</th>
<th>单价</th>
<th>数量</th>
<th>小计</th>
</tr>
</thead>
<tbody>
<?php foreach ($view_order['items'] as $it): ?>
<tr>
<td><?php echo $it['name']; ?></td>
<td><?php echo $it['price_usdt']; ?> USDT</td>
<td><?php echo $it['quantity']; ?></td>
<td class="fw-bold"><?php echo number_format($it['price_usdt'] * $it['quantity'], 2); ?> USDT</td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<td colspan="3" class="text-end fw-bold">合计金额</td>
<td class="text-primary fs-5 fw-bold"><?php echo $view_order['total_amount']; ?> USDT</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="col-md-4">
<div class="card p-4 mb-4">
<h5 class="mb-4">订单状态</h5>
<form method="POST">
<input type="hidden" name="order_id" value="<?php echo $view_order['id']; ?>">
<div class="mb-3">
<label class="form-label">修改状态</label>
<select name="status" class="form-select">
<option value="pending" <?php echo $view_order['status'] === 'pending' ? 'selected' : ''; ?>>待付款 (Pending)</option>
<option value="paid" <?php echo $view_order['status'] === 'paid' ? 'selected' : ''; ?>>已付款 (Paid)</option>
<option value="completed" <?php echo $view_order['status'] === 'completed' ? 'selected' : ''; ?>>已完成 (Completed)</option>
<option value="cancelled" <?php echo $view_order['status'] === 'cancelled' ? 'selected' : ''; ?>>已取消 (Cancelled)</option>
</select>
</div>
<button type="submit" name="update_status" class="btn btn-primary w-100">更新状态</button>
</form>
</div>
<div class="card p-4">
<h5 class="mb-3">客户信息</h5>
<p><strong>联系方式:</strong><br><?php echo $view_order['contact_info']; ?></p>
<p><strong>下单时间:</strong><br><?php echo $view_order['created_at']; ?></p>
<p><strong>支付方式:</strong><br><?php echo $view_order['payment_method']; ?></p>
</div>
</div>
</div>
<?php else: ?>
<h2 class="mb-4">订单管理</h2>
<div class="card p-4">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>订单号</th>
<th>联系方式</th>
<th>金额</th>
<th>状态</th>
<th>日期</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($orders as $o): ?>
<tr>
<td><code><?php echo $o['order_no']; ?></code></td>
<td><?php echo $o['contact_info']; ?></td>
<td class="fw-bold"><?php echo $o['total_amount']; ?> USDT</td>
<td>
<span class="badge bg-<?php echo $o['status'] === 'completed' ? 'success' : ($o['status'] === 'pending' ? 'warning' : ($o['status'] === 'paid' ? 'info' : 'danger')); ?>">
<?php echo $o['status']; ?>
</span>
</td>
<td><?php echo $o['created_at']; ?></td>
<td><a href="?id=<?php echo $o['id']; ?>" class="btn btn-sm btn-outline-primary">查看详情</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>
</body>
</html>

176
admin/products.php Normal file
View File

@ -0,0 +1,176 @@
<?php
require_once 'auth.php';
// Handle Delete
if (isset($_GET['delete'])) {
$stmt = $db->prepare("DELETE FROM products WHERE id = ?");
$stmt->execute([$_GET['delete']]);
header("Location: products.php");
exit;
}
// Handle Add/Edit
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = $_POST['id'] ?? null;
$name = $_POST['name'];
$cat_id = $_POST['category_id'];
$desc = $_POST['description'];
$content = $_POST['content'];
$price = $_POST['price_usdt'];
$stock = $_POST['stock'];
$img = $_POST['image_url'];
$is_hot = isset($_POST['is_hot']) ? 1 : 0;
if ($id) {
$stmt = $db->prepare("UPDATE products SET name=?, category_id=?, description=?, content=?, price_usdt=?, stock=?, image_url=?, is_hot=? WHERE id=?");
$stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot, $id]);
} else {
$stmt = $db->prepare("INSERT INTO products (name, category_id, description, content, price_usdt, stock, image_url, is_hot) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->execute([$name, $cat_id, $desc, $content, $price, $stock, $img, $is_hot]);
}
header("Location: products.php");
exit;
}
$categories = $db->query("SELECT * FROM categories")->fetchAll();
$products = $db->query("SELECT p.*, c.name as cat_name FROM products p JOIN categories c ON p.category_id = c.id ORDER BY p.id DESC")->fetchAll();
$edit_product = null;
if (isset($_GET['edit'])) {
$stmt = $db->prepare("SELECT * FROM products WHERE id = ?");
$stmt->execute([$_GET['edit']]);
$edit_product = $stmt->fetch();
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>商品管理 - 管理后台</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
<style>
body { background-color: #f8f9fa; }
.sidebar { min-height: 100vh; background: #212529; color: white; }
.sidebar a { color: rgba(255,255,255,0.8); text-decoration: none; padding: 10px 20px; display: block; }
.sidebar a:hover { background: rgba(255,255,255,0.1); color: white; }
.sidebar a.active { background: #0d6efd; color: white; }
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2 p-0 sidebar">
<?php include 'sidebar.php'; ?>
</div>
<div class="col-md-10 p-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2><?php echo $edit_product ? '编辑商品' : '商品管理'; ?></h2>
<?php if ($edit_product): ?>
<a href="products.php" class="btn btn-secondary">添加新商品</a>
<?php endif; ?>
</div>
<div class="card shadow-sm mb-4">
<div class="card-body">
<form method="POST">
<?php if ($edit_product): ?>
<input type="hidden" name="id" value="<?php echo $edit_product['id']; ?>">
<?php endif; ?>
<div class="row g-3">
<div class="col-md-6">
<label class="form-label">商品名称</label>
<input type="text" name="name" class="form-control" value="<?php echo htmlspecialchars($edit_product['name'] ?? ''); ?>" required>
</div>
<div class="col-md-3">
<label class="form-label">所属分类</label>
<select name="category_id" class="form-select">
<?php foreach ($categories as $c): ?>
<option value="<?php echo $c['id']; ?>" <?php echo (isset($edit_product['category_id']) && $edit_product['category_id'] == $c['id']) ? 'selected' : ''; ?>>
<?php echo $c['name']; ?>
</option>
<?php endforeach; ?>
</select>
</div>
<div class="col-md-3">
<label class="form-label">价格 (USDT)</label>
<input type="number" step="0.01" name="price_usdt" class="form-control" value="<?php echo $edit_product['price_usdt'] ?? ''; ?>" required>
</div>
<div class="col-md-3">
<label class="form-label">库存数量</label>
<input type="number" name="stock" class="form-control" value="<?php echo $edit_product['stock'] ?? '999'; ?>" required>
</div>
<div class="col-md-6">
<label class="form-label">商品图片 URL</label>
<input type="text" name="image_url" class="form-control" value="<?php echo htmlspecialchars($edit_product['image_url'] ?? ''); ?>" required>
</div>
<div class="col-md-3 d-flex align-items-end">
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" name="is_hot" value="1" id="isHot" <?php echo (isset($edit_product['is_hot']) && $edit_product['is_hot']) ? 'checked' : ''; ?>>
<label class="form-check-label" for="isHot">设为热门推荐</label>
</div>
</div>
<div class="col-12">
<label class="form-label">简短描述 (显示在列表页)</label>
<input type="text" name="description" class="form-control" value="<?php echo htmlspecialchars($edit_product['description'] ?? ''); ?>">
</div>
<div class="col-12">
<label class="form-label">详细内容 (显示在详情页)</label>
<textarea name="content" class="form-control" rows="5"><?php echo htmlspecialchars($edit_product['content'] ?? ''); ?></textarea>
</div>
<div class="col-12">
<button type="submit" class="btn btn-primary px-5"><?php echo $edit_product ? '保存修改' : '立即添加'; ?></button>
</div>
</div>
</form>
</div>
</div>
<div class="card shadow-sm">
<div class="card-body">
<table class="table table-hover">
<thead>
<tr>
<th>ID</th>
<th>商品</th>
<th>分类</th>
<th>价格</th>
<th>库存</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($products as $p): ?>
<tr>
<td><?php echo $p['id']; ?></td>
<td>
<div class="d-flex align-items-center">
<img src="<?php echo $p['image_url']; ?>" width="32" height="32" class="me-2 rounded">
<?php echo $p['name']; ?>
</div>
</td>
<td><?php echo $p['cat_name']; ?></td>
<td><?php echo $p['price_usdt']; ?> USDT</td>
<td><?php echo $p['stock']; ?></td>
<td>
<?php if ($p['is_hot']): ?>
<span class="badge bg-danger">热门</span>
<?php endif; ?>
</td>
<td>
<a href="?edit=<?php echo $p['id']; ?>" class="btn btn-sm btn-outline-primary">编辑</a>
<a href="?delete=<?php echo $p['id']; ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定删除?')">删除</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

72
admin/settings.php Normal file
View File

@ -0,0 +1,72 @@
<?php
require_once __DIR__ . '/../db/config.php';
session_start();
if (!isset($_SESSION['admin_logged_in'])) {
header('Location: ../login.php');
exit;
}
$message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$db = db();
foreach ($_POST['settings'] as $key => $value) {
$stmt = $db->prepare("UPDATE settings SET key_value = ? WHERE key_name = ?");
$stmt->execute([$value, $key]);
}
$message = '设置已更新';
}
$settings = db()->query("SELECT * FROM settings")->fetchAll();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>系统设置 - 管理后台</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
<style>
body { background-color: #f8f9fa; }
.sidebar { min-height: 100vh; background: #212529; color: white; }
.sidebar a { color: rgba(255,255,255,0.8); text-decoration: none; padding: 10px 20px; display: block; }
.sidebar a:hover { background: rgba(255,255,255,0.1); color: white; }
.sidebar a.active { background: #0d6efd; color: white; }
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2 p-0 sidebar">
<?php include 'sidebar.php'; ?>
</div>
<div class="col-md-10 p-4">
<h2 class="mb-4">系统设置</h2>
<?php if ($message): ?>
<div class="alert alert-success"><?php echo $message; ?></div>
<?php endif; ?>
<div class="card shadow-sm">
<div class="card-body">
<form method="POST">
<?php foreach ($settings as $s): ?>
<div class="mb-4">
<label class="form-label fw-bold"><?php echo $s['description']; ?> (<?php echo $s['key_name']; ?>)</label>
<?php if ($s['key_name'] === 'notice'): ?>
<textarea name="settings[<?php echo $s['key_name']; ?>]" class="form-control" rows="3"><?php echo htmlspecialchars($s['key_value']); ?></textarea>
<?php else: ?>
<input type="text" name="settings[<?php echo $s['key_name']; ?>]" class="form-control" value="<?php echo htmlspecialchars($s['key_value']); ?>">
<?php endif; ?>
</div>
<?php endforeach; ?>
<button type="submit" class="btn btn-primary px-5">保存设置</button>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

36
admin/sidebar.php Normal file
View File

@ -0,0 +1,36 @@
<div class="py-4 text-center">
<div class="d-flex align-items-center justify-content-center mb-2">
<img src="../assets/pasted-20260208-082111-302e08e2.png" alt="Logo" style="height: 30px; width: auto; border-radius: 4px; margin-right: 8px;">
<h5 class="mb-0 text-dark fw-bold">豪软后台</h5>
</div>
</div>
<nav class="mt-3">
<style>
.sidebar a { color: #334155; }
.sidebar a.active { background: #ff3399 !important; color: white !important; }
.sidebar a:hover { background: rgba(255, 51, 153, 0.1); }
.sidebar hr { border-color: rgba(0,0,0,0.1); }
</style>
<a href="index.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'index.php' ? 'active' : ''; ?>">
<i class="bi bi-speedometer2 me-2"></i> 仪表盘
</a>
<a href="categories.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'categories.php' ? 'active' : ''; ?>">
<i class="bi bi-grid me-2"></i> 分类管理
</a>
<a href="products.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'products.php' ? 'active' : ''; ?>">
<i class="bi bi-box-seam me-2"></i> 商品管理
</a>
<a href="orders.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'orders.php' ? 'active' : ''; ?>">
<i class="bi bi-cart-check me-2"></i> 订单管理
</a>
<a href="settings.php" class="<?php echo basename($_SERVER['PHP_SELF']) == 'settings.php' ? 'active' : ''; ?>">
<i class="bi bi-gear me-2"></i> 系统设置
</a>
<hr class="mx-3 opacity-25">
<a href="../index.php">
<i class="bi bi-house me-2"></i> 返回首页
</a>
<a href="../logout.php">
<i class="bi bi-box-arrow-right me-2"></i> 退出登录
</a>
</nav>

View File

@ -1,346 +1,190 @@
:root {
--color-bg: #ffffff;
--color-text: #1a1a1a;
--color-primary: #2563EB; /* Vibrant Blue */
--color-secondary: #000000;
--color-accent: #A3E635; /* Lime Green */
--color-surface: #f8f9fa;
--font-heading: 'Space Grotesk', sans-serif;
--font-body: 'Inter', sans-serif;
--border-width: 2px;
--shadow-hard: 5px 5px 0px #000;
--shadow-hover: 8px 8px 0px #000;
--radius-pill: 50rem;
--radius-card: 1rem;
--primary-color: #ff3399;
--secondary-color: #ff66b2;
--accent-color: #0088cc;
--bg-light: #fff5f7;
--card-bg: #ffffff;
--glass-border: rgba(255, 51, 153, 0.1);
--text-dark: #334155;
--text-muted: #64748b;
}
body {
font-family: var(--font-body);
background-color: var(--color-bg);
color: var(--color-text);
overflow-x: hidden;
background-color: var(--bg-light);
color: var(--text-dark);
font-family: 'Inter', sans-serif;
background-image:
radial-gradient(at 0% 0%, rgba(255, 0, 122, 0.05) 0px, transparent 50%),
radial-gradient(at 100% 100%, rgba(255, 51, 153, 0.05) 0px, transparent 50%);
background-attachment: fixed;
}
h1, h2, h3, h4, h5, h6, .navbar-brand {
font-family: var(--font-heading);
letter-spacing: -0.03em;
.glass-card {
background: var(--card-bg);
border: 1px solid var(--glass-border);
border-radius: 1rem;
transition: all 0.3s ease;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}
/* Utilities */
.text-primary { color: var(--color-primary) !important; }
.bg-black { background-color: #000 !important; }
.text-white { color: #fff !important; }
.shadow-hard { box-shadow: var(--shadow-hard); }
.border-2-black { border: var(--border-width) solid #000; }
.py-section { padding-top: 5rem; padding-bottom: 5rem; }
/* Navbar */
.navbar {
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
border-bottom: var(--border-width) solid transparent;
transition: all 0.3s;
padding-top: 1rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--glass-border);
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.navbar.scrolled {
border-bottom-color: #000;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
.brand-text {
font-size: 1.5rem;
.navbar-brand {
font-weight: 800;
letter-spacing: -0.025em;
text-transform: uppercase;
color: var(--primary-color) !important;
}
.nav-link {
font-weight: 500;
color: var(--color-text);
margin-left: 1rem;
position: relative;
font-weight: 600;
font-size: 0.95rem;
color: var(--text-dark) !important;
transition: color 0.3s ease;
}
.nav-link:hover, .nav-link.active {
color: var(--color-primary);
}
/* Buttons */
.btn {
font-weight: 700;
font-family: var(--font-heading);
padding: 0.8rem 2rem;
border-radius: var(--radius-pill);
border: var(--border-width) solid #000;
transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
box-shadow: var(--shadow-hard);
}
.btn:hover {
transform: translate(-2px, -2px);
box-shadow: var(--shadow-hover);
}
.btn:active {
transform: translate(2px, 2px);
box-shadow: 0 0 0 #000;
.nav-link:hover {
color: var(--primary-color) !important;
}
.btn-primary {
background-color: var(--color-primary);
border-color: #000;
color: #fff;
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
border: none;
color: white;
font-weight: 700;
}
.btn-primary:hover {
background-color: #1d4ed8;
border-color: #000;
color: #fff;
background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(255, 51, 153, 0.2);
}
.btn-outline-dark {
background-color: #fff;
color: #000;
}
.btn-cta {
background-color: var(--color-accent);
color: #000;
}
.btn-cta:hover {
background-color: #8cc629;
color: #000;
}
/* Hero Section */
.hero-section {
min-height: 100vh;
padding-top: 80px;
}
.background-blob {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.6;
z-index: 1;
}
.blob-1 {
top: -10%;
right: -10%;
width: 600px;
height: 600px;
background: radial-gradient(circle, var(--color-accent), transparent);
}
.blob-2 {
bottom: 10%;
left: -10%;
width: 500px;
height: 500px;
background: radial-gradient(circle, var(--color-primary), transparent);
}
.highlight-text {
background: linear-gradient(120deg, transparent 0%, transparent 40%, var(--color-accent) 40%, var(--color-accent) 100%);
background-repeat: no-repeat;
background-size: 100% 40%;
background-position: 0 88%;
padding: 0 5px;
}
.dot { color: var(--color-primary); }
.badge-pill {
display: inline-block;
padding: 0.5rem 1rem;
border: 2px solid #000;
border-radius: 50px;
font-weight: 700;
background: #fff;
box-shadow: 4px 4px 0 #000;
font-family: var(--font-heading);
font-size: 0.9rem;
}
/* Marquee */
.marquee-container {
.product-card {
overflow: hidden;
white-space: nowrap;
border-top: 2px solid #000;
border-bottom: 2px solid #000;
}
.rotate-divider {
transform: rotate(-2deg) scale(1.05);
z-index: 10;
.product-card:hover {
transform: translateY(-5px);
border-color: var(--primary-color);
box-shadow: 0 10px 25px rgba(255, 51, 153, 0.1);
}
.product-img-container {
aspect-ratio: 1/1;
overflow: hidden;
border-radius: 0.75rem;
position: relative;
margin-top: -50px;
margin-bottom: 30px;
background: #f8fafc;
}
.marquee-content {
display: inline-block;
animation: marquee 20s linear infinite;
font-family: var(--font-heading);
font-weight: 700;
font-size: 1.5rem;
letter-spacing: 2px;
}
@keyframes marquee {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
}
/* Portfolio Cards */
.project-card {
border: 2px solid #000;
border-radius: var(--radius-card);
overflow: hidden;
background: #fff;
transition: transform 0.3s ease;
box-shadow: var(--shadow-hard);
.product-img {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
object-fit: contain;
padding: 15px;
transition: transform 0.5s ease;
}
.project-card:hover {
transform: translateY(-10px);
box-shadow: 8px 8px 0 #000;
.product-card:hover .product-img {
transform: scale(1.1);
}
.card-img-holder {
height: 250px;
.badge-hot {
position: absolute;
top: 10px;
right: 10px;
background: var(--primary-color);
color: white;
font-size: 0.7rem;
font-weight: 800;
padding: 4px 8px;
border-radius: 4px;
z-index: 2;
}
.price-tag {
font-size: 1.25rem;
font-weight: 800;
color: var(--primary-color);
}
.footer-link {
color: var(--text-muted);
text-decoration: none;
transition: all 0.3s ease;
display: block;
margin-bottom: 0.5rem;
}
.footer-link:hover {
color: var(--primary-color);
padding-left: 5px;
}
/* Carousel Custom Styles */
.carousel-item {
transition: transform 0.6s ease-in-out, opacity 0.6s ease-in-out;
}
.category-hover-card {
cursor: pointer;
}
.category-hover-card:hover {
background: rgba(255, 51, 153, 0.05) !important;
border-color: var(--primary-color);
}
.category-accent {
width: 4px;
height: 24px;
background: var(--primary-color);
border-radius: 2px;
display: inline-block;
}
.hover-primary:hover {
color: var(--primary-color) !important;
}
.floating-tg {
position: fixed;
bottom: 30px;
right: 30px;
z-index: 1000;
width: 60px;
height: 60px;
background: #0088cc;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border-bottom: 2px solid #000;
position: relative;
font-size: 4rem;
}
.placeholder-art {
transition: transform 0.3s ease;
}
.project-card:hover .placeholder-art {
transform: scale(1.2) rotate(10deg);
}
.bg-soft-blue { background-color: #e0f2fe; }
.bg-soft-green { background-color: #dcfce7; }
.bg-soft-purple { background-color: #f3e8ff; }
.bg-soft-yellow { background-color: #fef9c3; }
.category-tag {
position: absolute;
top: 15px;
right: 15px;
background: #000;
color: #fff;
padding: 5px 12px;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 700;
}
.card-body { padding: 1.5rem; }
.link-arrow {
font-size: 30px;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
transition: all 0.3s ease;
text-decoration: none;
color: #000;
font-weight: 700;
display: inline-flex;
align-items: center;
margin-top: auto;
}
.link-arrow i { transition: transform 0.2s; margin-left: 5px; }
.link-arrow:hover i { transform: translateX(5px); }
/* About */
.about-image-stack {
position: relative;
height: 400px;
width: 100%;
.floating-tg:hover {
transform: scale(1.1) rotate(10deg);
color: white;
}
.stack-card {
position: absolute;
width: 80%;
height: 100%;
border-radius: var(--radius-card);
border: 2px solid #000;
box-shadow: var(--shadow-hard);
left: 10%;
transform: rotate(-3deg);
background-size: cover;
.alert.glass-card {
background: white;
color: var(--text-dark) !important;
}
/* Forms */
.form-control {
border: 2px solid #000;
border-radius: 0.5rem;
padding: 1rem;
font-weight: 500;
background: #f8f9fa;
.text-white {
color: var(--text-dark) !important;
}
.form-control:focus {
box-shadow: 4px 4px 0 var(--color-primary);
border-color: #000;
background: #fff;
}
/* Animations */
.animate-up {
opacity: 0;
transform: translateY(30px);
animation: fadeUp 0.8s ease forwards;
}
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
@keyframes fadeUp {
to {
opacity: 1;
transform: translateY(0);
}
}
/* Social */
.social-links a {
transition: transform 0.2s;
display: inline-block;
}
.social-links a:hover {
transform: scale(1.2) rotate(10deg);
color: var(--color-accent) !important;
}
/* Responsive */
@media (max-width: 991px) {
.rotate-divider {
transform: rotate(0);
margin-top: 0;
margin-bottom: 2rem;
}
.hero-section {
padding-top: 120px;
text-align: center;
min-height: auto;
padding-bottom: 100px;
}
.display-1 { font-size: 3.5rem; }
.blob-1 { width: 300px; height: 300px; right: -20%; }
.blob-2 { width: 300px; height: 300px; left: -20%; }
.text-white-50 {
color: var(--text-muted) !important;
}

View File

@ -1,73 +1,103 @@
document.addEventListener('DOMContentLoaded', () => {
// Cart Management
function addToCart(id, name, price, img) {
let cart = JSON.parse(localStorage.getItem('cart') || '[]');
let found = cart.find(item => item.id === id);
// Smooth scrolling for navigation links
if (found) {
found.qty++;
} else {
cart.push({ id, name, price, qty: 1, img });
}
localStorage.setItem('cart', JSON.stringify(cart));
updateCartBadge();
showToast(`${name} 已加入购物车`);
}
function updateCartBadge() {
let cart = JSON.parse(localStorage.getItem('cart') || '[]');
let count = cart.reduce((acc, item) => acc + item.qty, 0);
let badge = document.getElementById('cart-badge');
if (badge) {
if (count > 0) {
badge.textContent = count;
badge.classList.remove('d-none');
} else {
badge.classList.add('d-none');
}
}
}
// Toast Notification
function showToast(message) {
let toastContainer = document.getElementById('toast-container');
if (!toastContainer) {
toastContainer = document.createElement('div');
toastContainer.id = 'toast-container';
toastContainer.className = 'position-fixed bottom-0 end-0 p-3';
toastContainer.style.zIndex = '9999';
document.body.appendChild(toastContainer);
}
const toastId = 'toast-' + Date.now();
const toastHtml = `
<div id="${toastId}" class="toast align-items-center text-white bg-primary border-0 shadow-lg" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body fw-bold">
<i class="bi bi-check-circle-fill me-2"></i> ${message}
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
`;
toastContainer.insertAdjacentHTML('beforeend', toastHtml);
const toastElement = document.getElementById(toastId);
const toast = new bootstrap.Toast(toastElement, { delay: 3000 });
toast.show();
toastElement.addEventListener('hidden.bs.toast', () => {
toastElement.remove();
});
}
// Initialize on load
document.addEventListener('DOMContentLoaded', function() {
updateCartBadge();
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
if (this.getAttribute('href') === '#') return;
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
// Close mobile menu if open
const navbarToggler = document.querySelector('.navbar-toggler');
const navbarCollapse = document.querySelector('.navbar-collapse');
if (navbarCollapse.classList.contains('show')) {
navbarToggler.click();
}
// Scroll with offset
const offset = 80;
const elementPosition = targetElement.getBoundingClientRect().top;
const offsetPosition = elementPosition + window.pageYOffset - offset;
window.scrollTo({
top: offsetPosition,
behavior: "smooth"
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth'
});
}
});
});
// Navbar scroll effect
const navbar = document.querySelector('.navbar');
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
navbar.classList.add('scrolled', 'shadow-sm', 'bg-white');
navbar.classList.remove('bg-transparent');
} else {
navbar.classList.remove('scrolled', 'shadow-sm', 'bg-white');
navbar.classList.add('bg-transparent');
}
});
// Intersection Observer for fade-up animations
// Add animation to cards on scroll
const observerOptions = {
threshold: 0.1,
rootMargin: "0px 0px -50px 0px"
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-up');
entry.target.style.opacity = "1";
observer.unobserve(entry.target); // Only animate once
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
// Select elements to animate (add a class 'reveal' to them in HTML if not already handled by CSS animation)
// For now, let's just make sure the hero animations run.
// If we want scroll animations, we'd add opacity: 0 to elements in CSS and reveal them here.
// Given the request, the CSS animation I added runs on load for Hero.
// Let's make the project cards animate in.
const projectCards = document.querySelectorAll('.project-card');
projectCards.forEach((card, index) => {
card.style.opacity = "0";
card.style.animationDelay = `${index * 0.1}s`;
document.querySelectorAll('.glass-card').forEach(card => {
card.style.opacity = '0';
card.style.transform = 'translateY(20px)';
card.style.transition = 'all 0.6s cubic-bezier(0.23, 1, 0.32, 1)';
observer.observe(card);
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 KiB

153
cart.php Normal file
View File

@ -0,0 +1,153 @@
<?php
$page_title = '购物车 - 豪软世界';
require_once 'includes/header.php';
?>
<main class="py-5">
<div class="container">
<h1 class="fw-bold text-white mb-5 d-flex align-items-center gap-3">
<i class="bi bi-bag-check text-primary"></i> 您的购物车
</h1>
<div id="cart-container" class="row g-5">
<div class="col-lg-8">
<div class="bg-dark bg-opacity-50 rounded-5 border border-secondary border-opacity-25 overflow-hidden">
<div class="table-responsive">
<table class="table table-dark table-hover mb-0 align-middle">
<thead class="bg-white bg-opacity-5">
<tr>
<th class="ps-4 py-4 border-0">商品信息</th>
<th class="py-4 border-0">单价</th>
<th class="py-4 border-0">数量</th>
<th class="py-4 border-0">小计</th>
<th class="pe-4 py-4 border-0 text-end">操作</th>
</tr>
</thead>
<tbody id="cart-items-body">
<!-- JS will populate this -->
</tbody>
</table>
</div>
<div id="empty-cart-msg" class="p-5 text-center" style="display:none;">
<i class="bi bi-cart-x fs-1 text-muted d-block mb-3"></i>
<h5 class="text-white">购物车空空如也</h5>
<p class="text-muted">快去选购您心仪的软件吧!</p>
<a href="/" class="btn btn-primary mt-3">前往商城</a>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="bg-dark bg-opacity-50 rounded-5 border border-secondary border-opacity-25 p-4 sticky-top" style="top: 100px; z-index: 10;">
<h5 class="text-white fw-bold mb-4">订单摘要</h5>
<div class="d-flex justify-content-between mb-3">
<span class="text-muted">商品总数</span>
<span class="text-white fw-bold" id="summary-count">0</span>
</div>
<div class="d-flex justify-content-between mb-4">
<span class="text-muted">支付币种</span>
<span class="text-primary fw-bold">USDT (TRC20)</span>
</div>
<hr class="border-secondary opacity-25 mb-4">
<div class="d-flex justify-content-between align-items-end mb-5">
<span class="text-white">应付总额</span>
<div class="text-end">
<div class="fs-2 fw-black text-primary" id="summary-total">0.00</div>
<div class="text-muted small">含支付手续费 0.00</div>
</div>
</div>
<a href="checkout.php" id="checkout-btn" class="btn btn-primary btn-lg w-100 py-3 rounded-3 shadow mb-3">
<i class="bi bi-credit-card me-2"></i> 立即下单
</a>
<div class="text-center">
<img src="https://placehold.co/200x40/0f172a/94a3b8?text=TRUSTED+PAYMENTS" alt="Trusted" class="grayscale opacity-50">
</div>
</div>
</div>
</div>
</div>
</main>
<script>
document.addEventListener('DOMContentLoaded', function() {
renderCart();
});
function renderCart() {
const cart = JSON.parse(localStorage.getItem('cart') || '[]');
const body = document.getElementById('cart-items-body');
const emptyMsg = document.getElementById('empty-cart-msg');
const checkoutBtn = document.getElementById('checkout-btn');
if (cart.length === 0) {
body.innerHTML = '';
emptyMsg.style.display = 'block';
checkoutBtn.classList.add('disabled');
updateSummary(0, 0);
return;
}
emptyMsg.style.display = 'none';
checkoutBtn.classList.remove('disabled');
let html = '';
let total = 0;
let count = 0;
cart.forEach((item, index) => {
const subtotal = item.price * item.qty;
total += subtotal;
count += parseInt(item.qty);
html += `
<tr class="border-bottom border-secondary border-opacity-10">
<td class="ps-4 py-4">
<div class="d-flex align-items-center gap-3">
<div class="text-white fw-bold">${item.name}</div>
</div>
</td>
<td class="py-4 text-primary fw-bold">${parseFloat(item.price).toFixed(2)}</td>
<td class="py-4">
<div class="d-flex align-items-center bg-black bg-opacity-25 rounded-2 border border-secondary border-opacity-25" style="width: fit-content;">
<button class="btn btn-link text-white p-2" onclick="updateQty(${index}, -1)"><i class="bi bi-dash"></i></button>
<span class="px-2 text-white fw-bold">${item.qty}</span>
<button class="btn btn-link text-white p-2" onclick="updateQty(${index}, 1)"><i class="bi bi-plus"></i></button>
</div>
</td>
<td class="py-4 text-white fw-bold">${subtotal.toFixed(2)}</td>
<td class="pe-4 py-4 text-end">
<button class="btn btn-link text-danger p-0" onclick="removeItem(${index})"><i class="bi bi-trash fs-5"></i></button>
</td>
</tr>
`;
});
body.innerHTML = html;
updateSummary(count, total);
}
function updateQty(index, delta) {
let cart = JSON.parse(localStorage.getItem('cart') || '[]');
cart[index].qty = parseInt(cart[index].qty) + delta;
if (cart[index].qty < 1) cart[index].qty = 1;
localStorage.setItem('cart', JSON.stringify(cart));
renderCart();
updateCartBadge();
}
function removeItem(index) {
let cart = JSON.parse(localStorage.getItem('cart') || '[]');
cart.splice(index, 1);
localStorage.setItem('cart', JSON.stringify(cart));
renderCart();
updateCartBadge();
}
function updateSummary(count, total) {
document.getElementById('summary-count').textContent = count;
document.getElementById('summary-total').textContent = total.toFixed(2);
}
</script>
<?php require_once 'includes/footer.php'; ?>

57
category.php Normal file
View File

@ -0,0 +1,57 @@
<?php
include 'includes/header.php';
$id = $_GET['id'] ?? 0;
$stmt = db()->prepare("SELECT * FROM categories WHERE id = ?");
$stmt->execute([$id]);
$cat = $stmt->fetch();
if (!$cat) {
header("Location: index.php");
exit;
}
// Fetch products for this category
$stmt = db()->prepare("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.category_id = ? ORDER BY p.id DESC");
$stmt->execute([$id]);
$cat_products = $stmt->fetchAll();
?>
<div class="row mb-5 align-items-center">
<div class="col-md-6">
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-2">
<li class="breadcrumb-item"><a href="index.php" class="text-decoration-none text-muted">首页</a></li>
<li class="breadcrumb-item active text-dark" aria-current="page"><?php echo htmlspecialchars($cat['name']); ?></li>
</ol>
</nav>
<h1 class="fw-bold text-dark mb-0 d-flex align-items-center gap-3">
<i class="bi <?php echo $cat['icon'] ?? 'bi-grid'; ?> text-primary"></i>
<?php echo htmlspecialchars($cat['name']); ?>
</h1>
</div>
<div class="col-md-6 text-md-end mt-3 mt-md-0">
<span class="badge bg-primary bg-opacity-10 text-primary rounded-pill px-4 py-2 border border-primary border-opacity-25"><?php echo count($cat_products); ?> 个商品</span>
</div>
</div>
<div class="row g-4">
<?php if (empty($cat_products)): ?>
<div class="col-12 text-center py-5">
<div class="glass-card p-5 bg-white shadow-sm">
<i class="bi bi-inbox fs-1 text-muted d-block mb-3"></i>
<h4 class="text-dark">暂无相关商品</h4>
<p class="text-muted">我们正在紧急补货中,请稍后再来。</p>
<a href="index.php" class="btn btn-primary mt-3 px-5 rounded-pill">返回首页</a>
</div>
</div>
<?php else: ?>
<?php foreach ($cat_products as $product): ?>
<div class="col-6 col-lg-3">
<?php include 'includes/product_card.php'; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php include 'includes/footer.php'; ?>

136
checkout.php Normal file
View File

@ -0,0 +1,136 @@
<?php
$page_title = '提交订单 - 豪软世界';
require_once 'includes/header.php';
// Handle direct purchase from product.php
$direct_id = $_GET['direct_id'] ?? null;
// Handle POST request to create order
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$db = db();
$payment_method = $_POST['payment_method'] ?? 'USDT (TRC20)';
$cart_data = json_decode($_POST['cart_data'], true);
if (empty($cart_data)) {
header("Location: cart.php");
exit;
}
// Calculate total
$total = 0;
foreach ($cart_data as $item) {
$total += $item['price'] * $item['qty'];
}
// Generate order number
$order_no = 'HR' . date('YmdHis') . rand(100, 999);
// Create order - contact_info is now optional or empty
$stmt = $db->prepare("INSERT INTO orders (order_no, total_amount, payment_method, contact_info, status) VALUES (?, ?, ?, '', 'pending')");
$stmt->execute([$order_no, $total, $payment_method]);
$order_id = $db->lastInsertId();
// Create order items
foreach ($cart_data as $item) {
$stmt = $db->prepare("INSERT INTO order_items (order_id, product_id, quantity, price_usdt) VALUES (?, ?, ?, ?)");
$stmt->execute([$order_id, $item['id'], $item['qty'], $item['price']]);
}
// Redirect to payment
header("Location: payment.php?order_no=" . $order_no);
exit;
}
?>
<main class="py-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-6">
<div class="glass-card p-5 bg-white shadow-sm">
<h2 class="fw-bold text-dark mb-4"><i class="bi bi-file-earmark-text text-primary me-2"></i> 确认订单信息</h2>
<p class="text-muted mb-5">请核对您的订单商品,确认无误后点击下方按钮进入支付页面。</p>
<form id="checkout-form" method="POST">
<input type="hidden" name="cart_data" id="cart-data-input">
<div class="mb-5">
<label class="form-label text-dark fw-bold">支付方式</label>
<div class="row g-3">
<div class="col-12">
<div class="payment-option p-4 rounded-4 border border-primary bg-primary bg-opacity-10 d-flex align-items-center gap-3">
<i class="bi bi-currency-bitcoin fs-2 text-primary"></i>
<div>
<div class="text-dark fw-bold fs-5">USDT (TRC20)</div>
<div class="text-muted small">推荐使用,区块链自动确认</div>
</div>
<i class="bi bi-check-circle-fill ms-auto text-primary fs-4"></i>
</div>
<input type="hidden" name="payment_method" value="USDT (TRC20)">
</div>
</div>
</div>
<div class="order-summary-box mb-5 p-4 bg-light rounded-4">
<h6 class="text-dark fw-bold mb-4">订单详情</h6>
<div id="checkout-items-list">
<!-- JS Populated -->
</div>
<hr class="my-4">
<div class="d-flex justify-content-between align-items-center">
<span class="text-dark fw-bold">应付总额</span>
<span class="fs-2 fw-bold text-primary" id="checkout-total">0.00 USDT</span>
</div>
</div>
<button type="submit" class="btn btn-primary btn-lg w-100 py-3 rounded-pill shadow-lg fw-bold">
确认下单并去支付 <i class="bi bi-arrow-right ms-2"></i>
</button>
</form>
</div>
</div>
</div>
</div>
</main>
<script>
document.addEventListener('DOMContentLoaded', function() {
let cart = JSON.parse(localStorage.getItem('cart') || '[]');
// If direct purchase from product.php
<?php if ($direct_id): ?>
// If coming from direct_id, we might want to override cart for this session or just add it
// For simplicity, let's assume the user already clicked "Add to Cart" or we fetch product details
// In this app, we'll fetch from the DOM or just rely on the cart if addToCart was called.
// If cart is empty, we should probably handle it.
<?php endif; ?>
if (cart.length === 0) {
window.location.href = 'index.php';
return;
}
document.getElementById('cart-data-input').value = JSON.stringify(cart);
let html = '';
let total = 0;
cart.forEach(item => {
const subtotal = item.price * item.qty;
total += subtotal;
html += `
<div class="d-flex justify-content-between text-muted mb-3 fs-6">
<span>${item.name} <span class="badge bg-secondary bg-opacity-10 text-secondary ms-2">x${item.qty}</span></span>
<span class="text-dark fw-bold">${subtotal.toFixed(2)} USDT</span>
</div>
`;
});
document.getElementById('checkout-items-list').innerHTML = html;
document.getElementById('checkout-total').textContent = total.toFixed(2) + ' USDT';
});
</script>
<style>
.payment-option { border-width: 2px !important; }
</style>
<?php require_once 'includes/footer.php'; ?>

View File

@ -0,0 +1,31 @@
-- Clean up existing data to avoid duplicates if re-run
DELETE FROM products;
DELETE FROM categories;
-- Categories
INSERT INTO categories (id, name, icon) VALUES
(1, '社交账号', 'bi-people-fill'),
(2, '海外社交', 'bi-globe-central-south-asia'),
(3, 'AI办公', 'bi-cpu-fill'),
(4, '邮箱工具', 'bi-envelope-at-fill'),
(5, '游戏专区', 'bi-controller');
-- Products
INSERT INTO products (name, category_id, description, content, price_usdt, stock, image_url, is_hot) VALUES
('Discord 满月老号', 2, '高权重/已过验证', 'Discord 满月老号,纯手工注册,权重极高。已绑定海外手机号并完成邮箱验证。适合加入各种大群、使用各种机器人,不容易被封。发货格式:账号----密码----Token', 5.00, 999, 'https://cdn-icons-png.flaticon.com/512/3670/3670157.png', 1),
('TikTok 权重号', 2, '千粉/直播权限', 'TikTok 优质权重老号拥有1000+真实粉丝,已开通直播权限。适合引流、卖货。包含注册邮箱原始密码。发货格式:账号----密码----邮箱----邮箱密码', 15.00, 50, 'https://cdn-icons-png.flaticon.com/512/3046/3046121.png', 1),
('ChatGPT Plus 共享号', 3, 'GPT-4o/稳定独享', 'ChatGPT Plus 会员共享号,支持最新的 GPT-4o 模型DALL-E 3 生成图片。稳定不掉线,封号包赔。发货格式:邮箱----密码----Token', 10.00, 100, 'https://cdn-icons-png.flaticon.com/512/12222/12222588.png', 1),
('小红书 优质老号', 1, '带粉/无违规', '小红书优质权重账号,注册时间长,无任何违规记录。适合做博主、引流。', 8.00, 200, 'https://placehold.co/400x400/ff2442/ffffff?text=Xiaohongshu', 1),
('抖音 权重老号', 1, '实名/可直播', '抖音实名优质号,高权重,搜索排名靠前。', 12.00, 100, 'https://placehold.co/400x400/000000/ffffff?text=Douyin', 1),
('Instagram 极品老号', 2, '带粉丝/发帖稳', 'Instagram 2-5年老号带少量粉丝权重极高发帖不容易被屏蔽。', 6.00, 300, 'https://cdn-icons-png.flaticon.com/512/174/174855.png', 0),
('Telegram 协议号', 2, 'API/Hash格式', 'TG 协议号,支持各路协议软件登录。', 3.00, 5000, 'https://cdn-icons-png.flaticon.com/512/2111/2111646.png', 1),
('WhatsApp 活跃号', 2, '直登号/耐用', 'WhatsApp 长期活跃号,不容易封禁。', 4.50, 1000, 'https://cdn-icons-png.flaticon.com/512/733/733585.png', 0),
('WeChat 微信老号', 1, '稳定/不封号', '微信老号,已过实名,朋友圈活跃。', 25.00, 20, 'https://cdn-icons-png.flaticon.com/512/733/733585.png', 1),
('QQ 极品老号', 1, '等级高/带Q币', 'QQ 10年老号皇冠等级适合收藏。', 18.00, 10, 'https://cdn-icons-png.flaticon.com/512/3536/3536647.png', 0),
('Gmail 优质新号', 4, '独享/带辅助', 'Gmail 全新号,独享注册,带辅助邮箱。', 1.50, 2000, 'https://cdn-icons-png.flaticon.com/512/281/281769.png', 0),
('Outlook 混合号', 4, '便宜/量大', 'Outlook 邮箱,适合批量注册。', 0.50, 10000, 'https://cdn-icons-png.flaticon.com/512/732/732200.png', 0),
('Snapchat 满月号', 2, '高权重/耐封', 'Snapchat 满月账号,高权重。', 4.00, 500, 'https://cdn-icons-png.flaticon.com/512/3670/3670174.png', 0),
('LINE 台湾/日本号', 2, '已验证/直登', 'LINE 账号,已完成手机验证。', 7.00, 100, 'https://cdn-icons-png.flaticon.com/512/124/124025.png', 0),
('知乎 权重号', 1, '高质量/老号', '知乎高质量账号,适合引流。', 5.50, 200, 'https://placehold.co/400x400/0084ff/ffffff?text=Zhihu', 0),
('豆瓣小组 进群号', 1, '免审/高活跃', '豆瓣老号,已进各种大组,权重高。', 6.50, 150, 'https://placehold.co/400x400/00b51d/ffffff?text=Douban', 0),
('Amino 活跃号', 2, '全球版/稳定', 'Amino 账号,稳定耐用。', 4.00, 300, 'https://placehold.co/400x400/121212/ffffff?text=Amino', 0);

77
faq.php Normal file
View File

@ -0,0 +1,77 @@
<?php
include 'includes/header.php';
?>
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="text-center mb-5">
<h1 class="display-3 fw-bold">常见问题</h1>
<p class="text-muted fs-5">您可能遇到的一些疑问,我们在这里为您解答</p>
</div>
<div class="glass-card p-5">
<div class="accordion accordion-flush bg-transparent" id="faqAccordion">
<div class="accordion-item bg-transparent border-bottom border-secondary py-3">
<h2 class="accordion-header">
<button class="accordion-button collapsed bg-transparent text-white fs-4 fw-semibold" type="button" data-bs-toggle="collapse" data-bs-target="#faq1">
付款后在哪里查看卡密?
</button>
</h2>
<div id="faq1" class="accordion-collapse collapse" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted lh-lg">
支付成功后,系统会自动跳转到订单详情页显示卡密。如果您不小心关闭了页面,可以通过页面顶部的“订单查询”功能,输入您的订单号随时找回卡密。
</div>
</div>
</div>
<div class="accordion-item bg-transparent border-bottom border-secondary py-3">
<h2 class="accordion-header">
<button class="accordion-button collapsed bg-transparent text-white fs-4 fw-semibold" type="button" data-bs-toggle="collapse" data-bs-target="#faq2">
为什么我支付了却没有发货?
</button>
</h2>
<div id="faq2" class="accordion-collapse collapse" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted lh-lg">
通常是因为区块链确认延迟或者支付金额不匹配。请确保您支付的是精确的金额。如果 10 分钟后仍未发货,请截图您的支付记录联系我们的 Telegram 客服。
</div>
</div>
</div>
<div class="accordion-item bg-transparent border-bottom border-secondary py-3">
<h2 class="accordion-header">
<button class="accordion-button collapsed bg-transparent text-white fs-4 fw-semibold" type="button" data-bs-toggle="collapse" data-bs-target="#faq3">
账号登录不上怎么办?
</button>
</h2>
<div id="faq3" class="accordion-collapse collapse" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted lh-lg">
首先请检查您的网络环境(是否使用了干净的代理 IP。如果确认是账号问题请在购买后 24 小时内联系客服进行更换。请勿在同一个 IP 下大量登录账号,这会触发官方风控。
</div>
</div>
</div>
<div class="accordion-item bg-transparent border-bottom border-secondary py-3">
<h2 class="accordion-header">
<button class="accordion-button collapsed bg-transparent text-white fs-4 fw-semibold" type="button" data-bs-toggle="collapse" data-bs-target="#faq4">
可以定制大批量的账号吗?
</button>
</h2>
<div id="faq4" class="accordion-collapse collapse" data-bs-parent="#faqAccordion">
<div class="accordion-body text-muted lh-lg">
可以。如果您有大批量、长期稳定的供货需求,请直接联系我们的 TG 商务,我们将为您提供更具竞争力的批发价格和定制化服务。
</div>
</div>
</div>
</div>
<div class="mt-5 text-center p-4 rounded-4" style="background: rgba(0, 242, 255, 0.05);">
<p class="text-white mb-4 fs-5">没找到您要的答案?</p>
<a href="<?php echo $settings['tg_support'] ?? '#'; ?>" class="btn btn-primary px-5 py-3 rounded-pill">咨询在线客服</a>
</div>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>

53
help.php Normal file
View File

@ -0,0 +1,53 @@
<?php
include 'includes/header.php';
?>
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="text-center mb-5">
<h1 class="display-3 fw-bold">帮助中心</h1>
<p class="text-muted fs-5">手把手教您如何高效、安全地使用我们的服务</p>
</div>
<div class="row g-4">
<div class="col-md-6">
<div class="glass-card p-5 h-100">
<div class="d-flex align-items-center mb-4">
<i class="bi bi-person-plus-fill fs-1 text-primary me-3"></i>
<h3 class="text-white mb-0">新手入门</h3>
</div>
<ul class="list-unstyled text-muted lh-lg">
<li class="mb-3"><i class="bi bi-check2-circle text-primary me-2"></i> <strong>环境准备:</strong> 使用账号前请确保代理 IP 纯净。</li>
<li class="mb-3"><i class="bi bi-check2-circle text-primary me-2"></i> <strong>购买流程:</strong> 选择商品 -> 填写联系方式 -> 扫码支付。</li>
<li class="mb-3"><i class="bi bi-check2-circle text-primary me-2"></i> <strong>提取卡密:</strong> 支付后网页自动弹出,或使用订单查询。</li>
</ul>
</div>
</div>
<div class="col-md-6">
<div class="glass-card p-5 h-100">
<div class="d-flex align-items-center mb-4">
<i class="bi bi-shield-lock-fill fs-1 text-success me-3"></i>
<h3 class="text-white mb-0">安全建议</h3>
</div>
<ul class="list-unstyled text-muted lh-lg">
<li class="mb-3"><i class="bi bi-check2-circle text-success me-2"></i> <strong>即买即改:</strong> 拿到账号后请第一时间修改密码和密保。</li>
<li class="mb-3"><i class="bi bi-check2-circle text-success me-2"></i> <strong>指纹浏览器:</strong> 批量登录建议使用 AdsPower 或比特浏览器。</li>
<li class="mb-3"><i class="bi bi-check2-circle text-success me-2"></i> <strong>避免并发:</strong> 刚登录的老号请勿立即群发信息。</li>
</ul>
</div>
</div>
<div class="col-md-12">
<div class="glass-card p-5">
<h3 class="text-white mb-4">关于发货</h3>
<p class="text-muted lh-lg mb-4">我们的平台采用 <strong class="text-white">API 直连支付系统</strong> <strong class="text-white">全自动库存发货系统</strong>。无论是在深夜还是凌晨,只要您完成支付,系统都会在确认到账后的 30 秒内通过页面展示和后台记录双向交付。如果您在支付过程中遇到断网、浏览器崩溃,也不必担心,只需记录下您的订单号,通过“订单查询”即可找回。</p>
<div class="alert bg-black border-secondary p-4 d-flex align-items-center mb-0">
<i class="bi bi-info-circle-fill text-info fs-3 me-3"></i>
<span class="text-muted">提示:如果长时间未收到卡密,请检查您的钱包是否已经完成区块确认,或直接联系右侧客服咨询。</span>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>

74
includes/footer.php Normal file
View File

@ -0,0 +1,74 @@
</div> <!-- end container mt-4 from header -->
<footer class="mt-5 pt-5 pb-4 border-top border-light bg-white">
<div class="container">
<div class="row g-4">
<div class="col-lg-4">
<a class="navbar-brand d-flex align-items-center mb-3" href="index.php">
<div class="site-logo">
<i class="bi bi-globe-americas"></i>
<i class="bi bi-airplane-fill"></i>
</div>
<span class="fw-bold"><?php echo $site_name; ?></span>
</a>
<p class="text-muted small pe-lg-5">
我们提供全球优质软件账号服务,支持 24 小时自动发货,质保无忧。
</p>
<div class="mt-3">
<a href="<?php echo $tg_link; ?>" target="_blank" class="btn btn-primary rounded-pill px-4">
<i class="bi bi-telegram me-2"></i> 联系客服
</a>
</div>
</div>
<div class="col-6 col-lg-2">
<h6 class="text-dark fw-bold mb-3">产品中心</h6>
<a href="category.php?id=1" class="footer-link">社交账号</a>
<a href="category.php?id=2" class="footer-link">海外社交</a>
<a href="category.php?id=3" class="footer-link">AI 办公</a>
<a href="category.php?id=4" class="footer-link">邮箱工具</a>
</div>
<div class="col-6 col-lg-2">
<h6 class="text-dark fw-bold mb-3">用户支持</h6>
<a href="orders.php" class="footer-link">订单查询</a>
<a href="help.php" class="footer-link">帮助中心</a>
<a href="faq.php" class="footer-link">常见问题</a>
<a href="policy.php" class="footer-link">服务协议</a>
</div>
<div class="col-lg-4">
<h6 class="text-dark fw-bold mb-3">联系我们</h6>
<p class="text-muted small mb-2">
<i class="bi bi-telegram text-primary me-2"></i> 官方客服:<a href="<?php echo $tg_link; ?>" class="text-decoration-none text-primary fw-bold" target="_blank">@zhangshihao818</a>
</p>
<p class="text-muted small mb-2">
<i class="bi bi-envelope text-primary me-2"></i> 售后邮箱support@hao-soft.world
</p>
<div class="mt-4">
<img src="https://img.shields.io/badge/USDT-Accepted-blue?style=flat-square&logo=tether" alt="USDT">
<img src="https://img.shields.io/badge/Security-Protected-green?style=flat-square&logo=bitdefender" alt="Security">
</div>
</div>
</div>
<hr class="my-4 border-light">
<div class="row align-items-center">
<div class="col-md-6 text-center text-md-start">
<p class="text-muted small mb-0">&copy; <?php echo date('Y'); ?> <?php echo $site_name; ?>. All rights reserved.</p>
</div>
<div class="col-md-6 text-center text-md-end mt-2 mt-md-0">
<a href="#" class="text-muted small text-decoration-none me-3">隐私权政策</a>
<a href="#" class="text-muted small text-decoration-none">退款政策</a>
</div>
</div>
</div>
</footer>
<!-- Floating TG Button -->
<a href="<?php echo $tg_link; ?>" target="_blank" class="floating-tg">
<i class="bi bi-send-fill"></i>
</a>
<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>

105
includes/header.php Normal file
View File

@ -0,0 +1,105 @@
<?php
require_once __DIR__ . '/../db/config.php';
session_start();
// Fetch site settings
try {
$stmt = db()->query("SELECT key_name, key_value FROM settings");
$settings = $stmt->fetchAll(PDO::FETCH_KEY_PAIR);
} catch (Exception $e) {
$settings = [
'site_name' => '豪软世界',
'tg_support' => 'https://t.me/zhangshihao818'
];
}
$site_name = $settings['site_name'] ?? '豪软世界';
$tg_link = $settings['tg_support'] ?? 'https://t.me/zhangshihao818';
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $site_name; ?> - 全球专业软件服务商</title>
<!-- Favicon -->
<link rel="icon" type="image/png" href="assets/pasted-20260208-082111-302e08e2.png">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap" rel="stylesheet">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<style>
.site-logo-img {
height: 40px;
width: auto;
margin-right: 12px;
border-radius: 8px;
}
.navbar-brand {
font-weight: 800;
font-size: 1.5rem;
color: #333 !important;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg sticky-top navbar-light">
<div class="container">
<a class="navbar-brand d-flex align-items-center" href="index.php">
<img src="assets/pasted-20260208-082111-302e08e2.png" alt="Logo" class="site-logo-img">
<?php echo $site_name; ?>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="index.php">网站首页</a>
</li>
<li class="nav-item">
<a class="nav-link" href="orders.php">订单查询</a>
</li>
<li class="nav-item">
<a class="nav-link" href="help.php">帮助中心</a>
</li>
<li class="nav-item">
<a class="nav-link" href="faq.php">常见问题</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo $tg_link; ?>" target="_blank">联系客服</a>
</li>
</ul>
<form class="d-flex search-container me-3" action="search.php" method="GET">
<input class="form-control me-2" type="search" name="q" placeholder="搜索软件、账号..." aria-label="Search">
<button class="btn btn-outline-primary" type="submit"><i class="bi bi-search"></i></button>
</form>
<div class="d-flex align-items-center">
<a href="cart.php" class="btn btn-outline-primary position-relative me-3">
<i class="bi bi-cart3"></i>
<span id="cart-badge" class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger d-none">
0
</span>
</a>
<?php if (isset($_SESSION['admin_logged_in'])): ?>
<a href="admin/index.php" class="btn btn-sm btn-outline-dark">后台管理</a>
<?php else: ?>
<a href="login.php" class="btn btn-sm btn-outline-dark">登录</a>
<?php endif; ?>
</div>
</div>
</div>
</nav>
<div class="container mt-4">
<?php if (isset($settings['notice']) && !empty($settings['notice'])): ?>
<div class="alert glass-card mb-4 border-0 py-3 d-flex align-items-center bg-white shadow-sm" role="alert">
<i class="bi bi-megaphone-fill me-3 fs-4" style="color: var(--primary-color);"></i>
<div class="text-dark"><?php echo $settings['notice']; ?></div>
</div>
<?php endif; ?>

View File

@ -0,0 +1,25 @@
.site-logo {
width: 40px;
height: 40px;
background: linear-gradient(135deg, #ff3399, #ff007a);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 10px;
position: relative;
box-shadow: 0 0 10px rgba(255, 51, 153, 0.5);
}
.site-logo .bi-globe-americas {
color: white;
font-size: 22px;
}
.site-logo .bi-airplane-fill {
color: #00f2ff;
font-size: 14px;
position: absolute;
top: 5px;
right: 5px;
transform: rotate(45deg);
text-shadow: 0 0 5px rgba(0, 242, 255, 0.8);
}

24
includes/product_card.php Normal file
View File

@ -0,0 +1,24 @@
<div class="glass-card p-3 product-card h-100 d-flex flex-column bg-white">
<div class="product-img-container mb-3">
<a href="product.php?id=<?php echo $product['id']; ?>">
<img src="<?php echo $product['image_url']; ?>" class="product-img" alt="<?php echo $product['name']; ?>">
<?php if (isset($product['is_hot']) && $product['is_hot']): ?>
<span class="badge-hot">HOT</span>
<?php endif; ?>
</a>
</div>
<div class="px-2 flex-grow-1 d-flex flex-column">
<span class="text-muted small"><?php echo $product['category_name'] ?? ''; ?></span>
<h5 class="text-dark mb-3">
<a href="product.php?id=<?php echo $product['id']; ?>" class="text-dark text-decoration-none hover-primary fw-bold">
<?php echo $product['name']; ?>
</a>
</h5>
<div class="mt-auto d-flex justify-content-between align-items-center">
<span class="price-tag"><?php echo $product['price_usdt']; ?> <small class="small">USDT</small></span>
<button class="btn btn-sm btn-outline-primary rounded-circle" onclick="addToCart(<?php echo $product['id']; ?>, '<?php echo addslashes($product['name']); ?>', <?php echo $product['price_usdt']; ?>, '<?php echo $product['image_url']; ?>')">
<i class="bi bi-cart-plus"></i>
</button>
</div>
</div>
</div>

342
index.php
View File

@ -1,150 +1,200 @@
<?php
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
include 'includes/header.php';
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
// Fetch site settings (already in header, but ensuring db connection)
$db = db();
// Fetch hot products (Popular Recommendations) - 8 items
$hot_products = $db->query("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.is_hot = 1 LIMIT 8")->fetchAll();
// Function to fetch products by category ID with limit
function getProductsByCategory($db, $cat_id, $limit) {
$stmt = $db->prepare("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.category_id = :cat_id LIMIT :limit");
$stmt->bindValue(':cat_id', $cat_id, PDO::PARAM_INT);
$stmt->bindValue(':limit', $limit, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetchAll();
}
$social_accounts = getProductsByCategory($db, 1, 8);
$overseas_social = getProductsByCategory($db, 2, 8);
$ai_office = getProductsByCategory($db, 3, 4);
$email_tools = getProductsByCategory($db, 4, 4);
$categories = $db->query("SELECT * FROM categories")->fetchAll();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<!-- Open Graph meta tags -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
</head>
<body>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
</div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
</div> <!-- Close the container opened in header.php -->
<!-- Full Width Carousel Section -->
<div id="heroCarousel" class="carousel slide carousel-fade mb-5 shadow-sm overflow-hidden" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#heroCarousel" data-bs-slide-to="0" class="active" aria-current="true"></button>
<button type="button" data-bs-target="#heroCarousel" data-bs-slide-to="1"></button>
<button type="button" data-bs-target="#heroCarousel" data-bs-slide-to="2"></button>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
</body>
</html>
<div class="carousel-inner" style="height: 500px;">
<div class="carousel-item active" data-bs-interval="3000">
<div class="carousel-bg" style="background: linear-gradient(135deg, #fff0f5 0%, #ffe4e1 100%); width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative;">
<div class="position-absolute w-100 h-100" style="background: url('https://images.pexels.com/photos/1181244/pexels-photo-1181244.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2') center/cover; opacity: 0.15;"></div>
<div class="text-center position-relative px-3">
<h2 class="display-3 fw-bold text-dark mb-3">专业软件账号中心</h2>
<p class="fs-4 text-secondary mb-4">全球主流平台,即买即发,稳定质保</p>
<a href="#market" class="btn btn-primary btn-lg px-5 py-3 rounded-pill shadow">立即探索</a>
</div>
</div>
</div>
<div class="carousel-item" data-bs-interval="3000">
<div class="carousel-bg" style="background: linear-gradient(135deg, #e0f7fa 0%, #fff0f5 100%); width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative;">
<div class="position-absolute w-100 h-100" style="background: url('https://images.pexels.com/photos/546819/pexels-photo-546819.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2') center/cover; opacity: 0.15;"></div>
<div class="text-center position-relative px-3">
<h2 class="display-3 fw-bold text-dark mb-3">AI 办公提效神器</h2>
<p class="fs-4 text-secondary mb-4">ChatGPT, Midjourney 独享权限,开启智能时代</p>
<a href="category.php?id=3" class="btn btn-primary btn-lg px-5 py-3 rounded-pill shadow">立即升级</a>
</div>
</div>
</div>
<div class="carousel-item" data-bs-interval="3000">
<div class="carousel-bg" style="background: linear-gradient(135deg, #fffaf0 0%, #fff0f5 100%); width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative;">
<div class="position-absolute w-100 h-100" style="background: url('https://images.pexels.com/photos/3183150/pexels-photo-3183150.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2') center/cover; opacity: 0.15;"></div>
<div class="text-center position-relative px-3">
<h2 class="display-3 fw-bold text-dark mb-3">全自动 24H 交付</h2>
<p class="fs-4 text-secondary mb-4">下单后自动发货至订单页面,无需人工干预</p>
<a href="orders.php" class="btn btn-primary btn-lg px-5 py-3 rounded-pill shadow">查询订单</a>
</div>
</div>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#heroCarousel" data-bs-slide="prev">
<span class="carousel-control-prev-icon btn-dark rounded-circle" aria-hidden="true"></span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#heroCarousel" data-bs-slide="next">
<span class="carousel-control-next-icon btn-dark rounded-circle" aria-hidden="true"></span>
</button>
</div>
<div class="container"> <!-- Re-open the container -->
<!-- Categories Quick Links -->
<div class="row g-3 mb-5">
<?php foreach ($categories as $cat): ?>
<div class="col-6 col-md">
<a href="category.php?id=<?php echo $cat['id']; ?>" class="text-decoration-none">
<div class="glass-card p-4 text-center h-100 category-hover-card bg-white shadow-sm border-0">
<i class="bi <?php echo $cat['icon'] ?: 'bi-grid-fill'; ?> display-5 mb-3 d-block" style="color: var(--primary-color);"></i>
<h5 class="text-dark mb-0"><?php echo $cat['name']; ?></h5>
</div>
</a>
</div>
<?php endforeach; ?>
</div>
<div id="market">
<!-- Hot Products Section (8 items) -->
<div class="mb-5">
<div class="d-flex justify-content-between align-items-end mb-4">
<div>
<h2 class="h1 mb-0"><i class="bi bi-fire text-danger me-2"></i>热门推荐</h2>
<p class="text-muted">当前最畅销的高质量软件账号</p>
</div>
<a href="search.php" class="btn btn-outline-primary rounded-pill">查看全部</a>
</div>
<div class="row g-4">
<?php foreach ($hot_products as $product): ?>
<div class="col-6 col-lg-3">
<?php include 'includes/product_card.php'; ?>
</div>
<?php endforeach; ?>
</div>
</div>
<!-- Social Accounts (8 items) -->
<div class="mb-5">
<h3 class='text-dark mb-4 mt-5 d-flex align-items-center'><span class='category-accent me-3'></span> 社交账号</h3>
<div class="row g-4">
<?php foreach ($social_accounts as $product): ?>
<div class="col-6 col-lg-3">
<?php include 'includes/product_card.php'; ?>
</div>
<?php endforeach; ?>
</div>
</div>
<!-- Overseas Social (8 items) -->
<div class="mb-5">
<h3 class='text-dark mb-4 mt-5 d-flex align-items-center'><span class='category-accent me-3'></span> 海外社交</h3>
<div class="row g-4">
<?php foreach ($overseas_social as $product): ?>
<div class="col-6 col-lg-3">
<?php include 'includes/product_card.php'; ?>
</div>
<?php endforeach; ?>
</div>
</div>
<!-- AI Office (4 items) -->
<div class="mb-5">
<h3 class='text-dark mb-4 mt-5 d-flex align-items-center'><span class='category-accent me-3'></span> AI 办公</h3>
<div class="row g-4">
<?php foreach ($ai_office as $product): ?>
<div class="col-6 col-lg-3">
<?php include 'includes/product_card.php'; ?>
</div>
<?php endforeach; ?>
</div>
</div>
<!-- Email Tools (4 items) -->
<div class="mb-5">
<h3 class='text-dark mb-4 mt-5 d-flex align-items-center'><span class='category-accent me-3'></span> 邮箱工具</h3>
<div class="row g-4">
<?php foreach ($email_tools as $product): ?>
<div class="col-6 col-lg-3">
<?php include 'includes/product_card.php'; ?>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<!-- Trust Badges Section -->
<div class="row g-4 mt-5 pt-5 mb-5">
<div class="col-md-3">
<div class="text-center p-4">
<div class="bg-primary bg-opacity-10 rounded-circle d-inline-flex p-4 mb-3">
<i class="bi bi-lightning-charge fs-1 text-primary"></i>
</div>
<h4 class="text-dark">秒速发货</h4>
<p class="text-muted small">系统自动处理订单,即买即用无需等待。</p>
</div>
</div>
<div class="col-md-3">
<div class="text-center p-4">
<div class="bg-success bg-opacity-10 rounded-circle d-inline-flex p-4 mb-3">
<i class="bi bi-shield-check fs-1 text-success"></i>
</div>
<h4 class="text-dark">质量保障</h4>
<p class="text-muted small">所有账号均通过质保测试,安全稳定可靠。</p>
</div>
</div>
<div class="col-md-3">
<div class="text-center p-4">
<div class="bg-info bg-opacity-10 rounded-circle d-inline-flex p-4 mb-3">
<i class="bi bi-headset fs-1 text-info"></i>
</div>
<h4 class="text-dark">优质售后</h4>
<p class="text-muted small">7x24小时专业客服团队为您排忧解难。</p>
</div>
</div>
<div class="col-md-3">
<div class="text-center p-4">
<div class="bg-warning bg-opacity-10 rounded-circle d-inline-flex p-4 mb-3">
<i class="bi bi-currency-bitcoin fs-1 text-warning"></i>
</div>
<h4 class="text-dark">USDT 支付</h4>
<p class="text-muted small">支持主流加密货币支付,隐私安全有保障。</p>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>

77
login.php Normal file
View File

@ -0,0 +1,77 @@
<?php
require_once 'db/config.php';
session_start();
$db = db();
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'];
$password = $_POST['password'];
$stmt = $db->prepare("SELECT * FROM users WHERE username = ?");
$stmt->execute([$username]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password'])) {
$_SESSION['user_id'] = $user['id'];
$_SESSION['username'] = $user['username'];
$_SESSION['role'] = $user['role'];
if ($user['role'] === 'admin') {
header("Location: admin/index.php");
} else {
header("Location: index.php");
}
exit;
} else {
$error = '用户名或密码错误';
}
}
$page_title = '登录 - 豪软世界';
require_once 'includes/header.php';
?>
<main class="py-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-5">
<div class="bg-dark bg-opacity-50 rounded-5 border border-secondary border-opacity-25 p-5 shadow-lg">
<div class="text-center mb-5">
<div class="logo-box mx-auto mb-3" style="width: 50px; height: 50px; font-size: 1.8rem;">H</div>
<h2 class="text-white fw-bold">欢迎回来</h2>
<p class="text-muted">登录以管理您的订单和账户</p>
</div>
<?php if ($error): ?>
<div class="alert alert-danger bg-danger bg-opacity-10 border-0 text-danger rounded-4 small">
<i class="bi bi-exclamation-circle me-2"></i> <?php echo $error; ?>
</div>
<?php endif; ?>
<form method="POST">
<div class="mb-4">
<label class="form-label text-white small fw-bold">用户名</label>
<input type="text" name="username" class="form-control bg-black bg-opacity-50 border-secondary border-opacity-50 text-white p-3 rounded-3" placeholder="输入用户名" required>
</div>
<div class="mb-5">
<label class="form-label text-white small fw-bold">密码</label>
<input type="password" name="password" class="form-control bg-black bg-opacity-50 border-secondary border-opacity-50 text-white p-3 rounded-3" placeholder="输入密码" required>
</div>
<button type="submit" class="btn btn-primary btn-lg w-100 py-3 rounded-3 shadow mb-4">立即登录</button>
<div class="text-center">
<span class="text-muted small">还没有账号? <a href="register.php" class="text-primary text-decoration-none">立即注册</a></span>
</div>
</form>
</div>
<div class="text-center mt-4">
<div class="alert alert-info bg-info bg-opacity-10 border-0 text-info rounded-4 small py-2">
<i class="bi bi-info-circle me-1"></i> 测试账号: admin / admin123
</div>
</div>
</div>
</div>
</div>
</main>
<?php require_once 'includes/footer.php'; ?>

6
logout.php Normal file
View File

@ -0,0 +1,6 @@
<?php
session_start();
session_destroy();
header('Location: index.php');
exit;
?>

125
orders.php Normal file
View File

@ -0,0 +1,125 @@
<?php
include 'includes/header.php';
$search_order = null;
$error = '';
if (isset($_GET['order_no'])) {
$stmt = db()->prepare("SELECT * FROM orders WHERE order_no = ?");
$stmt->execute([$_GET['order_no']]);
$search_order = $stmt->fetch();
if (!$search_order) {
$error = '未找到该订单,请检查订单号是否正确';
} else {
$stmt = db()->prepare("SELECT oi.*, p.name FROM order_items oi JOIN products p ON oi.product_id = p.id WHERE oi.order_id = ?");
$stmt->execute([$search_order['id']]);
$search_order['items'] = $stmt->fetchAll();
}
}
?>
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="text-center mb-5">
<h1 class="display-4 fw-bold">订单查询</h1>
<p class="text-muted fs-5">输入您的订单号实时追踪订单状态与交付进度</p>
</div>
<div class="glass-card p-4 mb-5">
<form action="orders.php" method="GET" class="row g-3">
<div class="col-md-9">
<input type="text" name="order_no" class="form-control bg-dark border-secondary text-white p-3" placeholder="输入订单号 (例如: HR...)" value="<?php echo htmlspecialchars($_GET['order_no'] ?? ''); ?>" required>
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-primary btn-lg w-100 py-3">立即查询</button>
</div>
</form>
</div>
<?php if ($error): ?>
<div class="alert glass-card text-danger border-danger p-4 text-center">
<i class="bi bi-exclamation-triangle-fill fs-3 d-block mb-2"></i>
<?php echo $error; ?>
</div>
<?php endif; ?>
<?php if ($search_order): ?>
<div class="glass-card overflow-hidden">
<div class="p-4 border-bottom border-secondary d-flex justify-content-between align-items-center" style="background: rgba(0, 242, 255, 0.05);">
<div>
<span class="text-muted small d-block">订单编号</span>
<h5 class="text-white fw-bold mb-0"><?php echo $search_order['order_no']; ?></h5>
</div>
<div class="text-end">
<span class="text-muted small d-block">订单状态</span>
<span class="badge rounded-pill bg-<?php echo $search_order['status'] === 'completed' ? 'success' : ($search_order['status'] === 'pending' ? 'warning' : 'info'); ?> px-4 py-2">
<?php echo strtoupper($search_order['status']); ?>
</span>
</div>
</div>
<div class="p-4 p-lg-5">
<div class="table-responsive mb-5">
<table class="table table-dark table-borderless align-middle">
<thead class="border-bottom border-secondary">
<tr>
<th class="ps-0 py-3 text-muted">商品名称</th>
<th class="py-3 text-muted">数量</th>
<th class="py-3 text-muted text-end">小计</th>
</tr>
</thead>
<tbody>
<?php foreach ($search_order['items'] as $it): ?>
<tr>
<td class="ps-0 py-4 fw-bold text-white"><?php echo $it['name']; ?></td>
<td class="py-4 text-white"><?php echo $it['quantity']; ?></td>
<td class="py-4 text-end fw-bold text-primary"><?php echo $it['price_usdt'] * $it['quantity']; ?> USDT</td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr class="border-top border-secondary">
<td colspan="2" class="ps-0 py-4 text-white fs-4 fw-bold">订单总额</td>
<td class="py-4 text-end text-primary display-6 fw-bold"><?php echo $search_order['total_amount']; ?> USDT</td>
</tr>
</tfoot>
</table>
</div>
<div class="row g-4 mb-5">
<div class="col-md-6">
<div class="glass-card p-4 h-100">
<span class="text-muted small d-block mb-2">联系信息</span>
<div class="text-white fs-5"><?php echo htmlspecialchars($search_order['contact_info']); ?></div>
</div>
</div>
<div class="col-md-6">
<div class="glass-card p-4 h-100">
<span class="text-muted small d-block mb-2">下单时间</span>
<div class="text-white fs-5"><?php echo $search_order['created_at']; ?></div>
</div>
</div>
</div>
<?php if ($search_order['status'] === 'pending'): ?>
<div class="d-grid mb-4">
<a href="payment.php?order_no=<?php echo $search_order['order_no']; ?>" class="btn btn-primary btn-lg py-3">
<i class="bi bi-credit-card me-2"></i> 立即去支付
</a>
</div>
<?php endif; ?>
<div class="text-center">
<p class="text-muted mb-4">如果您对订单有任何疑问,请随时联系我们的客服。</p>
<a href="<?php echo $settings['tg_support'] ?? '#'; ?>?text=订单咨询: <?php echo $search_order['order_no']; ?>" target="_blank" class="btn btn-outline-info rounded-pill px-5">
<i class="bi bi-telegram me-2"></i> 联系客服
</a>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php include 'includes/footer.php'; ?>

146
payment.php Normal file
View File

@ -0,0 +1,146 @@
<?php
include 'includes/header.php';
$order_no = $_GET['order_no'] ?? '';
$db = db();
$stmt = $db->prepare("SELECT * FROM orders WHERE order_no = ?");
$stmt->execute([$order_no]);
$order = $stmt->fetch();
if (!$order) {
echo "<div class='container my-5 py-5 text-center'><div class='alert glass-card text-danger border-danger p-5'><i class='bi bi-exclamation-octagon display-1 d-block mb-4'></i><h2>订单不存在</h2><p>请检查您的订单号是否正确或联系客服。</p><a href='index.php' class='btn btn-primary mt-4'>返回首页</a></div></div>";
include 'includes/footer.php';
exit;
}
// Fetch total quantity
$stmt = $db->prepare("SELECT SUM(quantity) as total_qty FROM order_items WHERE order_id = ?");
$stmt->execute([$order['id']]);
$qty_data = $stmt->fetch();
$total_qty = $qty_data['total_qty'] ?? 1;
$usdt_address = $settings['usdt_address'] ?? 'Txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
?>
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="glass-card p-0 overflow-hidden bg-white shadow-lg border-0 rounded-4">
<div class="bg-primary bg-opacity-10 p-4 border-bottom d-flex justify-content-between align-items-center">
<h4 class="text-dark mb-0 fw-bold"><i class="bi bi-shield-lock-fill me-2 text-primary"></i>安全支付收银台</h4>
<div class="badge bg-primary px-4 py-2 rounded-pill fw-bold">USDT - TRC20</div>
</div>
<div class="p-4 p-lg-5">
<div class="row g-5">
<div class="col-lg-5 text-center">
<div class="p-4 rounded-4 d-inline-block border border-light bg-light mb-4">
<img src="https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=<?php echo urlencode($usdt_address); ?>" alt="QR Code" class="img-fluid" style="width: 250px;">
</div>
<div class="p-4 bg-light rounded-4 mb-4">
<label class="text-muted small d-block mb-2 fw-bold">支付倒计时</label>
<div id="countdown" class="display-4 fw-bold text-primary">60:00</div>
</div>
<p class="text-muted small"><i class="bi bi-info-circle me-1"></i> 请在倒计时结束前完成支付以保证订单有效</p>
</div>
<div class="col-lg-7">
<div class="mb-5 p-4 bg-light rounded-4">
<h5 class="text-dark fw-bold mb-4 border-bottom pb-3">订单信息</h5>
<div class="d-flex justify-content-between align-items-center mb-3">
<span class="text-muted">订单编号:</span>
<span class="text-dark fw-bold"><?php echo $order_no; ?></span>
</div>
<div class="d-flex justify-content-between align-items-center mb-3">
<span class="text-muted">商品数量:</span>
<span class="text-dark fw-bold"><?php echo $total_qty; ?> 件</span>
</div>
<div class="d-flex justify-content-between align-items-center pt-3 border-top mt-3">
<span class="text-dark fs-5 fw-bold">应付金额:</span>
<span class="display-5 fw-bold text-primary"><?php echo $order['total_amount']; ?> <small class="fs-4">USDT</small></span>
</div>
</div>
<div class="mb-5">
<h5 class="text-dark fw-bold mb-4">收款地址 (TRC20)</h5>
<div class="input-group input-group-lg">
<input type="text" id="usdtAddress" class="form-control bg-light border-0 text-dark p-4 font-monospace fs-6" value="<?php echo $usdt_address; ?>" readonly>
<button class="btn btn-primary px-4" onclick="copyAddress()">
<i class="bi bi-copy me-2"></i> 复制地址
</button>
</div>
</div>
<div class="p-4 rounded-4 border border-info border-opacity-10 bg-info bg-opacity-10 mb-5">
<h6 class="text-info fw-bold mb-3"><i class="bi bi-info-square-fill me-2"></i> 支付说明:</h6>
<ul class="text-muted small mb-0 ps-3 lh-lg">
<li>请务必使用 <strong class="text-primary">TRC20 (波场网络)</strong> 进行转账,暂不支持其他网络。</li>
<li>支付金额必须与订单金额 <strong class="text-primary">完全一致</strong> (<?php echo $order['total_amount']; ?> USDT),否则系统无法自动识别。</li>
<li>转账完成后,请点击下方的“已完成支付”按钮,联系客服确认发货。</li>
<li>区块确认通常需要 1-3 分钟,请耐心等待。</li>
<li>如需帮助,请提供订单号 <?php echo $order_no; ?> 给在线客服。</li>
</ul>
</div>
<div class="d-grid gap-3">
<button id="checkPaymentBtn" class="btn btn-primary btn-lg py-3 rounded-pill fw-bold shadow-lg">
<i class="bi bi-check-circle-fill me-2"></i> 我已完成支付,联系客服发货
</button>
<a href="index.php" class="btn btn-outline-secondary py-3 rounded-pill">
返回首页
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function copyAddress() {
var copyText = document.getElementById("usdtAddress");
copyText.select();
copyText.setSelectionRange(0, 99999);
navigator.clipboard.writeText(copyText.value);
const btn = document.querySelector('button[onclick="copyAddress()"]');
const originalText = btn.innerHTML;
btn.innerHTML = '<i class="bi bi-check2"></i> 已复制';
btn.classList.replace('btn-primary', 'btn-success');
setTimeout(() => {
btn.innerHTML = originalText;
btn.classList.replace('btn-success', 'btn-primary');
}, 2000);
}
// Countdown Timer
let timeLeft = 60 * 60; // 60 minutes
const countdownEl = document.getElementById('countdown');
const timer = setInterval(() => {
const minutes = Math.floor(timeLeft / 60);
let seconds = timeLeft % 60;
seconds = seconds < 10 ? '0' + seconds : seconds;
countdownEl.innerHTML = `${minutes}:${seconds}`;
if (timeLeft <= 0) {
clearInterval(timer);
countdownEl.innerHTML = "EXPIRED";
}
timeLeft--;
}, 1000);
// TG redirect with order details
document.getElementById('checkPaymentBtn').addEventListener('click', function() {
const message = encodeURIComponent(`您好,我已支付订单。\n\n订单编号<?php echo $order_no; ?>\n商品数量<?php echo $total_qty; ?> 件\n实付金额<?php echo $order['total_amount']; ?> USDT\n\n请核实并处理。`);
const tgLink = `<?php echo $tg_link; ?>?text=${message}`;
// Redirect to Telegram
window.open(tgLink, '_blank');
});
// Clear cart after reaching payment page
localStorage.removeItem('cart');
if (typeof updateCartBadge === 'function') updateCartBadge();
</script>
<?php include 'includes/footer.php'; ?>

83
policy.php Normal file
View File

@ -0,0 +1,83 @@
<?php
include 'includes/header.php';
$type = $_GET['type'] ?? 'payment';
$title = ($type === 'payment') ? '支付说明' : '售后政策';
?>
<div class="row justify-content-center">
<div class="col-lg-9">
<div class="glass-card p-5">
<h1 class="display-4 fw-bold mb-5 d-flex align-items-center">
<i class="bi <?php echo ($type === 'payment') ? 'bi-credit-card' : 'bi-shield-check'; ?> me-3 text-primary"></i>
<?php echo $title; ?>
</h1>
<?php if ($type === 'payment'): ?>
<section class="mb-5">
<h3 class="text-white mb-4"><i class="bi bi-1-circle me-2"></i> 为什么选择 USDT 支付?</h3>
<p class="text-muted lh-lg">USDT (Tether) 是一种与美元挂钩的加密货币,具有交易快、手续费低、全球通用等特点。通过 USDT 支付,可以确保您的资金安全和隐私,同时实现全自动化的即时发货。</p>
</section>
<section class="mb-5">
<h3 class="text-white mb-4"><i class="bi bi-2-circle me-2"></i> 支付流程</h3>
<div class="row g-4">
<div class="col-md-4">
<div class="p-4 border border-secondary rounded-4 h-100">
<h5 class="text-white">1. 选择商品</h5>
<p class="small text-muted mb-0">将您需要的软件或账号加入购物车并提交订单。</p>
</div>
</div>
<div class="col-md-4">
<div class="p-4 border border-secondary rounded-4 h-100">
<h5 class="text-white">2. 转账支付</h5>
<p class="small text-muted mb-0">复制收款地址或扫码,使用您的钱包转入精确金额。</p>
</div>
</div>
<div class="col-md-4">
<div class="p-4 border border-secondary rounded-4 h-100">
<h5 class="text-white">3. 自动交付</h5>
<p class="small text-muted mb-0">区块链确认后,系统将自动跳转并提供您的卡密信息。</p>
</div>
</div>
</div>
</section>
<section class="mb-5">
<h3 class="text-white mb-4"><i class="bi bi-exclamation-triangle-fill me-2 text-warning"></i> 注意事项</h3>
<ul class="text-muted lh-lg">
<li>请务必使用 <strong class="text-white">TRC20 (Tron)</strong> 网络,使用其他网络(如 ERC20, BEP20将导致资金丢失。</li>
<li>请确保转账金额与订单显示的金额 <strong class="text-white">完全一致</strong></li>
<li>支付完成后请保留交易哈希 (TXID) 以备售后查询。</li>
<li>订单有效期为 60 分钟,请在倒计时结束前完成转账。</li>
</ul>
</section>
<?php else: ?>
<section class="mb-5">
<h3 class="text-white mb-4"><i class="bi bi-patch-check-fill me-2 text-success"></i> 质保范围</h3>
<p class="text-muted lh-lg">我们对所有售出的账号提供首登质保。即在购买后 24 小时内,如出现无法登录、账号密码错误等非人为操作问题,我们将为您免费更换。</p>
</section>
<section class="mb-5">
<h3 class="text-white mb-4"><i class="bi bi-x-circle-fill me-2 text-danger"></i> 非质保情况</h3>
<ul class="text-muted lh-lg">
<li>登录后因发布违规信息、频繁切换 IP 导致的封号。</li>
<li>因使用劣质代理 (VPN) 导致的登录异常。</li>
<li>购买后超过 24 小时未登录核对的订单。</li>
<li>由于官方政策调整导致的系统性风控。</li>
</ul>
</section>
<section class="mb-5">
<h3 class="text-white mb-4"><i class="bi bi-headset me-2 text-primary"></i> 售后申请流程</h3>
<p class="text-muted lh-lg">如遇问题,请准备好您的 <strong class="text-white">订单号</strong> <strong class="text-white">异常截图</strong>,联系我们的 Telegram 在线客服。客服将在 1-12 小时内处理您的请求。</p>
<div class="mt-4">
<a href="<?php echo $settings['tg_support'] ?? '#'; ?>" class="btn btn-primary px-5 py-3 rounded-pill">联系售后客服</a>
</div>
</section>
<?php endif; ?>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>

95
product.php Normal file
View File

@ -0,0 +1,95 @@
<?php
include 'includes/header.php';
$id = $_GET['id'] ?? 0;
$stmt = db()->prepare("SELECT p.*, c.name as category_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.id = ?");
$stmt->execute([$id]);
$product = $stmt->fetch();
if (!$product) {
echo "<div class='alert alert-danger'>商品不存在。</div>";
include 'includes/footer.php';
exit;
}
?>
<div class="row g-5">
<div class="col-lg-5">
<div class="glass-card p-3 bg-white shadow-sm">
<img src="<?php echo $product['image_url']; ?>" class="img-fluid rounded-4 w-100" alt="<?php echo $product['name']; ?>">
</div>
</div>
<div class="col-lg-7">
<div class="glass-card p-5 h-100 bg-white shadow-sm">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php" class="text-decoration-none text-muted">首页</a></li>
<li class="breadcrumb-item"><a href="category.php?id=<?php echo $product['category_id']; ?>" class="text-decoration-none text-muted"><?php echo $product['category_name']; ?></a></li>
<li class="breadcrumb-item active text-dark" aria-current="page"><?php echo $product['name']; ?></li>
</ol>
</nav>
<h1 class="display-4 mb-4 text-dark fw-bold"><?php echo $product['name']; ?></h1>
<div class="mb-4">
<span class="badge bg-primary bg-opacity-10 text-primary px-3 py-2 fs-6 mb-2"><?php echo $product['category_name']; ?></span>
<p class="fs-4 text-muted mt-3"><?php echo $product['description']; ?></p>
</div>
<div class="d-flex align-items-center mb-5">
<div class="me-5">
<span class="text-muted d-block mb-1 small">建议零售价</span>
<span class="display-5 fw-bold" style="color: var(--primary-color);"><?php echo $product['price_usdt']; ?> <small class="fs-4">USDT</small></span>
</div>
<div>
<span class="text-muted d-block mb-1 small">库存状态</span>
<span class="badge <?php echo $product['stock'] > 0 ? 'bg-success bg-opacity-10 text-success' : 'bg-danger bg-opacity-10 text-danger'; ?> fs-6 py-2 px-4 rounded-pill border border-<?php echo $product['stock'] > 0 ? 'success' : 'danger'; ?> border-opacity-25">
<?php echo $product['stock'] > 0 ? '现货供应 ('.$product['stock'].')' : '缺货中'; ?>
</span>
</div>
</div>
<div class="d-grid gap-3 d-md-flex">
<button class="btn btn-primary btn-lg px-5 flex-grow-1" onclick="addToCart(<?php echo $product['id']; ?>, '<?php echo addslashes($product['name']); ?>', <?php echo $product['price_usdt']; ?>, '<?php echo $product['image_url']; ?>')">
<i class="bi bi-cart-plus me-2"></i> 加入购物车
</button>
<a href="checkout.php?direct_id=<?php echo $product['id']; ?>" class="btn btn-outline-primary btn-lg px-5 flex-grow-1">
<i class="bi bi-lightning-fill me-2"></i> 立即购买
</a>
</div>
<div class="mt-4 d-grid">
<a href="<?php echo $tg_link; ?>" target="_blank" class="btn btn-outline-info btn-lg">
<i class="bi bi-chat-dots me-2"></i> 联系客服购买
</a>
</div>
<div class="mt-5 pt-5 border-top border-light">
<h5 class="text-dark mb-4">服务承诺</h5>
<div class="row text-center g-4">
<div class="col-4">
<i class="bi bi-shield-lock fs-2 mb-2 d-block" style="color: var(--primary-color);"></i>
<span class="small text-muted">安全支付</span>
</div>
<div class="col-4">
<i class="bi bi-lightning-charge fs-2 mb-2 d-block" style="color: var(--primary-color);"></i>
<span class="small text-muted">自动发货</span>
</div>
<div class="col-4">
<i class="bi bi-headset fs-2 mb-2 d-block" style="color: var(--primary-color);"></i>
<span class="small text-muted">售后保障</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="mt-5">
<div class="glass-card p-5 bg-white shadow-sm">
<h3 class="text-dark mb-4">详细描述</h3>
<div class="text-muted lh-lg">
<?php echo nl2br($product['content'] ?? '暂无详细描述。'); ?>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>

82
register.php Normal file
View File

@ -0,0 +1,82 @@
<?php
require_once 'db/config.php';
session_start();
$db = db();
$error = '';
$success = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'];
$password = $_POST['password'];
$confirm = $_POST['confirm_password'];
$email = $_POST['email'];
if ($password !== $confirm) {
$error = '两次输入的密码不一致';
} else {
$hashed = password_hash($password, PASSWORD_DEFAULT);
try {
$stmt = $db->prepare("INSERT INTO users (username, password, email, role) VALUES (?, ?, ?, 'user')");
$stmt->execute([$username, $hashed, $email]);
$success = '注册成功,请登录';
} catch (PDOException $e) {
$error = '用户名或邮箱已存在';
}
}
}
$page_title = '注册 - 豪软世界';
require_once 'includes/header.php';
?>
<main class="py-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-5">
<div class="bg-dark bg-opacity-50 rounded-5 border border-secondary border-opacity-25 p-5 shadow-lg">
<div class="text-center mb-5">
<h2 class="text-white fw-bold">加入我们</h2>
<p class="text-muted">开启您的软件选购之旅</p>
</div>
<?php if ($error): ?>
<div class="alert alert-danger bg-danger bg-opacity-10 border-0 text-danger rounded-4 small">
<?php echo $error; ?>
</div>
<?php endif; ?>
<?php if ($success): ?>
<div class="alert alert-success bg-success bg-opacity-10 border-0 text-success rounded-4 small">
<?php echo $success; ?>
</div>
<?php endif; ?>
<form method="POST">
<div class="mb-4">
<label class="form-label text-white small fw-bold">用户名</label>
<input type="text" name="username" class="form-control bg-black bg-opacity-50 border-secondary border-opacity-50 text-white p-3 rounded-3" required>
</div>
<div class="mb-4">
<label class="form-label text-white small fw-bold">电子邮箱</label>
<input type="email" name="email" class="form-control bg-black bg-opacity-50 border-secondary border-opacity-50 text-white p-3 rounded-3" required>
</div>
<div class="mb-4">
<label class="form-label text-white small fw-bold">设置密码</label>
<input type="password" name="password" class="form-control bg-black bg-opacity-50 border-secondary border-opacity-50 text-white p-3 rounded-3" required>
</div>
<div class="mb-5">
<label class="form-label text-white small fw-bold">确认密码</label>
<input type="password" name="confirm_password" class="form-control bg-black bg-opacity-50 border-secondary border-opacity-50 text-white p-3 rounded-3" required>
</div>
<button type="submit" class="btn btn-primary btn-lg w-100 py-3 rounded-3 shadow mb-4">立即注册</button>
<div class="text-center">
<span class="text-muted small">已有账号? <a href="login.php" class="text-primary text-decoration-none">立即登录</a></span>
</div>
</form>
</div>
</div>
</div>
</div>
</main>
<?php require_once 'includes/footer.php'; ?>

65
search.php Normal file
View File

@ -0,0 +1,65 @@
<?php
include 'includes/header.php';
$q = $_GET['q'] ?? '';
$results = [];
if (!empty($q)) {
$stmt = db()->prepare("SELECT p.*, c.name as cat_name FROM products p JOIN categories c ON p.category_id = c.id WHERE p.name LIKE ? OR p.description LIKE ? OR c.name LIKE ? ORDER BY p.id DESC");
$stmt->execute(['%'.$q.'%', '%'.$q.'%', '%'.$q.'%']);
$results = $stmt->fetchAll();
}
?>
<div class="row mb-5 align-items-center">
<div class="col-md-6">
<h1 class="fw-bold text-white mb-0">搜索结果</h1>
<p class="text-muted mt-2">关键词: <span class="text-primary fw-bold">"<?php echo htmlspecialchars($q); ?>"</span></p>
</div>
<div class="col-md-6 text-md-end mt-3 mt-md-0">
<span class="badge bg-primary bg-opacity-25 text-primary rounded-pill px-4 py-2 border border-primary border-opacity-25"><?php echo count($results); ?> 个相关结果</span>
</div>
</div>
<?php if (empty($results)): ?>
<div class="text-center py-5">
<div class="glass-card p-5">
<i class="bi bi-search fs-1 text-muted d-block mb-3"></i>
<h4 class="text-white">未找到相关结果</h4>
<p class="text-muted">换个关键词试试,或者联系客服定制您需要的软件。</p>
<a href="index.php" class="btn btn-primary mt-3 px-5 rounded-pill">返回商城首页</a>
</div>
</div>
<?php else: ?>
<div class="row g-4">
<?php foreach ($results as $product): ?>
<div class="col-6 col-lg-3">
<div class="glass-card p-3 product-card h-100 d-flex flex-column">
<div class="product-img-container mb-3">
<a href="product.php?id=<?php echo $product['id']; ?>">
<img src="<?php echo $product['image_url']; ?>" class="product-img" alt="<?php echo $product['name']; ?>">
<?php if ($product['is_hot']): ?>
<span class="badge-hot">HOT</span>
<?php endif; ?>
</a>
</div>
<div class="px-2 flex-grow-1 d-flex flex-column">
<span class="text-muted small"><?php echo $product['cat_name']; ?></span>
<h5 class="text-white mb-3">
<a href="product.php?id=<?php echo $product['id']; ?>" class="text-white text-decoration-none hover-primary">
<?php echo $product['name']; ?>
</a>
</h5>
<div class="mt-auto d-flex justify-content-between align-items-center">
<span class="price-tag"><?php echo $product['price_usdt']; ?> <small class="small">USDT</small></span>
<button class="btn btn-sm btn-outline-primary rounded-circle" onclick="addToCart(<?php echo $product['id']; ?>, '<?php echo addslashes($product['name']); ?>', <?php echo $product['price_usdt']; ?>, '<?php echo $product['image_url']; ?>')">
<i class="bi bi-cart-plus"></i>
</button>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php include 'includes/footer.php'; ?>