gest366/modules/utenti_logo/actions.php

48 lines
1.5 KiB
PHP
Raw Permalink Normal View History

2021-02-24 20:40:04 +00:00
<?php
include_once("../../core.php");
$module_name = "Logo";
switch( $html->form('op', 'post') ){
case "update":
$descrizione = save($_POST['descrizione']);
$dbo->query("UPDATE zz_utenti_logo SET descrizione=\"".$descrizione."\" WHERE id=\"".$id_record."\"");
$_SESSION['nome_gestonale360'] = $descrizione;
$f = pathinfo( $_FILES['immagine01']['name'] );
$filename = $f['filename'].".png";
$tmp = $_FILES['immagine01']['tmp_name'];
$upload_dir = $docroot."/assets/img/";
if( $_FILES['immagine01']['name'] != '' ){
$filename = unique_filename( $filename, $upload_dir );
if( create_thumbnails( $tmp, $filename, $upload_dir ) ){
$dbo->query("UPDATE zz_utenti_logo SET immagine=\"".$filename."\" WHERE id=\"".$id_record."\"");
}
else{
array_push( $_SESSION['warnings'], "Errore durante il caricamento del file in ".$upload_dir."!" );
}
}
//Eliminazione file
if( $html->form('immagine01','post') == 'deleteme' ){
$filename = $html->form('prev_immagine01', 'post');
$f = pathinfo($filename);
if( $dbo->query("UPDATE zz_utenti_logo SET immagine='' WHERE id=\"".$id_record."\"") ){
}
}
$query = "SELECT id FROM zz_modules WHERE name='".$module_name."'";
$rs_testmodulo = $dbo->fetchArray($query);
array_push( $_SESSION['infos'], "Informazioni salvate correttamente!" );
redirect($rootdir."/editor.php?id_module=".$rs_testmodulo[0]['id']."&id_record=".$id_record);
break;
}
?>