| Server IP : 156.238.232.47 / Your IP : 216.73.216.150 Web Server : nginx/1.25.3 System : Linux C202504152095410 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : www ( 1000) PHP Version : 8.3.25 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/2025_12_29_01/ |
Upload File : |
<?php
/**
* 测试支付功能页面
* 用于验证Stripe支付是否正确实现
* 支持多语言:中文、英文、日文、法文
*/
// 数据库配置
$db_config = [
'host' => '127.0.0.1',
'dbname' => '2024_11_11_01',
'username' => 'travel_user',
'password' => '9b0e4191aa1faf39',
'charset' => 'utf8'
];
// 获取语言设置
$lang = isset($_GET['lang']) ? $_GET['lang'] : (isset($_COOKIE['payment_lang']) ? $_COOKIE['payment_lang'] : 'cn');
setcookie('payment_lang', $lang, time() + 86400 * 30, '/');
// 多语言翻译
$translations = [
'cn' => [
'title' => '支付功能测试页面',
'subtitle' => '测试Stripe支付集成是否正确实现',
'info_title' => '测试说明',
'info_1' => '1. 点击任意产品的"立即支付"按钮',
'info_2' => '2. 系统将跳转到Stripe的安全支付页面',
'info_3' => '3. 使用测试卡号:4242 4242 4242 4242',
'info_4' => '4. 任意未来日期和任意3位CVC码',
'info_5' => '5. 支付成功后会自动记录订单到数据库',
'info_notice' => '注意:Stripe要求最低支付金额为¥3.00',
'no_product_title' => '暂无产品',
'no_product_text' => '请先在后台添加带有价格的产品',
'pay_btn' => '立即支付',
'select_lang' => '选择语言',
],
'en' => [
'title' => 'Payment Function Test Page',
'subtitle' => 'Test Stripe payment integration',
'info_title' => 'Test Instructions',
'info_1' => '1. Click the "Pay Now" button on any product',
'info_2' => '2. System will redirect to Stripe secure payment page',
'info_3' => '3. Use test card number: 4242 4242 4242 4242',
'info_4' => '4. Any future date and any 3-digit CVC code',
'info_5' => '5. Order will be recorded in database after successful payment',
'info_notice' => 'Note: Stripe requires minimum payment amount of ¥3.00',
'no_product_title' => 'No Products Available',
'no_product_text' => 'Please add products with prices in the admin panel first',
'pay_btn' => 'Pay Now',
'select_lang' => 'Select Language',
],
'ja' => [
'title' => '決済機能テストページ',
'subtitle' => 'Stripe決済連携のテスト',
'info_title' => 'テスト手順',
'info_1' => '1. 任意の製品の「今すぐ支払う」ボタンをクリック',
'info_2' => '2. Stripeの安全な決済画面に遷移します',
'info_3' => '3. テストカード番号:4242 4242 4242 4242',
'info_4' => '4. 任意の将来日付と任意の3桁CVCコード',
'info_5' => '5. 決済成功後、自動的に注文がデータベースに記録されます',
'info_notice' => '注意:Stripeの最低決済額は¥3.00です',
'no_product_title' => '商品なし',
'no_product_text' => 'まず管理者パネルで価格付きの商品を追加してください',
'pay_btn' => '今すぐ支払う',
'select_lang' => '言語を選択',
],
'fr' => [
'title' => 'Page de Test de Paiement',
'subtitle' => 'Tester l\'intégration Stripe',
'info_title' => 'Instructions de Test',
'info_1' => '1. Cliquez sur le bouton "Payer maintenant" pour n\'importe quel produit',
'info_2' => '2. Le système redirigera vers la page de paiement sécurisée Stripe',
'info_3' => '3. Utilisez le numéro de carte de test : 4242 4242 4242 4242',
'info_4' => '4. Une date future qualsiasi et un code CVC à 3 chiffres',
'info_5' => '5. La commande sera enregistrée dans la base de données après un paiement réussi',
'info_notice' => 'Remarque : Stripe exige un montant minimum de paiement de ¥3.00',
'no_product_title' => 'Aucun Produit',
'no_product_text' => 'Veuillez d\'abord ajouter des produits avec prix dans le panneau d\'administration',
'pay_btn' => 'Payer maintenant',
'select_lang' => 'Sélectionner la langue',
]
];
$t = isset($translations[$lang]) ? $translations[$lang] : $translations['cn'];
// 创建数据库连接
try {
$pdo = new PDO(
"mysql:host={$db_config['host']};dbname={$db_config['dbname']};charset={$db_config['charset']}",
$db_config['username'],
$db_config['password'],
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
);
} catch (PDOException $e) {
die('数据库连接失败:' . $e->getMessage());
}
// 查询产品列表
try {
$stmt = $pdo->prepare("SELECT aid, title, users_price, litpic FROM ey_archives WHERE users_price > 0 ORDER BY aid DESC LIMIT 10");
$stmt->execute();
$products = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die('查询产品失败:' . $e->getMessage());
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>支付功能测试</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f8f9fa;
}
.container {
max-width: 1200px;
margin: 0 auto;
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.header {
text-align: center;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 2px solid #007bff;
}
.lang-switcher {
position: fixed;
top: 20px;
right: 20px;
background: white;
padding: 10px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
z-index: 1000;
}
.lang-switcher a {
display: inline-block;
margin: 0 5px;
padding: 5px 10px;
text-decoration: none;
color: #333;
border-radius: 4px;
transition: background-color 0.3s;
}
.lang-switcher a:hover {
background-color: #e9ecef;
}
.lang-switcher a.active {
background-color: #007bff;
color: white;
}
.product-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
margin-top: 20px;
}
.product-card {
border: 1px solid #ddd;
border-radius: 8px;
padding: 20px;
background: white;
transition: transform 0.2s, box-shadow 0.2s;
}
.product-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.product-image {
width: 100%;
height: 200px;
object-fit: cover;
border-radius: 5px;
margin-bottom: 15px;
}
.product-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
color: #333;
}
.product-price {
font-size: 24px;
color: #e74c3c;
font-weight: bold;
margin-bottom: 15px;
}
.pay-btn {
background: #007bff;
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
width: 100%;
transition: background-color 0.3s;
}
.pay-btn:hover {
background: #0056b3;
}
.info-box {
background: #e7f3ff;
border: 1px solid #b3d9ff;
border-radius: 5px;
padding: 15px;
margin-bottom: 20px;
}
.info-box h3 {
margin-top: 0;
color: #0056b3;
}
</style>
</head>
<body>
<div class="lang-switcher">
<span><?php echo $t['select_lang']; ?>:</span>
<a href="?lang=cn" <?php echo $lang == 'cn' ? 'class="active"' : ''; ?>>中文</a>
<a href="?lang=en" <?php echo $lang == 'en' ? 'class="active"' : ''; ?>>English</a>
<a href="?lang=ja" <?php echo $lang == 'ja' ? 'class="active"' : ''; ?>>日本語</a>
<a href="?lang=fr" <?php echo $lang == 'fr' ? 'class="active"' : ''; ?>>Français</a>
</div>
<div class="container">
<div class="header">
<h1><?php echo $t['title']; ?></h1>
<p><?php echo $t['subtitle']; ?></p>
</div>
<div class="info-box">
<h3><?php echo $t['info_title']; ?></h3>
<p><?php echo $t['info_1']; ?></p>
<p><?php echo $t['info_2']; ?></p>
<p><?php echo $t['info_3']; ?></p>
<p><?php echo $t['info_4']; ?></p>
<p><?php echo $t['info_5']; ?></p>
<p><strong><?php echo $t['info_notice']; ?></strong></p>
</div>
<div class="product-grid">
<?php foreach ($products as $product): ?>
<div class="product-card">
<img src="<?php echo !empty($product['litpic']) ? $product['litpic'] : '/uploads/allimg/20241115/default.jpg'; ?>"
alt="<?php echo htmlspecialchars($product['title']); ?>"
class="product-image">
<div class="product-title"><?php echo htmlspecialchars($product['title']); ?></div>
<div class="product-price">¥<?php echo htmlspecialchars($product['users_price']); ?></div>
<a href="pay.php?aid=<?php echo $product['aid']; ?>" class="pay-btn"><?php echo $t['pay_btn']; ?></a>
</div>
<?php endforeach; ?>
</div>
<?php if (empty($products)): ?>
<div style="text-align: center; padding: 50px;">
<h3><?php echo $t['no_product_title']; ?></h3>
<p><?php echo $t['no_product_text']; ?></p>
</div>
<?php endif; ?>
</div>
</body>
</html>