feat: add MVC base, with auth to ldap

This commit is contained in:
unknown
2025-02-02 10:22:31 -08:00
commit 3b1749292e
12 changed files with 448 additions and 0 deletions

49
views/auth.php Normal file
View File

@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Authentification</title>
</head>
<body>
<form method="post" action="/index.php?action=login">
<label for="user_pseudo">Votre identifiant:</label>
<input type="text" id="user_pseudo" name="user_pseudo" required><br>
<label for="user_password">Votre mot de passe:</label>
<input type="password" id="user_password" name="user_password" required><br>
<input type="submit" value="Connexion">
</form>
<?php if (isset($error_message)): ?>
<div class="error"><?php echo $error_message; ?></div>
<?php endif; ?>
</body>
</html>
<!--
/*
DistinguishedName : CN=Administrator,CN=Users,DC=epul3a,DC=local
Enabled : True
GivenName :
Name : Administrator
ObjectClass : user
ObjectGUID : 942805f8-904c-4393-ab28-38325a72450d
SamAccountName : Administrator
SID : S-1-5-21-2676391027-398497314-3097492335-500
Surname :
UserPrincipalName :
DistinguishedName : CN=Ali Gathor,OU=3AFISA,DC=epul3a,DC=local
Enabled : True
GivenName : Ali
Name : Ali Gathor
ObjectClass : user
ObjectGUID : 5c2f554a-5157-473d-bb21-2868e29bf8f4
SamAccountName : a.gathor
SID : S-1-5-21-2676391027-398497314-3097492335-1106
Surname : Gathor
UserPrincipalName : a.gathor@epul3a.local
*/ -->

17
views/menu.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
if (!isset($_SESSION["login"]) || $_SESSION["login"] !== true) {
header('Location: auth.php');
exit;
}
echo "Bienvenue " . $_SESSION["user_pseudo"];
if ($_SESSION["is_admin"]) {
echo "<h2>Admin Dashboard</h2>";
echo "<a href='controllers/create_user.php'>Créer un utilisateur</a><br>";
echo "<a href='controllers/modify_user.php'>Modifier un utilisateur</a><br>";
echo "<a href='controllers/delete_user.php'>Supprimer un utilisateur</a><br>";
} else {
echo "<h2>Utilisateur Standard</h2>";
echo "<p>Vous pouvez consulter votre profil.</p>";
}