ReleaseV11
This commit is contained in:
parent
03858ddec9
commit
7d31c24902
@ -644,4 +644,37 @@ CREATE TABLE `webhooks` (
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `users`
|
||||
--
|
||||
|
||||
LOCK TABLES `users` WRITE;
|
||||
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
|
||||
INSERT INTO `users` (`id`, `username`, `display_name`, `email`, `password_hash`, `avatar_url`, `status`, `is_admin`) VALUES
|
||||
(1, 'admin', 'SuperAdmin', 'admin@corvara.com', '$2y$10$wvwjJlj0mKf47YRzwsxom./X0w1BX9NDqVnL40D97QGe7oPjdiL5i', NULL, 'offline', 1);
|
||||
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Dumping data for table `servers`
|
||||
--
|
||||
|
||||
LOCK TABLES `servers` WRITE;
|
||||
/*!40000 ALTER TABLE `servers` DISABLE KEYS */;
|
||||
INSERT INTO `servers` (`id`, `name`, `owner_id`, `invite_code`) VALUES
|
||||
(1, 'Mon Serveur', 1, 'WELCOME');
|
||||
/*!40000 ALTER TABLE `servers` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Dumping data for table `channels`
|
||||
--
|
||||
|
||||
LOCK TABLES `channels` WRITE;
|
||||
/*!40000 ALTER TABLE `channels` DISABLE KEYS */;
|
||||
INSERT INTO `channels` (`id`, `server_id`, `name`, `type`, `position`) VALUES
|
||||
(1, 1, 'général', 'chat', 0);
|
||||
/*!40000 ALTER TABLE `channels` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
-- Dump completed on 2026-02-21 20:28:47
|
||||
|
||||
@ -44,4 +44,19 @@ foreach ($exts as $ext) {
|
||||
}
|
||||
echo "</ul>";
|
||||
|
||||
// 4. Vérification de l'administrateur
|
||||
echo "<h2>Compte Administrateur :</h2>";
|
||||
try {
|
||||
$stmt = $pdo->prepare("SELECT id FROM users WHERE email = ? AND is_admin = 1");
|
||||
$stmt->execute(['admin@corvara.com']);
|
||||
$admin = $stmt->fetch();
|
||||
if ($admin) {
|
||||
echo "<p style='color:green;'>✅ SuperAdmin (admin@corvara.com) présent.</p>";
|
||||
} else {
|
||||
echo "<p style='color:orange;'>⚠️ SuperAdmin absent. Utilisez create_admin.php pour le créer.</p>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "<p style='color:red;'>Impossible de vérifier l'admin (table users manquante ?).</p>";
|
||||
}
|
||||
|
||||
echo "<hr><p>Si des tables sont manquantes, exécutez <b>fix_db.php</b>.</p>";
|
||||
|
||||
14
fix_db.php
14
fix_db.php
@ -85,5 +85,19 @@ try {
|
||||
echo "<p>ℹ️ Colonnes déjà présentes dans 'channels'.</p>";
|
||||
}
|
||||
|
||||
// Ajout du SuperAdmin si absent
|
||||
try {
|
||||
$stmt = $pdo->prepare("SELECT id FROM users WHERE email = ?");
|
||||
$stmt->execute(['admin@corvara.com']);
|
||||
if (!$stmt->fetch()) {
|
||||
$hash = '$2y$10$wvwjJlj0mKf47YRzwsxom./X0w1BX9NDqVnL40D97QGe7oPjdiL5i';
|
||||
$pdo->prepare("INSERT INTO users (username, display_name, email, password_hash, is_admin) VALUES (?, ?, ?, ?, 1)")
|
||||
->execute(['admin', 'SuperAdmin', 'admin@corvara.com', $hash]);
|
||||
echo "<p style='color:green;'>✅ Compte SuperAdmin créé (admin@corvara.com / admin123).</p>";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "<p style='color:orange;'>⚠️ Impossible de créer l'admin automatique : " . $e->getMessage() . "</p>";
|
||||
}
|
||||
|
||||
echo "<hr><p style='color:green;'>Terminé ! Essayez de rafraîchir votre page index.php.</p>";
|
||||
echo "<p style='color:red;'><b>IMPORTANT : Supprimez ce fichier (fix_db.php) après usage.</b></p>";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user