troppe modifiche, non so cosa scrivere
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
session_start();
|
||||
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
|
||||
include("../lib/db.php");
|
||||
include("../config/config.php");
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['name'])) {
|
||||
$name = $_POST['name'];
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
use Jumbojett\OpenIDConnectClient;
|
||||
require 'vendor/autoload.php';
|
||||
session_start();
|
||||
include("../lib/db.php");
|
||||
include("../config/config.php");
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && AUTH_TYPE === 'local') {
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && AUTH_TYPE == 'local') {
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
$stmt = $conn->prepare("SELECT * FROM admin WHERE username = ?");
|
||||
@@ -20,8 +20,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && AUTH_TYPE === 'local') {
|
||||
}
|
||||
$error = "Credenziali non valide";
|
||||
}
|
||||
if (AUTH_TYPE === 'local') {
|
||||
echo ```<!DOCTYPE html>
|
||||
if (AUTH_TYPE == 'local') {
|
||||
echo <<<HTML
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Login Admin</title>
|
||||
@@ -45,16 +46,16 @@ if (AUTH_TYPE === 'local') {
|
||||
<input type="password" name="password" placeholder="Password" required><br>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
<?php if(isset($error)) echo "<br><div class='error'>$error</div>"; ?>
|
||||
</div>
|
||||
HTML;
|
||||
if(isset($error)) echo "<br><div class='error'>$error</div>";
|
||||
echo <<<HTML
|
||||
</div>
|
||||
<p style="text-align: center;">Copyright (C) 2025 EmmeV. - Released under <a href="https://git.vichingo455.freeddns.org/emmev-code/orario/src/branch/stable/LICENSE.txt" target="_blank">GNU AGPL 3.0 License</a>.</p>
|
||||
</body>
|
||||
</html>```;
|
||||
</html>
|
||||
HTML;
|
||||
}
|
||||
else if (AUTH_TYPE === 'keycloak') {
|
||||
require 'vendor/autoload.php';
|
||||
use Jumbojett\OpenIDConnectClient;
|
||||
session_start();
|
||||
// Configura il client Keycloak
|
||||
$oidc = new OpenIDConnectClient(
|
||||
'https://' + KEYCLOAK_DOMAIN + '/realms/' + KEYCLOAK_REALM + '/',
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
include("../lib/db.php");
|
||||
include("../config/config.php");
|
||||
|
||||
if (!isset($_SESSION['admin']) || $_SESSION['auth_type'] != 'local') {
|
||||
header("Location: login.php");
|
||||
|
@@ -2,7 +2,6 @@
|
||||
session_start();
|
||||
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
|
||||
include("../lib/db.php");
|
||||
include("../config/config.php");
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['name'])) {
|
||||
$name = $_POST['name'];
|
||||
|
@@ -2,7 +2,6 @@
|
||||
session_start();
|
||||
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
|
||||
include("../lib/db.php");
|
||||
include("../config/config.php");
|
||||
|
||||
// --- Recupera tutte le materie ---
|
||||
$subjects = [];
|
||||
|
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
include("../lib/db.php");
|
||||
include("../config/config.php");
|
||||
|
||||
if (!isset($_SESSION['admin']) || $_SESSION['auth_type'] != 'local' || $_SESSION['admin'] != 'admin') {
|
||||
header("Location: login.php");
|
||||
|
@@ -1,17 +1,42 @@
|
||||
<?php
|
||||
// Impostazioni Database
|
||||
define('DB_HOST', 'db');
|
||||
define('DB_USER', 'orario');
|
||||
define('DB_PASS', 'orario');
|
||||
define('DB_NAME', 'school_timetable');
|
||||
if (!defined('DB_HOST')) {
|
||||
define('DB_HOST', '<MYSQL_HOST>'); // Host del database (ad esempio localhost)
|
||||
}
|
||||
if (!defined('DB_USER')) {
|
||||
define('DB_USER', '<MYSQL_USER>'); // Utente del database (ad esempio orario)
|
||||
}
|
||||
if (!defined('DB_PASS')) {
|
||||
define('DB_PASS', '<MYSQL_PASSWORD>'); // Password dell'utente specificato prima (ad esempio password123)
|
||||
}
|
||||
if (!defined('DB_NAME')) {
|
||||
define('DB_NAME', 'school_timetable'); // Nome del database, non modificare se non sai cosa stai facendo.
|
||||
}
|
||||
// Impostazioni sito generali
|
||||
define('APP_NAME', 'Orario Scuola');
|
||||
define('YEAR', '2025/26');
|
||||
if (!defined('APP_NAME')) {
|
||||
define('APP_NAME', 'Orario Scuola'); // Nome del sito
|
||||
}
|
||||
if (!defined('YEAR')) {
|
||||
define('YEAR', '2025/26'); // Anno Scolastico Corrente
|
||||
}
|
||||
// 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','');
|
||||
define('APP_DOMAIN','');
|
||||
if (!defined('AUTH_TYPE')) {
|
||||
define('AUTH_TYPE','local'); // Può essere keycloak o local (integrata)
|
||||
}
|
||||
// Impostazioni autenticazione via Keycloak (facoltative se AUTH_TYPE sta impostato su local)
|
||||
if (!defined('KEYCLOAK_DOMAIN')) {
|
||||
define('KEYCLOAK_DOMAIN',''); // Dominio di Keycloak (ad esempio auth.yourdomain.com)
|
||||
}
|
||||
if (!defined('KEYCLOAK_REALM')) {
|
||||
define('KEYCLOAK_REALM',''); // Realm di Keycloak (ad esempio master)
|
||||
}
|
||||
if (!defined('KEYCLOAK_CLIENT_ID')) {
|
||||
define('KEYCLOAK_CLIENT_ID',''); // Client ID per Keycloak (ad esempio orario)
|
||||
}
|
||||
if (!defined('KEYCLOAK_CLIENT_SECRET')) {
|
||||
define('KEYCLOAK_CLIENT_SECRET',''); // Client Secret per Keycloak (ad esempio abcdefghijklm)
|
||||
}
|
||||
if (!defined('APP_DOMAIN')) {
|
||||
define('APP_DOMAIN',''); // Dominio del sito (ad esempio orario.yourdomain.com)
|
||||
}
|
||||
?>
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
include("lib/db.php");
|
||||
include("config/config.php");
|
||||
$teacher = $_GET['teacher'];
|
||||
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
|
||||
$hours = [
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
include("lib/db.php");
|
||||
include("config/config.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
include("lib/db.php");
|
||||
include("config/config.php");
|
||||
$room = $_GET['room']; // aula selezionata
|
||||
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
|
||||
$hours = [
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
$host = "<MYSQL_HOST>";
|
||||
$user = "<MYSQL_USER>";
|
||||
$pass = "<MYSQL_PASSWORD>";
|
||||
$dbname = "school_timetable";
|
||||
include_once __DIR__ . '/../config/config.php';
|
||||
$host = DB_HOST;
|
||||
$user = DB_USER;
|
||||
$pass = DB_PASS;
|
||||
$dbname = DB_NAME;
|
||||
|
||||
$conn = new mysqli($host, $user, $pass, $dbname);
|
||||
if ($conn->connect_error) {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
include("lib/db.php");
|
||||
include("config/config.php");
|
||||
$class_id = intval($_GET['class_id']);
|
||||
$class = $conn->query("SELECT * FROM classes WHERE id=$class_id")->fetch_assoc();
|
||||
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
|
||||
|
Reference in New Issue
Block a user