added headscriptnologin
This commit is contained in:
parent
c709f64a17
commit
4eae855e23
25
public/userarea/include/headscriptnologin.php
Normal file
25
public/userarea/include/headscriptnologin.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
require_once(__DIR__ . '/../class/db-functions.php');
|
||||||
|
|
||||||
|
$db = DBHandlerSelect::getInstance()->getConnection();
|
||||||
|
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL | E_STRICT);
|
||||||
|
|
||||||
|
// Inizializza la sessione
|
||||||
|
if (session_status() == PHP_SESSION_NONE) {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Imposta variabili di sessione di default per evitare errori
|
||||||
|
$_SESSION['iduserlogin'] = null; // Nessun utente loggato
|
||||||
|
$_SESSION['nameuser'] = 'Ospite';
|
||||||
|
$_SESSION['surnameuser'] = '';
|
||||||
|
$_SESSION['emailuser'] = '';
|
||||||
|
$_SESSION['photouser'] = '';
|
||||||
|
$photouser = $_SESSION['photouser'];
|
||||||
|
$photousername = '';
|
||||||
|
|
||||||
|
// Include file di lingua, se necessario
|
||||||
|
require_once(__DIR__ . '/../../languages/en/general.php');
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
// upload_photos_mobile.php
|
// upload_photos_mobile.php
|
||||||
include('include/headscript.php');
|
include('include/headscriptnologin.php');
|
||||||
|
|
||||||
$db = DBHandlerSelect::getInstance();
|
$db = DBHandlerSelect::getInstance();
|
||||||
$pdo = $db->getConnection();
|
$pdo = $db->getConnection();
|
||||||
@ -17,6 +17,13 @@ if ($iddatadb && $idquotations) {
|
|||||||
die('Non è possibile specificare sia iddatadb che idquotations');
|
die('Non è possibile specificare sia iddatadb che idquotations');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verifica che l'utente loggato esista
|
||||||
|
$stmt = $pdo->prepare("SELECT id FROM auth_users WHERE id = ?");
|
||||||
|
$stmt->execute([$iduserlogin]);
|
||||||
|
if (!$stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
die('Utente non valido');
|
||||||
|
}
|
||||||
|
|
||||||
// Determina quale ID usare e verifica l'esistenza
|
// Determina quale ID usare e verifica l'esistenza
|
||||||
$paramName = $iddatadb ? 'iddatadb' : 'idquotations';
|
$paramName = $iddatadb ? 'iddatadb' : 'idquotations';
|
||||||
$paramValue = $iddatadb ?: $idquotations;
|
$paramValue = $iddatadb ?: $idquotations;
|
||||||
@ -33,9 +40,6 @@ if (!$row) {
|
|||||||
|
|
||||||
$id = $row[$paramName];
|
$id = $row[$paramName];
|
||||||
$code = $row[$field] ?? 'Non disponibile';
|
$code = $row[$field] ?? 'Non disponibile';
|
||||||
|
|
||||||
// Imposta un iduserlogin di default per evitare errori in headscript.php
|
|
||||||
$iduserlogin = $iduserlogin ?? null; // Usa null o un valore fittizio se necessario
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user