Autosave: 20260225-081609
This commit is contained in:
parent
5122560397
commit
6c3d50fccf
@ -28,7 +28,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
if ($is_universal || $verify_code === '123456') {
|
if ($is_universal || $verify_code === '123456') {
|
||||||
$code_valid = true;
|
$code_valid = true;
|
||||||
} else {
|
} else {
|
||||||
if (session_status() === PHP_SESSION_NONE) session_start();
|
if (session_status() === PHP_SESSION_NONE) @session_start();
|
||||||
$session_key = ($reg_type === 'email' ? 'reset_email_code' : 'reset_mobile_code');
|
$session_key = ($reg_type === 'email' ? 'reset_email_code' : 'reset_mobile_code');
|
||||||
if (isset($_SESSION[$session_key]) && $verify_code === $_SESSION[$session_key]) {
|
if (isset($_SESSION[$session_key]) && $verify_code === $_SESSION[$session_key]) {
|
||||||
$code_valid = true;
|
$code_valid = true;
|
||||||
@ -253,10 +253,16 @@ 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 jsonEnd = text.lastIndexOf('}');
|
||||||
|
if (jsonStart !== -1 && jsonEnd !== -1) {
|
||||||
|
return JSON.parse(text.substring(jsonStart, jsonEnd + 1));
|
||||||
|
}
|
||||||
return JSON.parse(text);
|
return JSON.parse(text);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error('Raw response:', text);
|
console.error('Raw response:', text);
|
||||||
throw new Error('Invalid JSON response');
|
throw new Error('Invalid server response. Please check PHP 8.1 logs.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
@ -59,7 +59,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$stmt->execute([$username, $email, $hash, $uid, 80, $ip]);
|
$stmt->execute([$username, $email, $hash, $uid, 80, $ip]);
|
||||||
$userId = db()->lastInsertId();
|
$userId = db()->lastInsertId();
|
||||||
|
|
||||||
if (session_status() === PHP_SESSION_NONE) session_start();
|
if (session_status() === PHP_SESSION_NONE) @session_start();
|
||||||
$_SESSION['user_id'] = $userId;
|
$_SESSION['user_id'] = $userId;
|
||||||
$_SESSION['username'] = $username;
|
$_SESSION['username'] = $username;
|
||||||
$_SESSION['uid'] = $uid;
|
$_SESSION['uid'] = $uid;
|
||||||
@ -308,10 +308,16 @@ 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 jsonEnd = text.lastIndexOf('}');
|
||||||
|
if (jsonStart !== -1 && jsonEnd !== -1) {
|
||||||
|
return JSON.parse(text.substring(jsonStart, jsonEnd + 1));
|
||||||
|
}
|
||||||
return JSON.parse(text);
|
return JSON.parse(text);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error('Raw response:', text);
|
console.error('Raw response:', text);
|
||||||
throw new Error('Invalid JSON response');
|
throw new Error('Invalid server response. Please check PHP 8.1 logs.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
@ -19,21 +19,19 @@ class MailService
|
|||||||
require_once $autoload;
|
require_once $autoload;
|
||||||
}
|
}
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
||||||
@require_once 'libphp-phpmailer/autoload.php';
|
// Local PHPMailer (Priority for portability)
|
||||||
|
@require_once __DIR__ . '/PHPMailer/src/Exception.php';
|
||||||
|
@require_once __DIR__ . '/PHPMailer/src/SMTP.php';
|
||||||
|
@require_once __DIR__ . '/PHPMailer/src/PHPMailer.php';
|
||||||
|
|
||||||
|
// System-wide fallback
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
||||||
@require_once 'libphp-phpmailer/src/Exception.php';
|
@require_once 'libphp-phpmailer/autoload.php';
|
||||||
@require_once 'libphp-phpmailer/src/SMTP.php';
|
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
||||||
@require_once 'libphp-phpmailer/src/PHPMailer.php';
|
@require_once 'libphp-phpmailer/src/Exception.php';
|
||||||
}
|
@require_once 'libphp-phpmailer/src/SMTP.php';
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
@require_once 'libphp-phpmailer/src/PHPMailer.php';
|
||||||
@require_once 'PHPMailer/src/Exception.php';
|
}
|
||||||
@require_once 'PHPMailer/src/SMTP.php';
|
|
||||||
@require_once 'PHPMailer/src/PHPMailer.php';
|
|
||||||
}
|
|
||||||
if (!class_exists('PHPMailer\\PHPMailer\\PHPMailer')) {
|
|
||||||
@require_once 'PHPMailer/Exception.php';
|
|
||||||
@require_once 'PHPMailer/SMTP.php';
|
|
||||||
@require_once 'PHPMailer/PHPMailer.php';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user