mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
// Load environment variables
|
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
|
$dotenv->load();
|
|
|
|
// Load database configuration
|
|
$dbConfig = require __DIR__ . '/config/database.php';
|
|
\App\Database\Database::setConfig($dbConfig);
|
|
|
|
// Initialize database
|
|
try {
|
|
$pdo = \App\Database\Database::getInstance();
|
|
|
|
$userModel = new \App\Models\User($pdo);
|
|
$existingUser = $userModel::findByUsername($pdo, 'admin');
|
|
|
|
if ($existingUser) {
|
|
echo 'Admin user exists: ' . $existingUser['username'] . PHP_EOL;
|
|
echo 'Password hash: ' . $existingUser['password'] . PHP_EOL;
|
|
echo 'Role: ' . $existingUser['role'] . PHP_EOL;
|
|
echo 'Is active: ' . $existingUser['is_active'] . PHP_EOL;
|
|
|
|
// Test password verification
|
|
$testPassword = 'admin123';
|
|
$userModel->password = $existingUser['password'];
|
|
if ($userModel->verifyPassword($testPassword)) {
|
|
echo 'Password verification: SUCCESS' . PHP_EOL;
|
|
} else {
|
|
echo 'Password verification: FAILED' . PHP_EOL;
|
|
}
|
|
} else {
|
|
echo 'Admin user does not exist in database.' . PHP_EOL;
|
|
}
|
|
} catch (Exception $e) {
|
|
echo 'Error: ' . $e->getMessage() . PHP_EOL;
|
|
}
|