quelque amelioration
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
|
||||
require '../include/db.php';
|
||||
require '../include/auth.php';
|
||||
require '../include/db.php';
|
||||
requireLogin();
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
</label><br>
|
||||
|
||||
<button type="submit">Publier de la publication</button>
|
||||
<a href="board.php">Annuler de l'anulation</a>
|
||||
<a href="dashboard.php">Annuler de l'anulation</a>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
require '../include/db.php';
|
||||
require '../include/auth.php';
|
||||
require '../include/db.php';
|
||||
requireLogin();
|
||||
$stmt = $pdo->query('SELECT * FROM articles ORDER BY date_creation DESC');
|
||||
$articles = $stmt->fetchAll();
|
||||
@@ -23,7 +23,7 @@ $articles = $stmt->fetchAll();
|
||||
echo htmlspecialchars($_SESSION['user_login'] ?? 'Invité');
|
||||
?>
|
||||
<!-- retourne a la page de deconnexion -->
|
||||
| <a href="deconnexion.php">Se déconnecter</a>
|
||||
| <a href="logout.php">Se déconnecter</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
@@ -55,7 +55,7 @@ $articles = $stmt->fetchAll();
|
||||
<td><?php echo htmlspecialchars($article['titre']); ?></td>
|
||||
<td><?php echo $article['date_creation']; ?></td>
|
||||
<td>
|
||||
<a href="modification.php?id=<?php echo $article['id']; ?>">Modifier</a>
|
||||
<a href="modifier.php?id=<?php echo $article['id']; ?>">Modifier</a>
|
||||
|
|
||||
<a href="supprimer.php?id=<?php echo $article['id']; ?>">Supprimer</a>
|
||||
</td>
|
||||
|
||||
@@ -2,33 +2,39 @@
|
||||
require '../include/db.php';
|
||||
require '../include/auth.php';
|
||||
|
||||
|
||||
// Traite le formulaire de connexion : redirige si identifiants corrects, sinon affiche une erreur
|
||||
$error = '';
|
||||
f ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (checikLogin($pdo, $_POST['login'], $_POST['password'])) {
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$login = isset($_POST['login']) ? $_POST['login'] : '';
|
||||
$password = isset($_POST['password']) ? $_POST['password'] : '';
|
||||
|
||||
if (checkLogin($pdo, $login, $password)) {
|
||||
header('Location: board.php');
|
||||
exit;
|
||||
} else {
|
||||
} else {
|
||||
$error = 'Identifiants incorrects';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8"><title>Connexion</title>
|
||||
<link rel="stylesheet" href="styleco.css">
|
||||
<meta charset="UTF-8">
|
||||
<title>Connexion</title>
|
||||
<link rel="stylesheet" href="stylelog.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Connexion</h1>
|
||||
|
||||
<form method="post">
|
||||
<input type="text" name="login" placeholder="Login" required><br>
|
||||
<input type="password" name="password" placeholder="Mot de passe" required><br>
|
||||
<button type="submit">Se connecter</button>
|
||||
</form>
|
||||
<p style="color:red;"><?= $error ?></p>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<p style="color:red;"><?= htmlspecialchars($error) ?></p>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
|
||||
global $pdo;
|
||||
require '../include/db.php';
|
||||
require '../include/auth.php';
|
||||
require '../include/db.php';
|
||||
requireLogin();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ $id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
|
||||
// Id est pas valide on retourne au tableau
|
||||
if ($id <= 0) {
|
||||
header('Location: board.php');
|
||||
header('Location: dashboard.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ $article = $stmt->fetch();
|
||||
|
||||
// Article est pas valide on retourne au tableau
|
||||
if (!$article) {
|
||||
header('Location: board.php');
|
||||
header('Location: dashboard.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
]);
|
||||
|
||||
|
||||
header('Location: board.php');
|
||||
header('Location: dashboard.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<textarea name="contenu" rows="10" required><?= htmlspecialchars($contenu) ?></textarea>
|
||||
</label><br>
|
||||
<button type="submit">Enregistrer</button>
|
||||
<a href="board.php">Annuler</a>
|
||||
<a href="dashboard.php">Annuler</a>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,83 +1,89 @@
|
||||
/* Styles globaux */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background-color: #f4f4f9;
|
||||
background: linear-gradient(to right, #f4f4f9, #e2e8f0); /* léger dégradé */
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
||||
/* Titres */
|
||||
h1 {
|
||||
color: #1e3d59;
|
||||
border-bottom: 2px solid #aac4e0;
|
||||
padding-bottom: 10px;
|
||||
color: #1a202c;
|
||||
border-bottom: 3px solid #63b3ed;
|
||||
padding-bottom: 12px;
|
||||
margin-top: 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
/* Formulaire */
|
||||
form {
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border: 1px solid #d0dbe5;
|
||||
border-radius: 6px;
|
||||
padding: 25px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||
max-width: 600px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
|
||||
/* Labels et champs */
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 15px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 10px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="password"],
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border: 1px solid #bfc9d6;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
border: 1px solid #cbd5e0;
|
||||
border-radius: 6px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
button {
|
||||
background-color: #2a73cc;
|
||||
color: #fff;
|
||||
padding: 10px 15px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #195aa7;
|
||||
/* Boutons */
|
||||
button {
|
||||
background-color: #3182ce;
|
||||
color: #fff;
|
||||
padding: 12px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #2b6cb0;
|
||||
}
|
||||
|
||||
/* Liens */
|
||||
a {
|
||||
margin-left: 10px;
|
||||
color: #2a73cc;
|
||||
color: #3182ce;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
/* Messages d'erreur */
|
||||
.error {
|
||||
color: #721c24;
|
||||
background-color: #f8d7da;
|
||||
border: 1px solid #f5c6cb;
|
||||
color: #c53030;
|
||||
background-color: #fed7d7;
|
||||
border: 1px solid #f56565;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 640px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
|
||||
@@ -1,97 +1,116 @@
|
||||
/* Styles globaux */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background-color: #ececec; /* gris clair pour le fond */
|
||||
background: linear-gradient(to right, #f0f2f5, #e2e8f0);
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* En-tête */
|
||||
header {
|
||||
background-color: #555; /* gris foncé */
|
||||
background-color: #2d3748; /* gris foncé plus doux */
|
||||
color: #fff;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
margin-bottom: 25px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.8rem;
|
||||
font-size: 2rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
header p {
|
||||
margin: 5px 0 0 0;
|
||||
margin: 8px 0 0 0;
|
||||
}
|
||||
|
||||
header a {
|
||||
color: #cfcfcf;
|
||||
color: #a0aec0;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
header a:hover {
|
||||
text-decoration: underline;
|
||||
color: #fff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Titres */
|
||||
h2, h3 {
|
||||
color: #333;
|
||||
margin-top: 20px;
|
||||
color: #1a202c;
|
||||
margin-top: 25px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Lien Ajouter un article */
|
||||
a {
|
||||
color: #555;
|
||||
color: #3182ce;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Permet de cree des tableau */
|
||||
/* Tableau */
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 15px;
|
||||
background-color: #fff; /* fond blanc pour contraster */
|
||||
border-radius: 6px;
|
||||
margin-top: 20px;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
table th, table td {
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
padding: 12px;
|
||||
border: 1px solid #e2e8f0;
|
||||
text-align: left;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
table th {
|
||||
background-color: #bbb; /* gris moyen pour l'entête */
|
||||
background-color: #4a5568; /* gris foncé pour header */
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Lignes de tableau */
|
||||
/* Lignes alternées */
|
||||
table tr:nth-child(even) {
|
||||
background-color: #f2f2f2;
|
||||
background-color: #f7fafc;
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
table a {
|
||||
color: #2a73cc;
|
||||
color: #3182ce;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
table a:hover {
|
||||
color: #195aa7;
|
||||
color: #2b6cb0;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Séparateurs */
|
||||
hr {
|
||||
border: 0;
|
||||
border-top: 1px solid #ccc;
|
||||
margin: 20px 0;
|
||||
border-top: 1px solid #cbd5e0;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 640px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
table th, table td {
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
@@ -1,67 +1,83 @@
|
||||
/* Styles globaux */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background-color: #f4f4f9; /* fond clair */
|
||||
background: linear-gradient(to right, #f0f2f5, #e2e8f0);
|
||||
color: #333;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* Container centré */
|
||||
form {
|
||||
background-color: #fff;
|
||||
padding: 30px 25px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 6px 20px rgba(0,0,0,0.1);
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Titres */
|
||||
h1 {
|
||||
color: #1e3d59; /* bleu foncé */
|
||||
border-bottom: 2px solid #aac4e0;
|
||||
padding-bottom: 10px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* Formulaire */
|
||||
form {
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #d0dbe5;
|
||||
max-width: 600px;
|
||||
margin-top: 20px;
|
||||
color: #1a202c;
|
||||
border-bottom: 3px solid #63b3ed;
|
||||
padding-bottom: 12px;
|
||||
margin-bottom: 20px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Labels et inputs */
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 15px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
textarea {
|
||||
input[type="password"] {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border: 1px solid #bfc9d6;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
border: 1px solid #cbd5e0;
|
||||
border-radius: 6px;
|
||||
box-sizing: border-box;
|
||||
font-size: 1rem;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
/* Bouton */
|
||||
button {
|
||||
background-color: #2a73cc;
|
||||
width: 100%;
|
||||
background-color: #3182ce;
|
||||
color: #fff;
|
||||
padding: 10px 15px;
|
||||
padding: 12px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #195aa7;
|
||||
background-color: #2b6cb0;
|
||||
}
|
||||
|
||||
/* Lien annuler */
|
||||
/* Lien annuler / autres liens */
|
||||
a {
|
||||
margin-left: 10px;
|
||||
color: #2a73cc;
|
||||
display: inline-block;
|
||||
margin-top: 10px;
|
||||
color: #3182ce;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
@@ -70,20 +86,22 @@ a:hover {
|
||||
|
||||
/* Messages d'erreur */
|
||||
.error {
|
||||
color: #721c24;
|
||||
background: #f8d7da;
|
||||
border: 1px solid #f5c6cb;
|
||||
color: #c53030;
|
||||
background-color: #fed7d7;
|
||||
border: 1px solid #f56565;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 640px) {
|
||||
@media (max-width: 480px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
form {
|
||||
padding: 15px;
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,42 @@
|
||||
/* Styles globaux */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background-color: #ececec; /* gris clair */
|
||||
background: linear-gradient(to right, #f0f2f5, #e2e8f0);
|
||||
color: #333;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
header {
|
||||
background-color: #555; /* gris foncé */
|
||||
background-color: #2d3748; /* gris foncé plus doux */
|
||||
color: #fff;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
margin-bottom: 25px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.8rem;
|
||||
font-size: 2rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
header p {
|
||||
margin: 5px 0 0 0;
|
||||
margin: 8px 0 0 0;
|
||||
}
|
||||
|
||||
header a {
|
||||
color: #cfcfcf;
|
||||
color: #a0aec0;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
header a:hover {
|
||||
@@ -39,54 +46,68 @@ header a:hover {
|
||||
|
||||
/* Titres */
|
||||
h1, h2, h3 {
|
||||
color: #333;
|
||||
margin-top: 20px;
|
||||
color: #1a202c;
|
||||
margin-top: 25px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Formulaire de modification */
|
||||
form {
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
max-width: 600px;
|
||||
padding: 30px 25px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 6px 20px rgba(0,0,0,0.1);
|
||||
max-width: 500px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* Labels et inputs */
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 15px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border: 1px solid #bfc9d6;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
border: 1px solid #cbd5e0;
|
||||
border-radius: 6px;
|
||||
box-sizing: border-box;
|
||||
font-size: 1rem;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
/* Boutons */
|
||||
button {
|
||||
background-color: #555; /* gris foncé uniforme */
|
||||
width: 100%;
|
||||
background-color: #3182ce;
|
||||
color: #fff;
|
||||
padding: 10px 15px;
|
||||
padding: 12px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #333;
|
||||
background-color: #2b6cb0;
|
||||
}
|
||||
|
||||
/* Liens annuler */
|
||||
a {
|
||||
color: #555;
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 15px;
|
||||
color: #3182ce;
|
||||
text-decoration: none;
|
||||
margin-left: 10px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
@@ -95,19 +116,29 @@ a:hover {
|
||||
|
||||
/* Messages d'erreur */
|
||||
.error {
|
||||
color: #721c24;
|
||||
background-color: #f8d7da;
|
||||
border: 1px solid #f5c6cb;
|
||||
color: #c53030;
|
||||
background-color: #fed7d7;
|
||||
border: 1px solid #f56565;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Séparateurs */
|
||||
hr {
|
||||
border: 0;
|
||||
border-top: 1px solid #ccc;
|
||||
margin: 20px 0;
|
||||
border-top: 1px solid #cbd5e0;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 480px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
form {
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
Propulsé par Gitea
|
||||
Version: 1.
|
||||
@@ -1,35 +1,42 @@
|
||||
/* Styles globaux */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background-color: #ececec; /* gris clair */
|
||||
background: linear-gradient(to right, #f0f2f5, #e2e8f0);
|
||||
color: #333;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
header {
|
||||
background-color: #555; /* gris foncé */
|
||||
background-color: #2d3748; /* gris foncé doux */
|
||||
color: #fff;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
margin-bottom: 25px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.8rem;
|
||||
font-size: 2rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
header p {
|
||||
margin: 5px 0 0 0;
|
||||
margin: 8px 0 0 0;
|
||||
}
|
||||
|
||||
header a {
|
||||
color: #cfcfcf;
|
||||
color: #a0aec0;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
header a:hover {
|
||||
@@ -39,53 +46,47 @@ header a:hover {
|
||||
|
||||
/* Titres */
|
||||
h1, h2, h3 {
|
||||
color: #333;
|
||||
margin-top: 20px;
|
||||
color: #1a202c;
|
||||
margin-top: 25px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Formulaire de modification */
|
||||
/* Formulaire de confirmation de suppression */
|
||||
form {
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
max-width: 600px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
textarea {
|
||||
padding: 30px 25px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 6px 20px rgba(0,0,0,0.1);
|
||||
max-width: 400px;
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border: 1px solid #bfc9d6;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Boutons */
|
||||
button {
|
||||
background-color: #555; /* gris foncé uniforme */
|
||||
background-color: #e53e3e; /* rouge pour danger */
|
||||
color: #fff;
|
||||
padding: 10px 15px;
|
||||
padding: 12px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
margin: 0 10px;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #333;
|
||||
background-color: #c53030;
|
||||
}
|
||||
|
||||
/* Liens annuler */
|
||||
a {
|
||||
color: #555;
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
color: #3182ce;
|
||||
font-weight: 500;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
@@ -95,17 +96,34 @@ a:hover {
|
||||
|
||||
/* Messages d'erreur */
|
||||
.error {
|
||||
color: #721c24;
|
||||
background-color: #f8d7da;
|
||||
border: 1px solid #f5c6cb;
|
||||
color: #c53030;
|
||||
background-color: #fed7d7;
|
||||
border: 1px solid #f56565;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Séparateurs */
|
||||
hr {
|
||||
border: 0;
|
||||
border-top: 1px solid #ccc;
|
||||
margin: 20px 0;
|
||||
border-top: 1px solid #cbd5e0;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 480px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
form {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
<form method="post">
|
||||
<button type="submit" name="confirm" value="yes">Oui</button>
|
||||
<a href="board.php">Annuler</a>
|
||||
<a href="dashboard.php">Annuler</a>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,34 +1,42 @@
|
||||
/* Styles globaux */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
background-color: #ececec; /* gris clair */
|
||||
background: linear-gradient(to right, #f0f2f5, #e2e8f0);
|
||||
color: #333;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
header {
|
||||
background-color: #555; /* gris foncé */
|
||||
background-color: #2d3748; /* gris foncé doux */
|
||||
color: #fff;
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
margin-bottom: 25px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.8rem;
|
||||
font-size: 2rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
header p {
|
||||
margin: 5px 0 0 0;
|
||||
margin: 8px 0 0 0;
|
||||
}
|
||||
|
||||
header a {
|
||||
color: #cfcfcf;
|
||||
color: #a0aec0;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
header a:hover {
|
||||
@@ -38,27 +46,32 @@ header a:hover {
|
||||
|
||||
/* Titres */
|
||||
h1, h2, h3 {
|
||||
color: #333;
|
||||
margin-top: 20px;
|
||||
color: #1a202c;
|
||||
margin-top: 25px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Articles */
|
||||
article {
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.08);
|
||||
margin-bottom: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
|
||||
width: 100%;
|
||||
max-width: 700px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
article h2 a {
|
||||
color: #555;
|
||||
color: #2d3748;
|
||||
text-decoration: none;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
article h2 a:hover {
|
||||
color: #333;
|
||||
color: #1a202c;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
@@ -68,77 +81,82 @@ table {
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
background-color: #fff;
|
||||
border-radius: 6px;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
table th, table td {
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
padding: 12px 15px;
|
||||
border: 1px solid #e2e8f0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table th {
|
||||
background-color: #bbb; /* gris moyen pour entête */
|
||||
background-color: #4a5568; /* gris moyen foncé */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
table tr:nth-child(even) {
|
||||
background-color: #f2f2f2;
|
||||
background-color: #edf2f7;
|
||||
}
|
||||
|
||||
table a {
|
||||
color: #555;
|
||||
color: #3182ce;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table a:hover {
|
||||
color: #333;
|
||||
color: #2c5282;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Formulaires */
|
||||
form {
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
padding: 25px 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
|
||||
max-width: 600px;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 15px;
|
||||
font-weight: bold;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border: 1px solid #bfc9d6;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
border: 1px solid #cbd5e0;
|
||||
border-radius: 6px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Boutons */
|
||||
button {
|
||||
background-color: #555; /* gris foncé uniforme */
|
||||
background-color: #2b6cb0; /* bleu uniforme */
|
||||
color: #fff;
|
||||
padding: 10px 15px;
|
||||
padding: 12px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
margin-top: 10px;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #333;
|
||||
background-color: #2c5282;
|
||||
}
|
||||
|
||||
/* Liens annuler */
|
||||
/* Liens */
|
||||
a {
|
||||
color: #555;
|
||||
color: #3182ce;
|
||||
text-decoration: none;
|
||||
margin-left: 10px;
|
||||
}
|
||||
@@ -149,17 +167,35 @@ a:hover {
|
||||
|
||||
/* Messages d'erreur */
|
||||
.error {
|
||||
color: #721c24;
|
||||
background-color: #f8d7da;
|
||||
border: 1px solid #f5c6cb;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
color: #c53030;
|
||||
background-color: #fed7d7;
|
||||
border: 1px solid #f56565;
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Séparateurs */
|
||||
hr {
|
||||
border: 0;
|
||||
border-top: 1px solid #ccc;
|
||||
margin: 20px 0;
|
||||
border-top: 1px solid #cbd5e0;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 480px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
form, article, table {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
margin: 10px 0;
|
||||
}
|
||||
}
|
||||
10
bdd/init.sql
10
bdd/init.sql
@@ -1,16 +1,16 @@
|
||||
-- Création de la base de données si elle n'existe pas
|
||||
CREATE DATABASE IF NOT EXISTS my_sql_CMS CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
USE my_sql_CMS;
|
||||
|
||||
-- Cree une classe utilisateur
|
||||
-- Table des utilisateurs
|
||||
CREATE TABLE utilisateur (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
login VARCHAR(50) UNIQUE NOT NULL,
|
||||
password VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
-- Cree une classe article
|
||||
-- Table des articles
|
||||
CREATE TABLE articles (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
titre VARCHAR(255) NOT NULL,
|
||||
@@ -18,6 +18,6 @@ CREATE TABLE articles (
|
||||
date_creation DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Insert une valeur dans utilisateur
|
||||
-- Utilisateur de test (login: Samy, mot de passe hashé)
|
||||
INSERT INTO utilisateur (login, password)
|
||||
VALUES ('Fahym', '$2y$10$r8k200T71R2bLOFFQlZ1CuRuWg1Ah64UT/77BLTjN737ywZEWtKLu');
|
||||
VALUES ('Samy', '$2b$12$sIZ8j1yq/w36QcHwYY29COy.UE8Iu8yLJep36l.zXQgxLFGHgrmOa');
|
||||
|
||||
33
include/auth.php
Normal file
33
include/auth.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// Gestion de la connexion et de l'authentification des utilisateurs
|
||||
|
||||
session_start(); // Démarrage de la session
|
||||
|
||||
// Vérifie si un utilisateur est connecté
|
||||
function isLogged(): bool {
|
||||
return isset($_SESSION['user']);
|
||||
}
|
||||
|
||||
// Vérifie les identifiants et connecte l'utilisateur si valides
|
||||
function checkLogin(PDO $pdo, string $login, string $password): bool {
|
||||
$stmt = $pdo->prepare('SELECT * FROM utilisateur WHERE login = ?');
|
||||
$stmt->execute([$login]);
|
||||
$user = $stmt->fetch();
|
||||
|
||||
// Vérifie le mot de passe hashé
|
||||
if ($user && password_verify($password, $user['password'])) {
|
||||
$_SESSION['user'] = $user['login']; // Stocke le login en session
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Redirige vers la page de connexion si l'utilisateur n'est pas connecté
|
||||
function requireLogin(): void {
|
||||
if (!isLogged()) {
|
||||
header('Location: connexion.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
21
include/db.php
Normal file
21
include/db.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
// Connexion à la base de données avec PDO
|
||||
|
||||
$serveur = "CMS"; // Adresse du serveur MySQL
|
||||
$dbname = "CMS_sql"; // Nom de la base
|
||||
$user = "root"; // Utilisateur MySQL
|
||||
$pass = "123soleil"; // Mot de passe
|
||||
|
||||
try {
|
||||
// Création de la connexion PDO
|
||||
$pdo = new PDO("mysql:host=$serveur;dbname=$dbname", $user, $pass);
|
||||
|
||||
// Active le mode d'erreur Exception pour PDO
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
// Affiche l'erreur si la connexion échoue
|
||||
echo "Erreur de connexion à la base de données : " . $e->getMessage();
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
// Fichier gérant la connexion et l'authentification des utilisateurs
|
||||
|
||||
|
||||
session_start();
|
||||
|
||||
|
||||
function isLogged() {
|
||||
return isset($_SESSION['user']);
|
||||
}
|
||||
function checkLogin(PDO $pdo, $login, $password): bool
|
||||
{
|
||||
$stmt = $pdo->prepare('SELECT * FROM utilisateur WHERE login = ?');
|
||||
$stmt->execute([$login]);
|
||||
$user = $stmt->fetch();
|
||||
|
||||
|
||||
if ($user && password_verify($password, $user['password'])) {
|
||||
$_SESSION['user'] = $user['login'];
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function requireLogin() {
|
||||
if (!isLogged()) {
|
||||
header('Location: connexion.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
// Fichier de connexion à la base de données
|
||||
|
||||
|
||||
$serveur = "UnCMS"; // Adresse du serveur MySQL
|
||||
$dbname = "my_sql_CMS"; // Nom de la base de données
|
||||
$user = "root"; // Utilisateur MySQL
|
||||
$pass = "12345"; // Mot de passe
|
||||
|
||||
try {
|
||||
|
||||
$pdo = new PDO("mysql:host=$serveur;dbname=$dbname", $user, $pass);
|
||||
|
||||
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
|
||||
echo "Erreur de connexion à la base de données : " . $e->getMessage();
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
@@ -1,8 +1,9 @@
|
||||
FROM mysql
|
||||
FROM php:8.2-apache
|
||||
LABEL authors="Samy"
|
||||
|
||||
ENV MYSQL_ROOT_PASSWORD='123soleil'
|
||||
COPY . /var/www/html
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY ./init.sql /docker-entrypoint-initdb.d/
|
||||
RUN docker-php-ext-install pdo pdo_mysql
|
||||
|
||||
EXPOSE 3306
|
||||
EXPOSE 8
|
||||
@@ -43,7 +43,7 @@ $articles = $result->fetchAll();
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>© <?php echo date("Y"); ?> - Un CMS qui peut nous mener a la victoire</p>
|
||||
<p>© <?php echo date("Y"); ?> - Un CMS simple et efficace</p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<?php
|
||||
// Page qui affiche un article selon son id dans l'URL
|
||||
// Page qui affiche un article selon son ID
|
||||
|
||||
include 'include/db.php';
|
||||
require 'include/db.php'; // Connexion à la base
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
$id = (int)$_GET['id'];
|
||||
} else {
|
||||
$id = 0;
|
||||
}
|
||||
// Requête SQL pour récupérer toutes les infos de l'article avec l'id donné
|
||||
$sql = "SELECT * FROM articles WHERE id = ?";
|
||||
$req = $pdo->prepare($sql);
|
||||
$req->execute([$id]);
|
||||
$article = $req->fetch();
|
||||
// Récupération de l'ID depuis l'URL, par défaut 0 si absent
|
||||
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
|
||||
// Préparation et exécution de la requête SQL
|
||||
$stmt = $pdo->prepare('SELECT * FROM articles WHERE id = ?');
|
||||
$stmt->execute([$id]);
|
||||
$article = $stmt->fetch();
|
||||
|
||||
// Si l'article n'existe pas, afficher un message 404
|
||||
if (!$article) {
|
||||
echo "<h1>404 - Article introuvable</h1>";
|
||||
exit();
|
||||
@@ -24,13 +22,14 @@ if (!$article) {
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo htmlspecialchars($article['titre']); ?></title>
|
||||
<title><?= htmlspecialchars($article['titre']) ?></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1><?php echo htmlspecialchars($article['titre']); ?></h1>
|
||||
<h1><?= htmlspecialchars($article['titre']) ?></h1>
|
||||
|
||||
<p><?php echo nl2br(htmlspecialchars($article['contenu'])); ?></p>
|
||||
<!-- nl2br pour garder les retours à la ligne dans le contenu -->
|
||||
<p><?= nl2br(htmlspecialchars($article['contenu'])) ?></p>
|
||||
|
||||
<p><a href="index.php">← Retour à l'accueil</a></p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user