157 lines
6.7 KiB
PHP
157 lines
6.7 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
|
||
@date_default_timezone_set('UTC');
|
||
if (session_status() === PHP_SESSION_NONE) {
|
||
session_start();
|
||
}
|
||
|
||
require_once __DIR__ . '/db/config.php';
|
||
|
||
$lang = $_GET['lang'] ?? ($_SESSION['lang'] ?? 'zh');
|
||
$lang = in_array($lang, ['zh', 'en'], true) ? $lang : 'zh';
|
||
$_SESSION['lang'] = $lang;
|
||
|
||
$i18n = [
|
||
'zh' => [
|
||
'site_name' => '金曜黄金交易所',
|
||
'nav_home' => '首页',
|
||
'nav_kyc' => 'KYC申请',
|
||
'nav_status' => '状态查询',
|
||
'nav_admin' => '后台管理',
|
||
'hero_title' => '合规黄金交易入口,支持真实交易流程',
|
||
'hero_subtitle' => '提交KYC、绑定资金账户并完成审核后即可开始交易。首版提供完整申请-审核-状态查询闭环。',
|
||
'cta_kyc' => '提交KYC申请',
|
||
'cta_status' => '查询申请状态',
|
||
'badge' => 'MVP · 真实交易准备流程',
|
||
'steps_title' => '三步启动交易',
|
||
'step1_title' => '提交KYC信息',
|
||
'step1_desc' => '录入身份信息与地址证明,系统生成申请编号。',
|
||
'step2_title' => '审核与通知',
|
||
'step2_desc' => '运营后台完成审核并更新状态。',
|
||
'step3_title' => '资金准备与交易',
|
||
'step3_desc' => '审核通过后即可进入资金与下单流程。',
|
||
'features_title' => '首版功能',
|
||
'feature1' => '双语中英文切换,适配国际客户',
|
||
'feature2' => 'KYC申请、状态查询、后台审核闭环',
|
||
'feature3' => '后续可扩展行情、下单、资金管理模块',
|
||
'cta_admin' => '查看后台审核',
|
||
'kyc_title' => 'KYC申请表',
|
||
'kyc_subtitle' => '请填写真实信息,我们会在1-2个工作日完成审核。',
|
||
'form_name' => '姓名(与证件一致)',
|
||
'form_email' => '邮箱',
|
||
'form_phone' => '手机号',
|
||
'form_id' => '身份证/护照号',
|
||
'form_address' => '居住地址',
|
||
'form_doc' => '证明文件链接(可为云盘地址)',
|
||
'form_submit' => '提交申请',
|
||
'form_note' => '提交即表示同意平台条款与隐私政策。',
|
||
'status_title' => 'KYC状态查询',
|
||
'status_subtitle' => '输入申请编号查看最新审核状态。',
|
||
'status_label' => '申请编号',
|
||
'status_btn' => '查询',
|
||
'status_empty' => '未找到该编号,请确认后重试。',
|
||
'status_pending' => '等待审核',
|
||
'status_approved' => '审核通过',
|
||
'status_rejected' => '审核未通过',
|
||
'admin_title' => 'KYC审核列表',
|
||
'admin_subtitle' => '最新申请列表与审核状态更新。',
|
||
'admin_view' => '查看详情',
|
||
'admin_detail_title' => 'KYC详情',
|
||
'admin_update' => '更新状态',
|
||
'admin_back' => '返回列表',
|
||
'admin_empty' => '暂无申请记录。',
|
||
'alert_success' => '申请已提交,我们已生成申请编号。',
|
||
'alert_error' => '请完整填写必填信息。',
|
||
'alert_email' => '邮箱格式不正确。',
|
||
],
|
||
'en' => [
|
||
'site_name' => 'Jinyao Gold Exchange',
|
||
'nav_home' => 'Home',
|
||
'nav_kyc' => 'KYC Apply',
|
||
'nav_status' => 'Check Status',
|
||
'nav_admin' => 'Admin',
|
||
'hero_title' => 'Compliant access to real gold trading',
|
||
'hero_subtitle' => 'Submit KYC, prepare funding, and get approved to start trading. This MVP delivers the full apply-review-status loop.',
|
||
'cta_kyc' => 'Submit KYC',
|
||
'cta_status' => 'Check Status',
|
||
'badge' => 'MVP · Real-trading onboarding',
|
||
'steps_title' => 'Start in three steps',
|
||
'step1_title' => 'Submit KYC',
|
||
'step1_desc' => 'Provide identity and address documents and receive an application ID.',
|
||
'step2_title' => 'Review & approval',
|
||
'step2_desc' => 'Operations reviews and updates your status.',
|
||
'step3_title' => 'Funding & trading',
|
||
'step3_desc' => 'Approved users move to funding and order placement.',
|
||
'features_title' => 'First release features',
|
||
'feature1' => 'Bilingual Chinese/English interface',
|
||
'feature2' => 'KYC application, status lookup, and admin review loop',
|
||
'feature3' => 'Ready to extend with pricing, orders, and wallet modules',
|
||
'cta_admin' => 'Open admin review',
|
||
'kyc_title' => 'KYC Application',
|
||
'kyc_subtitle' => 'Please submit accurate data. Review takes 1-2 business days.',
|
||
'form_name' => 'Full legal name',
|
||
'form_email' => 'Email',
|
||
'form_phone' => 'Phone number',
|
||
'form_id' => 'ID / Passport number',
|
||
'form_address' => 'Residential address',
|
||
'form_doc' => 'Document link (cloud storage URL)',
|
||
'form_submit' => 'Submit application',
|
||
'form_note' => 'By submitting you agree to our terms and privacy policy.',
|
||
'status_title' => 'KYC Status Lookup',
|
||
'status_subtitle' => 'Enter your application ID to see the latest status.',
|
||
'status_label' => 'Application ID',
|
||
'status_btn' => 'Search',
|
||
'status_empty' => 'No record found. Please verify the ID.',
|
||
'status_pending' => 'Pending review',
|
||
'status_approved' => 'Approved',
|
||
'status_rejected' => 'Rejected',
|
||
'admin_title' => 'KYC Review List',
|
||
'admin_subtitle' => 'Latest submissions and status updates.',
|
||
'admin_view' => 'View details',
|
||
'admin_detail_title' => 'KYC Details',
|
||
'admin_update' => 'Update status',
|
||
'admin_back' => 'Back to list',
|
||
'admin_empty' => 'No applications yet.',
|
||
'alert_success' => 'Application submitted. Your application ID is ready.',
|
||
'alert_error' => 'Please complete all required fields.',
|
||
'alert_email' => 'Email format is invalid.',
|
||
],
|
||
];
|
||
|
||
function t(string $key): string
|
||
{
|
||
global $i18n, $lang;
|
||
return $i18n[$lang][$key] ?? $key;
|
||
}
|
||
|
||
function h(?string $value): string
|
||
{
|
||
return htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
|
||
}
|
||
|
||
function url_with_lang(string $path, array $params = []): string
|
||
{
|
||
global $lang;
|
||
$params = array_merge(['lang' => $lang], $params);
|
||
return $path . '?' . http_build_query($params);
|
||
}
|
||
|
||
function ensure_kyc_table(): void
|
||
{
|
||
$pdo = db();
|
||
$pdo->exec(
|
||
"CREATE TABLE IF NOT EXISTS kyc_applications (
|
||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||
full_name VARCHAR(120) NOT NULL,
|
||
email VARCHAR(160) NOT NULL,
|
||
phone VARCHAR(60) NOT NULL,
|
||
id_number VARCHAR(60) NOT NULL,
|
||
address VARCHAR(255) NOT NULL,
|
||
doc_url VARCHAR(255) NOT NULL,
|
||
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"
|
||
);
|
||
}
|