push notification setting and update pages with PDO
This commit is contained in:
+344
-376
@@ -1,442 +1,410 @@
|
||||
<?php require_once('include/headscript.php'); ?>
|
||||
<?php // optionquery
|
||||
$optionquery = new WA_MySQLi_RS("optionquery",$bkngstm,0);
|
||||
$optionquery->setQuery("SELECT * FROM option");
|
||||
$optionquery->execute();
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (isset($_GET['message'])) { $message=$_GET['message']; } else { $message=""; }
|
||||
// Verifica se è stato inviato un modulo
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// Verifica se è stato caricato un file correttamente
|
||||
if (isset($_FILES["fileToUpload"]) && $_FILES["fileToUpload"]["error"] === UPLOAD_ERR_OK) {
|
||||
require_once('include/headscript.php');
|
||||
|
||||
/**
|
||||
* Connessione unica PDO (singleton). $iduserlogin dalla sessione autenticata.
|
||||
*/
|
||||
$pdo = DBHandlerSelect::getInstance()->getConnection();
|
||||
$iduserlogin = (int) $iduserlogin;
|
||||
|
||||
// Crea la connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
function e($value): string
|
||||
{
|
||||
return htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
// Verifica la connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
}
|
||||
$message = isset($_GET['message']) ? $_GET['message'] : '';
|
||||
$uploadFeedback = null; // ['type' => 'success'|'error', 'text' => '...']
|
||||
|
||||
// Ottieni l'ID dell'utente (da dove viene?)
|
||||
$iduserlogin = $_POST["iduserlogin"];
|
||||
/* -------------------------------------------------------------------------
|
||||
* Gestione upload certificato (POST) — con validazione robusta
|
||||
* ---------------------------------------------------------------------- */
|
||||
$allowedExt = ['pdf', 'jpg', 'jpeg', 'png'];
|
||||
$allowedMime = ['application/pdf', 'image/jpeg', 'image/png'];
|
||||
$maxBytes = 8 * 1024 * 1024; // 8 MB
|
||||
$uploadDir = 'user/document/';
|
||||
|
||||
// Altre informazioni sul documento
|
||||
$documentDescription = $_POST["documentDescription"];
|
||||
$expiryDate = $_POST["expiryDate"];
|
||||
$originalFileName = $_FILES["fileToUpload"]["name"];
|
||||
$fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION);
|
||||
$timestamp = time(); // Timestamp corrente
|
||||
$newFileName = "{$timestamp}_{$originalFileName}"; // Aggiungi timestamp al nome del file
|
||||
$fileTmpName = $_FILES["fileToUpload"]["tmp_name"];
|
||||
$fileDestination = "user/document/" . $newFileName;
|
||||
if (
|
||||
$_SERVER['REQUEST_METHOD'] === 'POST'
|
||||
&& isset($_FILES['fileToUpload'])
|
||||
&& $_FILES['fileToUpload']['error'] === UPLOAD_ERR_OK
|
||||
) {
|
||||
|
||||
// Sposta il file nella cartella di destinazione
|
||||
if (move_uploaded_file($fileTmpName, $fileDestination)) {
|
||||
// Inserisci i dati nel database
|
||||
$sql = "INSERT INTO certificateuserprofile (iduser, documentdescription, filenamedocument, expirydatedocument)
|
||||
VALUES ('$iduserlogin', '$documentDescription', '$newFileName', '$expiryDate')";
|
||||
$file = $_FILES['fileToUpload'];
|
||||
$documentDescription = trim($_POST['documentDescription'] ?? '');
|
||||
$expiryDate = trim($_POST['expiryDate'] ?? '');
|
||||
|
||||
// 1) Dimensione
|
||||
if ($file['size'] > $maxBytes) {
|
||||
$uploadFeedback = ['type' => 'error', 'text' => 'Il file supera la dimensione massima di 8 MB.'];
|
||||
} else {
|
||||
// 2) Estensione
|
||||
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
|
||||
// 3) Tipo MIME reale (non ci fidiamo dell'estensione dichiarata)
|
||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||
$realMime = $finfo->file($file['tmp_name']);
|
||||
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo "Documento inserito correttamente nel database.";
|
||||
} else {
|
||||
echo "Errore nell'esecuzione della query: " . $conn->error;
|
||||
}
|
||||
if (!in_array($ext, $allowedExt, true) || !in_array($realMime, $allowedMime, true)) {
|
||||
$uploadFeedback = ['type' => 'error', 'text' => 'Formato non consentito. Carica un PDF, JPG o PNG.'];
|
||||
} else {
|
||||
echo "Errore nel caricamento del file.";
|
||||
// 4) Nome file sicuro generato dal server (niente input utente nel percorso)
|
||||
$safeName = bin2hex(random_bytes(16)) . '.' . $ext;
|
||||
$destination = $uploadDir . $safeName;
|
||||
|
||||
if (!is_dir($uploadDir)) {
|
||||
@mkdir($uploadDir, 0755, true);
|
||||
}
|
||||
|
||||
if (move_uploaded_file($file['tmp_name'], $destination)) {
|
||||
// 5) INSERT con prepared statement
|
||||
$sql = "INSERT INTO certificateuserprofile
|
||||
(iduser, documentdescription, filenamedocument, expirydatedocument)
|
||||
VALUES (:iduser, :descr, :fname, :expiry)";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$ok = $stmt->execute([
|
||||
':iduser' => $iduserlogin,
|
||||
':descr' => $documentDescription,
|
||||
':fname' => $safeName,
|
||||
':expiry' => $expiryDate !== '' ? $expiryDate : null,
|
||||
]);
|
||||
|
||||
$uploadFeedback = $ok
|
||||
? ['type' => 'success', 'text' => 'Documento caricato correttamente.']
|
||||
: ['type' => 'error', 'text' => 'Errore nel salvataggio del documento. Riprova.'];
|
||||
} else {
|
||||
$uploadFeedback = ['type' => 'error', 'text' => 'Caricamento del file non riuscito. Riprova.'];
|
||||
}
|
||||
}
|
||||
|
||||
// Chiudi la connessione al database
|
||||
$conn->close();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$iduser=$iduserlogin;
|
||||
// Crea la connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Verifica la connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connessione al database fallita: " . $conn->connect_error);
|
||||
} elseif (
|
||||
$_SERVER['REQUEST_METHOD'] === 'POST'
|
||||
&& isset($_FILES['fileToUpload'])
|
||||
&& $_FILES['fileToUpload']['error'] !== UPLOAD_ERR_NO_FILE
|
||||
) {
|
||||
// Un file è stato scelto ma l'upload è fallito lato PHP
|
||||
$uploadFeedback = ['type' => 'error', 'text' => 'Si è verificato un problema durante il caricamento. Riprova.'];
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Dati profilo utente
|
||||
* ---------------------------------------------------------------------- */
|
||||
$idprofile = null;
|
||||
$datebirthFromDatabase = '';
|
||||
$yogaforFromDatabase = '';
|
||||
$healthissueFromDatabase = '';
|
||||
$generalcommentFromDatabase = '';
|
||||
|
||||
$stmtProfile = $pdo->prepare("SELECT * FROM userprofile WHERE iduser = :iduser LIMIT 1");
|
||||
$stmtProfile->execute([':iduser' => $iduserlogin]);
|
||||
$rowdata = $stmtProfile->fetch();
|
||||
|
||||
// Query per selezionare i dati filtrati per iduser
|
||||
$query = "SELECT * FROM certificateuserprofile WHERE iduser = $iduserlogin";
|
||||
$result = $conn->query($query);
|
||||
|
||||
// Array per memorizzare i risultati
|
||||
$documents = array();
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$documents[] = $row;
|
||||
}
|
||||
|
||||
|
||||
// Ottieni i dati dal database in base all'id dell'utente
|
||||
$sqldata = "SELECT * FROM userprofile WHERE iduser = '$iduser'";
|
||||
$resultdata = $conn->query($sqldata);
|
||||
|
||||
if ($resultdata->num_rows > 0) {
|
||||
$rowdata = $resultdata->fetch_assoc();
|
||||
$idprofile=$rowdata['iduserprofile'];
|
||||
$datebirthFromDatabase = $rowdata['datebirth'];
|
||||
$yogaforFromDatabase = $rowdata['yogafor'];
|
||||
$healthissueFromDatabase = $rowdata['healthissue'];
|
||||
$generalcommentFromDatabase = $rowdata['generalcomment'];
|
||||
if ($rowdata) {
|
||||
$idprofile = $rowdata['iduserprofile'];
|
||||
$datebirthFromDatabase = $rowdata['datebirth'] ?? '';
|
||||
$yogaforFromDatabase = $rowdata['yogafor'] ?? '';
|
||||
$healthissueFromDatabase = $rowdata['healthissue'] ?? '';
|
||||
$generalcommentFromDatabase = $rowdata['generalcomment'] ?? '';
|
||||
}
|
||||
|
||||
$isUpdate = !empty($idprofile);
|
||||
$currentYear = date('Y');
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Profilo Utente</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSoul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title>YogiBook - Prenotazioni YogaSoul</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="YogiBook - Prenotazione facile YogaSOul" name="description" />
|
||||
<meta content="Advanced Creative Solutions" name="author" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="assets/images/favicon.ico">
|
||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||
|
||||
<!-- Bootstrap Css -->
|
||||
<link href="assets/css/bootstrap.min.css" id="bootstrap-style" rel="stylesheet" type="text/css" />
|
||||
<!-- Icons Css -->
|
||||
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
<!-- App Css-->
|
||||
<link href="assets/css/app.min.css" id="app-style" rel="stylesheet" type="text/css" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
|
||||
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
|
||||
<script>
|
||||
// Inizializza il datepicker
|
||||
$(function() {
|
||||
$("#datebirth").datepicker({
|
||||
changeYear: true, // Abilita la selezione dell'anno
|
||||
yearRange: "1900:{{TUA_ANNO_CORRENTE}}", // Specifica l'intervallo di anni
|
||||
dateFormat: "yy-mm-dd" // Formato della data
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#expiryDate").datepicker({ dateFormat: "yy-mm-dd" });
|
||||
$("#datebirth").datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
yearRange: "1900:<?php echo $currentYear; ?>",
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
$("#expiryDate").datepicker({
|
||||
changeYear: true,
|
||||
changeMonth: true,
|
||||
dateFormat: "yy-mm-dd"
|
||||
});
|
||||
});
|
||||
|
||||
// Mostra il nome del file scelto e valida lato client (feedback immediato)
|
||||
function handleFileChange(input) {
|
||||
var label = document.getElementById('fileChosenLabel');
|
||||
if (!input.files.length) {
|
||||
label.textContent = 'Nessun file selezionato';
|
||||
return;
|
||||
}
|
||||
var f = input.files[0];
|
||||
var allowed = ['application/pdf', 'image/jpeg', 'image/png'];
|
||||
var maxBytes = 8 * 1024 * 1024;
|
||||
if (allowed.indexOf(f.type) === -1) {
|
||||
label.textContent = 'Formato non valido: usa PDF, JPG o PNG';
|
||||
label.style.color = '#dc3545';
|
||||
input.value = '';
|
||||
return;
|
||||
}
|
||||
if (f.size > maxBytes) {
|
||||
label.textContent = 'File troppo grande (max 8 MB)';
|
||||
label.style.color = '#dc3545';
|
||||
input.value = '';
|
||||
return;
|
||||
}
|
||||
label.textContent = f.name;
|
||||
label.style.color = '#198754';
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.custom-card {
|
||||
margin: 10px auto;
|
||||
display: flex;
|
||||
width: 90%;
|
||||
max-width: 700px;
|
||||
background-color: white;
|
||||
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.custom-card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
<style>
|
||||
.profile-wrap {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.custom-date-box {
|
||||
flex: 1;
|
||||
background-color: red;
|
||||
color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
font-size: 60px;
|
||||
font-weight: bold;
|
||||
border-top-left-radius: 8px;
|
||||
border-bottom-left-radius: 8px;
|
||||
}
|
||||
.profile-card {
|
||||
border: none;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.custom-day {
|
||||
line-height: 1;
|
||||
}
|
||||
.profile-card .card-body {
|
||||
padding: 28px 32px;
|
||||
}
|
||||
|
||||
.custom-month {
|
||||
font-size: 28px;
|
||||
}
|
||||
.section-title {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
color: #6b7280;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.custom-event-details {
|
||||
flex: 2;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px 20px;
|
||||
background-color: lightblue;
|
||||
}
|
||||
.section-lead {
|
||||
color: #9ca3af;
|
||||
font-size: 14px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
.custom-heading {
|
||||
margin-top: 0;
|
||||
font-size: 24px;
|
||||
}
|
||||
.form-field {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.custom-paragraph {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.form-field label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
color: #374151;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.custom-actions {
|
||||
display: none;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.form-field .form-control {
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e2e4e9;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.custom-card.expanded .custom-actions {
|
||||
display: flex;
|
||||
}
|
||||
.form-field .form-control:focus {
|
||||
border-color: #1ebf73;
|
||||
box-shadow: 0 0 0 3px rgba(30, 191, 115, 0.12);
|
||||
}
|
||||
|
||||
.custom-action-button {
|
||||
background-color: #f0f0f0;
|
||||
border: none;
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
.divider {
|
||||
height: 1px;
|
||||
background: #eef0f3;
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.custom-action-button:hover {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
/* Area upload */
|
||||
.upload-drop {
|
||||
border: 2px dashed #d5d9e0;
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
text-align: center;
|
||||
transition: border-color 0.2s, background 0.2s;
|
||||
background: #fafbfc;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.custom-card {
|
||||
flex-direction: column;
|
||||
}
|
||||
.upload-drop:hover {
|
||||
border-color: #1ebf73;
|
||||
background: #f6fdf9;
|
||||
}
|
||||
|
||||
.custom-date-box, .custom-event-details {
|
||||
width: 100%;
|
||||
border-radius: 0;
|
||||
}
|
||||
.upload-icon {
|
||||
font-size: 30px;
|
||||
color: #1ebf73;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.custom-event-time {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function confirmDelete(id, deletePageUrl) {
|
||||
Swal.fire({
|
||||
title: "Sei sicuro?",
|
||||
text: "Questa prenotazione verrà cancellata definitivamente! Ricordati poi di riprogrammare la tua lezione!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
cancelButtonColor: "#3085d6",
|
||||
confirmButtonText: "Sì, cancella!",
|
||||
cancelButtonText: "Annulla"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// Reindirizza direttamente alla pagina di cancellazione con l'ID come parametro.
|
||||
window.location.href = `deleteclass.php?id=${id}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
.file-chosen {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
<!-- <body data-layout="horizontal"> -->
|
||||
.btn-save {
|
||||
border-radius: 8px;
|
||||
padding: 10px 26px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
<!-- Begin page -->
|
||||
<div id="layout-wrapper">
|
||||
|
||||
<!-- Top Bar -->
|
||||
<header id="page-topbar" class="isvertical-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
<!-- LOGO -->
|
||||
<?php include('include/logoarea.php'); ?>
|
||||
|
||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
||||
<i class="bx bx-menu align-middle"></i>
|
||||
</button>
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="page-title-box align-self-center d-none d-md-block">
|
||||
<h4 class="page-title mb-0">Profilo Utente</h4>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
.hint {
|
||||
font-size: 12px;
|
||||
color: #9ca3af;
|
||||
margin-top: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="layout-wrapper">
|
||||
<header id="page-topbar" class="isvertical-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
<?php include('include/logoarea.php'); ?>
|
||||
<button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect vertical-menu-btn">
|
||||
<i class="bx bx-menu align-middle"></i>
|
||||
</button>
|
||||
<div class="page-title-box align-self-center d-none d-md-block">
|
||||
<h4 class="page-title mb-0">Profilo Utente</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<?php include('include/languageselection.php'); ?>
|
||||
<?php include('include/profiletopbar.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php include('include/sidebar.php'); ?>
|
||||
<header class="ishorizontal-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex"></div>
|
||||
</div>
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu"></nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="d-flex">
|
||||
|
||||
<?php include('include/languageselection.php'); ?>
|
||||
<div class="main-content">
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<div class="profile-wrap">
|
||||
|
||||
<div class="dropdown d-inline-block">
|
||||
<button type="button" class="btn header-item noti-icon"
|
||||
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="bx bx-search icon-sm align-middle"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end p-0">
|
||||
<form class="p-2">
|
||||
<div class="search-box">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control rounded bg-light border-0" placeholder="Search...">
|
||||
<i class="bx bx-search search-icon"></i>
|
||||
</div>
|
||||
<?php if ($message === 'success') : ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
Profilo aggiornato con successo.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($uploadFeedback) : ?>
|
||||
<div class="alert alert-<?php echo $uploadFeedback['type'] === 'success' ? 'success' : 'danger'; ?>" role="alert">
|
||||
<?php echo e($uploadFeedback['text']); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Dati profilo -->
|
||||
<div class="card profile-card mb-4">
|
||||
<div class="card-body">
|
||||
<div class="section-title">I tuoi dati</div>
|
||||
<p class="section-lead">Compila o aggiorna le informazioni del tuo profilo.</p>
|
||||
|
||||
<form action="process.php" method="post">
|
||||
<input type="hidden" name="iduser" value="<?php echo e($iduserlogin); ?>">
|
||||
<input type="hidden" name="kind" value="<?php echo $isUpdate ? 'update' : 'insert'; ?>">
|
||||
|
||||
<div class="form-field">
|
||||
<label for="datebirth">Data di nascita</label>
|
||||
<input type="text" id="datebirth" class="form-control" name="datebirth"
|
||||
value="<?php echo e($datebirthFromDatabase); ?>" placeholder="AAAA-MM-GG" required>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="yogafor">Yoga praticato</label>
|
||||
<textarea id="yogafor" name="yogafor" class="form-control" rows="3"><?php echo e($yogaforFromDatabase); ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="healthissue">Problemi di salute</label>
|
||||
<textarea id="healthissue" name="healthissue" class="form-control" rows="3"><?php echo e($healthissueFromDatabase); ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="generalcomment">Commenti generali</label>
|
||||
<textarea id="generalcomment" name="generalcomment" class="form-control" rows="3"><?php echo e($generalcommentFromDatabase); ?></textarea>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-save" name="submit">
|
||||
<?php echo $isUpdate ? 'Aggiorna profilo' : 'Salva profilo'; ?>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php include('include/profiletopbar.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php include('include/sidebar.php'); ?>
|
||||
|
||||
<header class="ishorizontal-topbar">
|
||||
<div class="navbar-header">
|
||||
<div class="d-flex">
|
||||
|
||||
<!-- Upload certificato -->
|
||||
<div class="card profile-card">
|
||||
<div class="card-body">
|
||||
<div class="section-title">Certificati e documenti</div>
|
||||
<p class="section-lead">Carica il tuo certificato medico o altri documenti (PDF, JPG o PNG, max 8 MB).</p>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="topnav">
|
||||
<div class="container-fluid">
|
||||
<nav class="navbar navbar-light navbar-expand-lg topnav-menu">
|
||||
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start right Content here -->
|
||||
<!-- ============================================================== -->
|
||||
<div class="main-content">
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<?php if ($message=='success') { ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
Profilo aggiornato con successo!
|
||||
</div>
|
||||
<?php } ?>
|
||||
<p>Di seguito puoi compilare o aggiornare il tuo profilo</p>
|
||||
<div class="table-responsive">
|
||||
<?php if (empty($idprofile)) { ?>
|
||||
<form action="process.php" method="post">
|
||||
<input type="hidden" class="form-control" name="iduser" value="<?php echo $iduserlogin; ?>">
|
||||
<input type="hidden" class="form-control" name="kind" value="insert">
|
||||
<label>Data di nascita:</label>
|
||||
<input type="text" id="datebirth" class="form-control" name="datebirth" value="<?php if (isset($datebirthFromDatabase)) { echo $ $datebirthFromDatabase; } ?>" required><br>
|
||||
|
||||
<label>Yoga praticato:</label>
|
||||
<textarea name="yogafor" class="form-control" rows="4" cols="50"></textarea><br>
|
||||
|
||||
<label>Problemi di salute:</label>
|
||||
<textarea name="healthissue"class="form-control" rows="4" cols="50"></textarea><br>
|
||||
|
||||
<label>Commenti generali:</label>
|
||||
<textarea name="generalcomment" class="form-control" rows="4" cols="50"></textarea><br>
|
||||
|
||||
<input type="submit" class="btn btn-primary w-md" name="submit" value="Inserisci">
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
<form action="process.php" method="post">
|
||||
<input type="hidden" class="form-control" name="iduser" value="<?php echo $iduserlogin; ?>">
|
||||
<input type="hidden" class="form-control" name="kind" value="update">
|
||||
<label>Data di nascita:</label>
|
||||
<input type="text" id="datebirth" class="form-control" name="datebirth" value="<?php if (isset($datebirthFromDatabase)) { echo $datebirthFromDatabase; } ?>" required><br>
|
||||
|
||||
<label>Yoga praticato:</label>
|
||||
<textarea name="yogafor" class="form-control" rows="4" cols="50"><?php if (isset($yogaforFromDatabase)) { echo $yogaforFromDatabase; } ?></textarea><br>
|
||||
|
||||
<label>Problemi di salute:</label>
|
||||
<textarea name="healthissue"class="form-control" rows="4" cols="50"><?php if (isset($healthissueFromDatabase)) { echo $healthissueFromDatabase; } ?></textarea><br>
|
||||
|
||||
<label>Commenti generali:</label>
|
||||
<textarea name="generalcomment" class="form-control" rows="4" cols="50"><?php if (isset($generalcommentFromDatabase)) { echo $generalcommentFromDatabase; } ?></textarea><br>
|
||||
|
||||
<input type="submit" class="btn btn-primary w-md" name="submit" value="Aggiorna">
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
<div class="form-field">
|
||||
<label for="documentDescription">Descrizione documento</label>
|
||||
<input type="text" id="documentDescription" class="form-control"
|
||||
name="documentDescription" placeholder="Es. Certificato medico 2026" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label for="expiryDate">Data di scadenza</label>
|
||||
<input type="text" id="expiryDate" class="form-control" name="expiryDate" placeholder="AAAA-MM-GG">
|
||||
<div class="hint">Lascia vuoto se il documento non ha scadenza.</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<label>File</label>
|
||||
<label class="upload-drop d-block" for="fileToUpload" style="cursor:pointer;">
|
||||
<div class="upload-icon"><i class="fas fa-cloud-arrow-up"></i></div>
|
||||
<div>Clicca per selezionare un file</div>
|
||||
<span class="file-chosen" id="fileChosenLabel">Nessun file selezionato</span>
|
||||
</label>
|
||||
<input type="file" id="fileToUpload" name="fileToUpload" class="d-none"
|
||||
accept=".pdf,.jpg,.jpeg,.png" onchange="handleFileChange(this)" required>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-save">Carica documento</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php include('include/footer.php'); ?>
|
||||
</div>
|
||||
<!-- end main content-->
|
||||
|
||||
</div>
|
||||
<!-- END layout-wrapper -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT -->
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
|
||||
<script src="assets/js/app.js"></script>
|
||||
|
||||
</body>
|
||||
<script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/libs/metismenujs/metismenujs.min.js"></script>
|
||||
<script src="assets/libs/simplebar/simplebar.min.js"></script>
|
||||
<script src="assets/libs/eva-icons/eva.min.js"></script>
|
||||
<script src="assets/js/app.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user