Initial commit - mini cms final

This commit is contained in:
Aya Tess tess
2025-11-03 21:53:58 +01:00
parent a366336dc1
commit a01f620ef9
14 changed files with 422 additions and 197 deletions

View File

@@ -1,11 +1,9 @@
<?php
// Démarre la session et le tampon proprement (évite les erreurs de headers)
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (!ob_get_level()) ob_start();
?>
<!DOCTYPE html>
<html lang="fr">
<head>
@@ -42,40 +40,60 @@ if (!ob_get_level()) ob_start();
color: #fff8f9;
text-shadow: 0 0 5px white;
}
/* ✅ Zone cliquable agrandie et fluide */
.profile-menu {
position: relative;
display: inline-block;
cursor: pointer;
padding: 5px 10px;
border-radius: 25px;
transition: background 0.3s;
}
.profile-menu:hover {
background: rgba(255, 255, 255, 0.2);
}
.profile-pic {
width: 40px;
height: 40px;
width: 42px;
height: 42px;
border-radius: 50%;
object-fit: cover;
border: 2px solid white;
cursor: pointer;
vertical-align: middle;
}
.dropdown {
display: none;
position: absolute;
right: 0;
top: 55px;
background: white;
border-radius: 10px;
box-shadow: 0 3px 10px rgba(0,0,0,0.15);
margin-top: 8px;
min-width: 160px;
box-shadow: 0 3px 12px rgba(0,0,0,0.15);
min-width: 180px;
overflow: hidden;
z-index: 1000;
}
.dropdown a {
color: #ff91a4;
padding: 10px 15px;
padding: 12px 16px;
text-decoration: none;
display: block;
transition: 0.2s;
}
.dropdown a:hover {
background: #ffe5ec;
}
.profile-menu:hover .dropdown {
/* ✅ Ouverture plus fluide (hover ou clic sur toute la zone) */
.profile-menu:hover .dropdown,
.profile-menu:focus-within .dropdown {
display: block;
}
.logo {
display: flex;
align-items: center;
@@ -90,36 +108,35 @@ if (!ob_get_level()) ob_start();
</style>
</head>
<body>
<header>
<div class="logo">
<?php if (file_exists('logo_aya.png')): ?>
<img src="logo_aya.png" alt="Logo Aya">
<?php endif; ?>
<h1><a href="index.php">📰 Mon Mini CMS</a></h1>
</div>
<header>
<div class="logo">
<?php if (file_exists('logo_aya.png')): ?>
<img src="logo_aya.png" alt="Logo Aya">
<?php endif; ?>
<h1><a href="index.php">📰 Mon Mini CMS</a></h1>
</div>
<nav>
<a href="index.php">Accueil</a>
<?php if (isset($_SESSION['user'])): ?>
<?php if ($_SESSION['user']['role'] === 'admin'): ?>
<a href="dashboard.php">Gestion</a>
<?php endif; ?>
<a href="add_article.php">Publier un article</a>
<div class="profile-menu">
<?php if (!empty($_SESSION['user']['profile_picture'])): ?>
<img src="<?= htmlspecialchars($_SESSION['user']['profile_picture']) ?>" alt="Profil" class="profile-pic">
<?php else: ?>
<div class="profile-pic" style="background:#fff;display:flex;justify-content:center;align-items:center;font-size:20px;">👤</div>
<?php endif; ?>
<div class="dropdown">
<a href="profile.php">Mon profil</a>
<a href="logout.php">Déconnexion</a>
</div>
</div>
<?php else: ?>
<!-- Boutons connexion / inscription -->
<a href="login.php">Connexion</a>
<a href="register.php">Inscription</a>
<nav>
<a href="index.php">Accueil</a>
<?php if (isset($_SESSION['user'])): ?>
<?php if ($_SESSION['user']['role'] === 'admin'): ?>
<a href="dashboard.php">Gestion</a>
<?php endif; ?>
</nav>
</header>
<a href="add_article.php">Publier un article</a>
<div class="profile-menu" tabindex="0">
<?php if (!empty($_SESSION['user']['profile_picture'])): ?>
<img src="<?= htmlspecialchars($_SESSION['user']['profile_picture']) ?>" alt="Profil" class="profile-pic">
<?php else: ?>
<div class="profile-pic" style="background:#fff;display:flex;justify-content:center;align-items:center;font-size:20px;">👤</div>
<?php endif; ?>
<div class="dropdown">
<a href="profile.php">Mon profil</a>
<a href="logout.php">Déconnexion</a>
</div>
</div>
<?php else: ?>
<a href="login.php">Connexion</a>
<a href="register.php">Inscription</a>
<?php endif; ?>
</nav>
</header>