diff --git a/config/init.php b/config/init.php index ba60d32..f6c7c3e 100644 --- a/config/init.php +++ b/config/init.php @@ -4,33 +4,3 @@ require_once __DIR__ . '/db.php'; require_once __DIR__ . '/../app/UsersManager.class.php'; $userManager = new UserManager($db); $currentUser = $userManager->checkAuth(); - -echo "
";
-
-if (!$currentUser) {
- // Utente non autenticato
- echo "Utente non autenticato\n";
- // Controlla se esiste un username memorizzato (cookie scaduto)
- $rememberedUsername = $userManager->getRememberedUsername();
-
- if ($rememberedUsername) {
- echo "Cookie scaduto ma username presente\n";
- // Cookie scaduto ma username presente -> chiedi solo password
- // header('Location: /reauth.php?username=' . urlencode($rememberedUsername));
- exit;
- } else {
- // Nessuna autenticazione -> login completo
- echo
- // header('Location: /login.php');
- exit;
- }
-}
-
-// Utente autenticato - memorizza in variabile globale per uso nelle pagine
-// $_SESSION['user'] = $currentUser;
-
-
-echo "";
-
-
-
diff --git a/index.php b/index.php
index 6ca1080..4184db8 100644
--- a/index.php
+++ b/index.php
@@ -1,8 +1,29 @@
getRememberedUsername();
+
+ if ($rememberedUsername) {
+ include 'login.php';
+ } else {
+ include 'login.php';
+
+ }
+}
+
+// Utente autenticato - memorizza in variabile globale per uso nelle pagine
+$_SESSION['user'] = $currentUser;
+
+
include 'parts/content.php';
include 'parts/footer.php';
?>
\ No newline at end of file
diff --git a/login.php b/login.php
new file mode 100644
index 0000000..dd16deb
--- /dev/null
+++ b/login.php
@@ -0,0 +1,58 @@
+
+