changes, finishing later

This commit is contained in:
2025-10-02 09:45:24 +02:00
parent 7249325faf
commit f98f5a3c07
12 changed files with 40 additions and 14 deletions

View File

@@ -1,7 +1,8 @@
<?php <?php
session_start(); session_start();
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; } if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
include("../db.php"); include("../lib/db.php");
include("../config/config.php");
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['name'])) { if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['name'])) {
$name = $_POST['name']; $name = $_POST['name'];

View File

@@ -1,6 +1,7 @@
<?php <?php
session_start(); session_start();
include("../db.php"); include("../lib/db.php");
include("../config/config.php");
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST['username']; $username = $_POST['username'];

View File

@@ -1,6 +1,7 @@
<?php <?php
session_start(); session_start();
include("../db.php"); include("../lib/db.php");
include("../config/config.php");
if (!isset($_SESSION['admin']) || $_SESSION['auth_type'] != 'local') { if (!isset($_SESSION['admin']) || $_SESSION['auth_type'] != 'local') {
header("Location: login.php"); header("Location: login.php");

View File

@@ -1,7 +1,8 @@
<?php <?php
session_start(); session_start();
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; } if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
include("../db.php"); include("../lib/db.php");
include("../config/config.php");
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['name'])) { if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['name'])) {
$name = $_POST['name']; $name = $_POST['name'];

View File

@@ -1,7 +1,8 @@
<?php <?php
session_start(); session_start();
// if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; } if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
include("../db.php"); include("../lib/db.php");
include("../config/config.php");
// --- Recupera tutte le materie --- // --- Recupera tutte le materie ---
$subjects = []; $subjects = [];

View File

@@ -1,6 +1,7 @@
<?php <?php
session_start(); session_start();
include("../db.php"); include("../lib/db.php");
include("../config/config.php");
if (!isset($_SESSION['admin']) || $_SESSION['auth_type'] != 'local' || $_SESSION['admin'] != 'admin') { if (!isset($_SESSION['admin']) || $_SESSION['auth_type'] != 'local' || $_SESSION['admin'] != 'admin') {
header("Location: login.php"); header("Location: login.php");

16
htdocs/config/config.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
// Impostazioni Database
define('DB_HOST', 'db');
define('DB_USER', 'orario');
define('DB_PASS', 'orario');
define('DB_NAME', 'school_timetable');
// Impostazioni sito generali
define('APP_NAME', 'Orario Scuola');
define('YEAR', '2025/26');
// Impostazioni autenticazione dashboard amministrativa
define('AUTH_TYPE','local'); // Può essere keycloak o local (integrata)
define('KEYCLOAK_DOMAIN','');
define('KEYCLOAK_REALM','');
define('KEYCLOAK_CLIENT_ID','');
define('KEYCLOAK_CLIENT_SECRET','')
?>

View File

@@ -1,5 +1,6 @@
<?php <?php
include("db.php"); include("lib/db.php");
include("config/config.php");
$teacher = $_GET['teacher']; $teacher = $_GET['teacher'];
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]; $days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
$hours = [ $hours = [

View File

@@ -1,24 +1,25 @@
<?php <?php
include("db.php"); include("lib/db.php");
include("config/config.php");
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Orario - A.S. 2025/26</title> <title><?php echo APP_NAME; ?> - A.S. <?php echo YEAR; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/home.css"> <link rel="stylesheet" href="css/home.css">
<link rel="stylesheet" href="css/navbar.css"> <link rel="stylesheet" href="css/navbar.css">
</head> </head>
<body> <body>
<div class="navbar"> <div class="navbar">
<div class="logo">Orario Scuola 2025/26</div> <div class="logo"><?php echo APP_NAME; ?> <?php echo YEAR; ?></div>
<div class="links"> <div class="links">
<a href="index.php">Home</a> <a href="index.php">Home</a>
<a href="admin/index.php">Admin</a> <a href="admin/index.php">Admin</a>
<a href="https://git.vichingo455.freeddns.org/emmev-code/orario" target="_blank">Codice sorgente</a> <a href="https://git.vichingo455.freeddns.org/emmev-code/orario" target="_blank">Codice sorgente</a>
</div> </div>
</div> </div>
<h1>Orario - a.s. 2025/26</h1> <h1><?php echo APP_NAME; ?> - A.S. <?php echo YEAR; ?></h1>
<!-- Sezione Classi --> <!-- Sezione Classi -->
<h2>Classi</h2> <h2>Classi</h2>

View File

@@ -1,5 +1,6 @@
<?php <?php
include("db.php"); include("lib/db.php");
include("config/config.php");
$room = $_GET['room']; // aula selezionata $room = $_GET['room']; // aula selezionata
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]; $days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
$hours = [ $hours = [

View File

@@ -1,5 +1,6 @@
<?php <?php
include("db.php"); include("lib/db.php");
include("config/config.php");
$class_id = intval($_GET['class_id']); $class_id = intval($_GET['class_id']);
$class = $conn->query("SELECT * FROM classes WHERE id=$class_id")->fetch_assoc(); $class = $conn->query("SELECT * FROM classes WHERE id=$class_id")->fetch_assoc();
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]; $days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];