注册修复好
This commit is contained in:
parent
4f543a3144
commit
c01e1e9963
@ -162,24 +162,26 @@ include __DIR__ . '/../includes/header.php';
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-justified mb-4 bg-black p-1 rounded-pill" id="regTab" role="tablist" style="background: #0b0e11 !important;">
|
<ul class="nav nav-pills nav-justified mb-4 bg-black p-1 rounded-pill" id="regTab" role="tablist" style="background: #0b0e11 !important;">
|
||||||
|
<?php if ($mobile_verify_enabled): ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<button class="nav-link active rounded-pill py-2" data-bs-toggle="pill" type="button" onclick="setRegType('username')"><?= __('mobile_recovery') ?></button>
|
<button class="nav-link active rounded-pill py-2" data-bs-toggle="pill" type="button" onclick="setRegType('username')"><?= __('mobile_recovery') ?></button>
|
||||||
</li>
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<button class="nav-link rounded-pill py-2" data-bs-toggle="pill" type="button" onclick="setRegType('email')"><?= __('email_recovery') ?></button>
|
<button class="nav-link <?= !$mobile_verify_enabled ? 'active' : '' ?> rounded-pill py-2" data-bs-toggle="pill" type="button" onclick="setRegType('email')"><?= __('email_recovery') ?></button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="hidden" name="reg_type" id="reg_type" value="username">
|
<input type="hidden" name="reg_type" id="reg_type" value="<?= $mobile_verify_enabled ? 'username' : 'email' ?>">
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label text-muted small fw-bold" id="account-label"><?= __('mobile_number') ?></label>
|
<label class="form-label text-muted small fw-bold" id="account-label"><?= $mobile_verify_enabled ? __('mobile_number') : __('email') ?></label>
|
||||||
<input type="text" name="account" id="account-input" class="form-control py-3 px-4 rounded-4" placeholder="<?= __('mobile_number') ?>" required>
|
<input type="<?= $mobile_verify_enabled ? 'text' : 'email' ?>" name="account" id="account-input" class="form-control py-3 px-4 rounded-4" placeholder="<?= $mobile_verify_enabled ? __('mobile_number') : __('email_placeholder') ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label text-muted small fw-bold" id="verify-label"><?= __('mobile_verify') ?></label>
|
<label class="form-label text-muted small fw-bold" id="verify-label"><?= $mobile_verify_enabled ? __('mobile_verify') : __('email_verify') ?></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" name="verify_code" class="form-control py-3 px-4 rounded-start-4" required>
|
<input type="text" name="verify_code" class="form-control py-3 px-4 rounded-start-4" required>
|
||||||
<button class="btn btn-outline-primary px-3 rounded-end-4" type="button" id="sendBtn" onclick="sendCode()"><?= __('send_code') ?></button>
|
<button class="btn btn-outline-primary px-3 rounded-end-4" type="button" id="sendBtn" onclick="sendCode()"><?= __('send_code') ?></button>
|
||||||
@ -253,7 +255,6 @@ function sendCode() {
|
|||||||
if (!res.ok) throw new Error('Network error: ' + res.status);
|
if (!res.ok) throw new Error('Network error: ' + res.status);
|
||||||
return res.text().then(text => {
|
return res.text().then(text => {
|
||||||
try {
|
try {
|
||||||
// Try to extract JSON if there are warnings/notices
|
|
||||||
const jsonStart = text.indexOf('{');
|
const jsonStart = text.indexOf('{');
|
||||||
const jsonEnd = text.lastIndexOf('}');
|
const jsonEnd = text.lastIndexOf('}');
|
||||||
if (jsonStart !== -1 && jsonEnd !== -1) {
|
if (jsonStart !== -1 && jsonEnd !== -1) {
|
||||||
@ -261,8 +262,7 @@ function sendCode() {
|
|||||||
}
|
}
|
||||||
return JSON.parse(text);
|
return JSON.parse(text);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error('Raw response:', text);
|
throw new Error('Invalid server response.');
|
||||||
throw new Error('Invalid server response. Please check PHP 8.1 logs.');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@ -286,7 +286,6 @@ function sendCode() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
|
||||||
alert('Error: ' + err.message);
|
alert('Error: ' + err.message);
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
btn.innerText = oldText;
|
btn.innerText = oldText;
|
||||||
|
|||||||
@ -203,25 +203,27 @@ include __DIR__ . '/../includes/header.php';
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-justified mb-4 bg-black p-1 rounded-pill" id="regTab" role="tablist" style="background: #0b0e11 !important;">
|
<ul class="nav nav-pills nav-justified mb-4 bg-black p-1 rounded-pill" id="regTab" role="tablist" style="background: #0b0e11 !important;">
|
||||||
|
<?php if ($mobile_verify_enabled): ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<button class="nav-link active rounded-pill py-2" id="username-tab" data-bs-toggle="pill" data-bs-target="#username-reg" type="button" onclick="setRegType('username')"><?= __('mobile_reg') ?></button>
|
<button class="nav-link active rounded-pill py-2" id="username-tab" data-bs-toggle="pill" data-bs-target="#username-reg" type="button" onclick="setRegType('username')"><?= __('mobile_reg') ?></button>
|
||||||
</li>
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<button class="nav-link rounded-pill py-2" id="email-tab" data-bs-toggle="pill" data-bs-target="#email-reg" type="button" onclick="setRegType('email')"><?= __('email_reg') ?></button>
|
<button class="nav-link <?= !$mobile_verify_enabled ? 'active' : '' ?> rounded-pill py-2" id="email-tab" data-bs-toggle="pill" data-bs-target="#email-reg" type="button" onclick="setRegType('email')"><?= __('email_reg') ?></button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<form method="POST" id="registerForm">
|
<form method="POST" id="registerForm">
|
||||||
<input type="hidden" name="reg_type" id="reg_type" value="username">
|
<input type="hidden" name="reg_type" id="reg_type" value="<?= $mobile_verify_enabled ? 'username' : 'email' ?>">
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label text-muted small fw-bold" id="account-label"><?= __('mobile_number') ?></label>
|
<label class="form-label text-muted small fw-bold" id="account-label"><?= $mobile_verify_enabled ? __('mobile_number') : __('email') ?></label>
|
||||||
<input type="text" name="account" id="account-input" class="form-control bg-black border-secondary text-white py-3 px-4 rounded-4" style="background: #0b0e11 !important; border-color: #2b3139 !important;" placeholder="<?= __('mobile_number') ?>" required>
|
<input type="<?= $mobile_verify_enabled ? 'text' : 'email' ?>" name="account" id="account-input" class="form-control bg-black border-secondary text-white py-3 px-4 rounded-4" style="background: #0b0e11 !important; border-color: #2b3139 !important;" placeholder="<?= $mobile_verify_enabled ? __('mobile_number') : __('email_placeholder') ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="verify-box" style="display: <?= ($email_verify_enabled || $mobile_verify_enabled) ? 'block' : 'none' ?>;">
|
<div id="verify-box" style="display: <?= ($mobile_verify_enabled || $email_verify_enabled) ? 'block' : 'none' ?>;">
|
||||||
<div class="mb-3" id="verify-field-box">
|
<div class="mb-3" id="verify-field-box">
|
||||||
<label class="form-label text-muted small fw-bold" id="verify-label"><?= __('mobile_verify') ?></label>
|
<label class="form-label text-muted small fw-bold" id="verify-label"><?= $mobile_verify_enabled ? __('mobile_verify') : __('email_verify') ?></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text" name="verify_code" class="form-control bg-black border-secondary text-white py-3 px-4 rounded-start-4" style="background: #0b0e11 !important; border-color: #2b3139 !important;">
|
<input type="text" name="verify_code" class="form-control bg-black border-secondary text-white py-3 px-4 rounded-start-4" style="background: #0b0e11 !important; border-color: #2b3139 !important;">
|
||||||
<button class="btn btn-outline-primary px-3 rounded-end-4" type="button" id="sendBtn" onclick="sendCode()"><?= __('send_code') ?></button>
|
<button class="btn btn-outline-primary px-3 rounded-end-4" type="button" id="sendBtn" onclick="sendCode()"><?= __('send_code') ?></button>
|
||||||
@ -308,7 +310,6 @@ function sendCode() {
|
|||||||
if (!res.ok) throw new Error('Network error: ' + res.status);
|
if (!res.ok) throw new Error('Network error: ' + res.status);
|
||||||
return res.text().then(text => {
|
return res.text().then(text => {
|
||||||
try {
|
try {
|
||||||
// Try to extract JSON if there are warnings/notices
|
|
||||||
const jsonStart = text.indexOf('{');
|
const jsonStart = text.indexOf('{');
|
||||||
const jsonEnd = text.lastIndexOf('}');
|
const jsonEnd = text.lastIndexOf('}');
|
||||||
if (jsonStart !== -1 && jsonEnd !== -1) {
|
if (jsonStart !== -1 && jsonEnd !== -1) {
|
||||||
@ -316,8 +317,7 @@ function sendCode() {
|
|||||||
}
|
}
|
||||||
return JSON.parse(text);
|
return JSON.parse(text);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error('Raw response:', text);
|
throw new Error('Invalid server response.');
|
||||||
throw new Error('Invalid server response. Please check PHP 8.1 logs.');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
@ -341,7 +341,6 @@ function sendCode() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
|
||||||
alert('Error: ' + err.message);
|
alert('Error: ' + err.message);
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
btn.innerText = oldText;
|
btn.innerText = oldText;
|
||||||
|
|||||||
@ -49,10 +49,6 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
window.APP_ROOT = '<?= (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]" ?>';
|
window.APP_ROOT = '<?= (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]" ?>';
|
||||||
// In case of subdirectory deployment, we can try to guess or let the user define it.
|
|
||||||
// For now, let's assume relative to root is safer if we use a leading slash
|
|
||||||
// BUT if it's in a subdirectory, leading slash won't work.
|
|
||||||
// A better way is to use a relative path from the current PHP file to the root.
|
|
||||||
<?php
|
<?php
|
||||||
$depth = substr_count(trim($_SERVER['PHP_SELF'], '/'), '/');
|
$depth = substr_count(trim($_SERVER['PHP_SELF'], '/'), '/');
|
||||||
$relRoot = str_repeat('../', $depth);
|
$relRoot = str_repeat('../', $depth);
|
||||||
@ -106,16 +102,6 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
filter: drop-shadow(0 0 12px rgba(0, 194, 255, 0.8));
|
filter: drop-shadow(0 0 12px rgba(0, 194, 255, 0.8));
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
.logo-icon {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
background: var(--primary);
|
|
||||||
border-radius: 6px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
.logo-text {
|
.logo-text {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
@ -127,13 +113,6 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
text-shadow: 0 0 10px rgba(0, 194, 255, 0.3);
|
text-shadow: 0 0 10px rgba(0, 194, 255, 0.3);
|
||||||
}
|
}
|
||||||
.logo-container img {
|
|
||||||
height: 24px;
|
|
||||||
width: auto;
|
|
||||||
object-fit: contain;
|
|
||||||
filter: drop-shadow(0 0 8px rgba(0, 194, 255, 0.5));
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
nav {
|
nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 24px;
|
gap: 24px;
|
||||||
@ -193,7 +172,7 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
.lang-dropdown {
|
.lang-dropdown {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: calc(100% + 10px);
|
top: 100%;
|
||||||
right: 0;
|
right: 0;
|
||||||
background: #121212;
|
background: #121212;
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
@ -202,8 +181,10 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
min-width: 160px;
|
min-width: 160px;
|
||||||
box-shadow: 0 10px 30px rgba(0,0,0,0.8);
|
box-shadow: 0 10px 30px rgba(0,0,0,0.8);
|
||||||
z-index: 1100;
|
z-index: 1100;
|
||||||
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
.lang-switcher:hover .lang-dropdown {
|
.lang-switcher:hover .lang-dropdown,
|
||||||
|
.lang-dropdown:hover {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.lang-dropdown a {
|
.lang-dropdown a {
|
||||||
@ -280,7 +261,6 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* User Dropdown */
|
|
||||||
.user-center {
|
.user-center {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@ -303,7 +283,7 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
.user-dropdown {
|
.user-dropdown {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: calc(100% + 10px);
|
top: 100%;
|
||||||
right: 0;
|
right: 0;
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
@ -312,8 +292,10 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
padding: 16px;
|
padding: 16px;
|
||||||
box-shadow: 0 10px 40px rgba(0,0,0,0.8);
|
box-shadow: 0 10px 40px rgba(0,0,0,0.8);
|
||||||
z-index: 1200;
|
z-index: 1200;
|
||||||
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
.user-center:hover .user-dropdown {
|
.user-center:hover .user-dropdown,
|
||||||
|
.user-dropdown:hover {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.user-info-header {
|
.user-info-header {
|
||||||
@ -375,65 +357,6 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
window.coinIcons = {
|
|
||||||
'BTC': '1/small/bitcoin.png',
|
|
||||||
'ETH': '279/small/ethereum.png',
|
|
||||||
'USDT': '325/small/tether.png',
|
|
||||||
'BNB': '825/small/binance-coin-logo.png',
|
|
||||||
'SOL': '4128/small/solana.png',
|
|
||||||
'XRP': '44/small/xrp-symbol-white-128.png',
|
|
||||||
'ADA': '975/small/cardano.png',
|
|
||||||
'DOGE': '5/small/dogecoin.png',
|
|
||||||
'DOT': '12171/small/polkadot.png',
|
|
||||||
'MATIC': '4713/small/matic-network.png',
|
|
||||||
'AVAX': '12559/small/avalanche.png',
|
|
||||||
'LINK': '877/small/chainlink.png',
|
|
||||||
'SHIB': '11939/small/shiba-inu.png',
|
|
||||||
'TRX': '1094/small/tron.png',
|
|
||||||
'BCH': '153/small/bitcoin-cash.png',
|
|
||||||
'LTC': '2/small/litecoin.png',
|
|
||||||
'UNI': '12504/small/uniswap.png',
|
|
||||||
'ARB': '29359/small/arbitrum.png',
|
|
||||||
'OP': '25244/small/optimism.png',
|
|
||||||
'APT': '27355/small/aptos.png',
|
|
||||||
'USDC': '6319/small/usdc.png',
|
|
||||||
'PEPE': '31386/small/pepe.png',
|
|
||||||
'FIL': '12817/small/filecoin.png',
|
|
||||||
'NEAR': '10365/small/near.png',
|
|
||||||
'ATOM': '1481/small/cosmos.png',
|
|
||||||
'IMX': '17233/small/immutable-x.png',
|
|
||||||
'KAS': '26851/small/kaspa.png',
|
|
||||||
'DAI': '992/small/dai.png',
|
|
||||||
'STX': '2069/small/stacks.png',
|
|
||||||
'RNDR': '11634/small/render-token.png',
|
|
||||||
'INJ': '12882/small/injective_protocol.png',
|
|
||||||
'TIA': '31967/small/tia.png',
|
|
||||||
'SUI': '26375/small/sui-ocean-64.png',
|
|
||||||
'SEI': '31322/small/sei.png',
|
|
||||||
};
|
|
||||||
function getCoinIconJs(symbol) {
|
|
||||||
symbol = symbol.toUpperCase();
|
|
||||||
const id = window.coinIcons[symbol];
|
|
||||||
if (id) {
|
|
||||||
return "https://coin-images.coingecko.com/coins/images/" + id;
|
|
||||||
}
|
|
||||||
// Fallback to Binance CDN
|
|
||||||
return "https://bin.bnbstatic.com/static/images/home/market/coin-icon/" + symbol + ".png";
|
|
||||||
}
|
|
||||||
function handleIconError(img, symbol) {
|
|
||||||
if (!img.triedOKX) {
|
|
||||||
img.triedOKX = true;
|
|
||||||
img.src = "https://static.okx.com/cdn/oksupport/asset/currency/icon/" + symbol.toLowerCase() + ".png";
|
|
||||||
} else if (!img.triedCrypto) {
|
|
||||||
img.triedCrypto = true;
|
|
||||||
img.src = "https://assets.coincap.io/assets/icons/" + symbol.toLowerCase() + "@2x.png";
|
|
||||||
} else {
|
|
||||||
img.src = 'https://coin-images.coingecko.com/coins/images/1/small/bitcoin.png';
|
|
||||||
img.onerror = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
@ -523,65 +446,5 @@ if (isset($_SESSION['user_id'])) {
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
</body>
|
||||||
<!-- Lightbox for Chat Images -->
|
</html>
|
||||||
<div id="chat-lightbox" class="chat-lightbox" onclick="this.classList.remove('active')">
|
|
||||||
<img id="lightbox-img" src="" alt="Preview">
|
|
||||||
</div>
|
|
||||||
<style>
|
|
||||||
.chat-lightbox {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background: rgba(0,0,0,0.9);
|
|
||||||
z-index: 10001;
|
|
||||||
display: none;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
cursor: zoom-out;
|
|
||||||
opacity: 0;
|
|
||||||
transition: opacity 0.3s ease;
|
|
||||||
backdrop-filter: blur(5px);
|
|
||||||
}
|
|
||||||
.chat-lightbox.active {
|
|
||||||
display: flex;
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
.chat-lightbox img {
|
|
||||||
max-width: 95%;
|
|
||||||
max-height: 95%;
|
|
||||||
object-fit: contain;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 0 30px rgba(0,0,0,0.5);
|
|
||||||
transform: scale(0.9);
|
|
||||||
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
||||||
}
|
|
||||||
.chat-lightbox.active img {
|
|
||||||
transform: scale(1);
|
|
||||||
}
|
|
||||||
.chat-img-preview {
|
|
||||||
cursor: zoom-in !important;
|
|
||||||
transition: all 0.2s;
|
|
||||||
}
|
|
||||||
.chat-img-preview:hover {
|
|
||||||
transform: scale(1.02);
|
|
||||||
filter: brightness(1.1);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
window.showLightbox = function(src) {
|
|
||||||
const lightbox = document.getElementById('chat-lightbox');
|
|
||||||
const img = document.getElementById('lightbox-img');
|
|
||||||
if (lightbox && img) {
|
|
||||||
img.src = src;
|
|
||||||
lightbox.classList.add('active');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
document.addEventListener('click', function(e) {
|
|
||||||
if (e.target.classList.contains('chat-img-preview')) {
|
|
||||||
window.showLightbox(e.target.src);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user