Get api endpoint from config, not from user input.
This commit is contained in:
@@ -82,6 +82,9 @@ if (!defined('APP_NAME')) {
|
|||||||
if (!defined('YEAR')) {
|
if (!defined('YEAR')) {
|
||||||
define('YEAR', '2025/26'); // Anno Scolastico Corrente
|
define('YEAR', '2025/26'); // Anno Scolastico Corrente
|
||||||
}
|
}
|
||||||
|
if (!defined('API_URL')) {
|
||||||
|
define('API_URL', 'http://localhost:3006/classe');
|
||||||
|
}
|
||||||
if (!defined('DEV_MODE')) {
|
if (!defined('DEV_MODE')) {
|
||||||
define('DEV_MODE', false); // Modalita' di sviluppo: abilita messaggi di debug aggiuntivi. Imposta su false se sei in produzione
|
define('DEV_MODE', false); // Modalita' di sviluppo: abilita messaggi di debug aggiuntivi. Imposta su false se sei in produzione
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ if (!defined('APP_NAME')) {
|
|||||||
if (!defined('YEAR')) {
|
if (!defined('YEAR')) {
|
||||||
define('YEAR', '2025/26');
|
define('YEAR', '2025/26');
|
||||||
}
|
}
|
||||||
|
if (!defined('API_URL')) {
|
||||||
|
define('API_URL', 'http://localhost:3006/classe');
|
||||||
|
}
|
||||||
if (!defined('DEV_MODE')) {
|
if (!defined('DEV_MODE')) {
|
||||||
define('DEV_MODE', false); // Modalita' di sviluppo
|
define('DEV_MODE', false); // Modalita' di sviluppo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
session_start();
|
session_start();
|
||||||
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
|
if (!isset($_SESSION['admin'])) { header("Location: login.php"); exit; }
|
||||||
include("../lib/db.php");
|
include("../lib/db.php");
|
||||||
|
include("../config/config.php");
|
||||||
$message = "";
|
$message = "";
|
||||||
$messageType = "";
|
$messageType = "";
|
||||||
|
|
||||||
@@ -10,7 +10,6 @@ $messageType = "";
|
|||||||
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
|
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
|
||||||
$classe_codice = trim($_POST['classe_codice']);
|
$classe_codice = trim($_POST['classe_codice']);
|
||||||
$classe_id = intval($_POST['classe_id']);
|
$classe_id = intval($_POST['classe_id']);
|
||||||
$api_url = trim($_POST['api_url']);
|
|
||||||
|
|
||||||
if (empty($classe_codice) || $classe_id === 0) {
|
if (empty($classe_codice) || $classe_id === 0) {
|
||||||
$message = "Compila tutti i campi obbligatori.";
|
$message = "Compila tutti i campi obbligatori.";
|
||||||
@@ -18,7 +17,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// Chiama l'API Node.js
|
// Chiama l'API Node.js
|
||||||
$url = $api_url . "?classe=" . urlencode($classe_codice);
|
$url = API_URL . "?classe=" . urlencode($classe_codice);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
@@ -292,13 +291,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST['import'])) {
|
|||||||
<small>Codice della classe nel sistema esterno</small>
|
<small>Codice della classe nel sistema esterno</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="api_url">URL API Node.js</label>
|
|
||||||
<input type="text" name="api_url" id="api_url"
|
|
||||||
value="http://localhost:3006/classe" required>
|
|
||||||
<small>Endpoint dell'API Node.js per lo scraping</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="submit" name="import" style="width: 100%; padding: 12px; font-size: 16px;">
|
<button type="submit" name="import" style="width: 100%; padding: 12px; font-size: 16px;">
|
||||||
🔄 Importa Orario
|
🔄 Importa Orario
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user