Ejemplo n.º 1
0
/**
 * Author : Jan Germann
 * Datum : 26.04.2010
 * Modul : files
 * Beschreibung : Dateiendaten Editieren
 *				  in 3 Schritten: Datei auswählen, Dateidaten anzeigen und ändern
 *				  und am ende die Dateidaten Updaten
*/
function edit()
{
    global $msg, $log, $mysql;
    if (!isset($_POST['id'])) {
        //Prüfen ob Dateien zum Editieren in der Datenbank vorhanden sind
        if (1 > mysql_result(mysql_query("SELECT count(*) FROM " . _PREFIX_ . "files"), 0)) {
            $msg->error("Es gibt noch keine Dateien die editiert werden können.");
            return;
        }
        //Selectfeld mit Dateien vorbereiten
        $q = mysql_query("SELECT * FROM " . _PREFIX_ . "files ORDER BY name");
        while ($r = mysql_fetch_object($q)) {
            $data .= "<option value=" . $r->id . ">" . $r->name . "</option>";
        }
        // Template ausfüllen -->
        $tpl = dirname(__FILE__) . "/template/form.edit.choose.tpl";
        $tpl = file_get_contents($tpl);
        return str_replace("%files%", $data, $tpl);
        // <-- Template ausfüllen
    } elseif (isset($_POST['id']) && !isset($_POST['name'])) {
        $q = mysql_query("SELECT * FROM " . _PREFIX_ . "files WHERE id='" . intval($_POST['id']) . "'");
        $o = mysql_fetch_object($q);
        // Template ausfüllen -->
        $tpl = dirname(__FILE__) . "/template/form.edit.tpl";
        if (is_file($tpl)) {
            $template = file_get_contents($tpl);
        }
        $template = str_replace(array("%id%", "%name%", "%description%", "%file%"), array($o->id, $o->name, $o->description, $o->file), $template);
        // <-- Template ausfüllen
        return $template;
    } elseif (isset($_POST['id']) && isset($_POST['name'])) {
        if (empty($_POST['name'])) {
            $msg->error("Sie haben keinen Namen angegeben.");
            unset($_POST['name']);
            return edit();
        }
        //Wenn kein Fehler beim Dateiupload bekannt ist soll die Datei ersetzt werden.
        if (!$_FILES['file']['error']) {
            update_file($_POST['id'], $_FILES['file']);
        }
        $name = mysql_real_escape_string($_POST['name']);
        $description = mysql_real_escape_string($_POST['description']);
        $id = intval($_POST['id']);
        $mysql->query("UPDATE " . _PREFIX_ . "files\r\n\t\t\t\t\t   SET name = '" . $name . "',\r\n\t\t\t\t\t\t   description = '" . $description . "'\r\n\t\t\t\t\t   WHERE id = '" . $id . "'\r\n\t\t\t\t\t   LIMIT 1");
        $msg->success("Datei editiert.");
        $log->add("Dateiupdate", "<id>" . $id . "</id><name>" . $name . "</name><description>" . $description . "</description>");
    }
}
Ejemplo n.º 2
0
function send_log($text)
{
    #update log on the fly
    global $tm_logpath;
    //make a constant!
    global $logfilename;
    global $log_proc_id;
    global $log_q_id;
    global $log_nl_id;
    global $log_grp_id;
    global $log_adr_id;
    global $called_via_url;
    $timestamp = microtime(TRUE);
    //microtime(TRUE);
    $datetime = date("Y-m-d H:i:s");
    $log = "";
    $log .= "[" . $timestamp . "][" . $log_proc_id . "]," . $datetime . ",q:" . $log_q_id . ",n:" . $log_nl_id . ",g:" . $log_grp_id . ",a:" . $log_adr_id;
    $log .= ",t: " . $text;
    $log .= "\n";
    update_file($tm_logpath, $logfilename, $log);
    #output to browser or cron:
    echo $log;
    if ($called_via_url) {
        #echo "<br>";
    }
    #echo(str_repeat(' ',256));
    // check that buffer is actually set before flushing
    if (ob_get_length()) {
        //http://www.php.net/manual/de/function.ob-end-flush.php
        flush();
        ob_end_flush();
        #ob_end_clean();
        #$out=ob_get_contents() ;
        #ob_flush();
    }
    ob_start();
}
Ejemplo n.º 3
0
        $pubblicato_eur = "t";
    }
    if (isset($_POST["pubblicato_uk"]) and $_POST["pubblicato_uk"] == "t") {
        $pubblicato_uk = "t";
    }
    $object = new Prodotti();
    if (isset($_POST["insert"]) and $_POST["insert"] == "si") {
        $object->add($fk_cm, $fk_cat, $fk_sottocat, $code, $titolo, $titolo_ita, $titolo_ted, $desc, $desc_ita, $desc_ted, $prezzounita, $prezzounita_eur, $numpezzi, $prezzooff, $prezzooff_eur, $dimensione, $peso, $magazzino, $magazzino_eng, $pubblicato_eur, $pubblicato_uk, $nuovo);
        //recupero l'ultimo id inserito
        $db = new Db();
        $id = $db->get_last_id();
    } elseif (isset($_POST["update"]) and $_POST["update"] == "si") {
        $id = aggiusta_post($_GET["id"]);
        $object->update($id, $fk_cm, $fk_cat, $fk_sottocat, $code, $titolo, $titolo_ita, $titolo_ted, $desc, $desc_ita, $desc_ted, $prezzounita, $prezzounita_eur, $numpezzi, $prezzooff, $prezzooff_eur, $dimensione, $peso, $magazzino, $magazzino_eng, $pubblicato_eur, $pubblicato_uk, $nuovo);
        //upload dei file
        update_file("pr_prodotti", "prodotti_dettaglio.php?errore=file&id=" . $id, $id);
    }
    //gestione listini: cancello e reinserisco
    $objPrezzi->delete_byproduct($id);
    foreach ($arrListini as $list) {
        $sterline = $_POST["prezzo_" . $list["list_id"]];
        $euro = $_POST["prezzo_eur_" . $list["list_id"]];
        $sterline_off = $_POST["prezzo_off_" . $list["list_id"]];
        $euro_off = $_POST["prezzo_eur_off_" . $list["list_id"]];
        if ($sterline != "" and $sterline != 0 or $euro != "" and $euro != 0) {
            $objPrezzi->add($list["list_id"], $id, $sterline, $euro, $sterline_off, $euro_off);
        }
    }
    print "<script language='Javascript'>window.location.replace('prodotti_dettaglio.php?id=" . $id . "&ins=si');</script>";
}
$fkclasse = "";
Ejemplo n.º 4
0
if (preg_match("/^(https:\\/\\/[^@]+)@(\\d+)\$/", $svnUrl, $matches) == 0) {
    echo "错误:无效的svn地址!";
    return;
}
$version = $matches[2];
if (!file_exists($target_dir)) {
    mkdir($target_dir);
}
$target_dir = realpath($target_dir);
$target_dir = $target_dir . "/" . $version;
if (file_exists($target_dir)) {
    echo "错误:该版本已经存在!";
    return;
}
$temp_arr = array('$current_file$' => $expect_script_file, '$user_name$' => $ldap, '$svn_url$' => $svnUrl, '$target_dirname$' => $target_dir, '$password$' => $passwd);
$ret = update_file($input_file, $expect_script_file, $temp_arr);
if ($ret == false) {
    $retArr = get_lib_result();
    echo $retArr["msg"];
    return;
}
$run_cmd = "chmod 700 {$expect_script_file}; {$expect_script_file}";
exec($run_cmd, $lines, $ret);
$log_content = implode("\n", $lines);
echo $log_content, "\n";
if (strpos($log_content, "authorization failed:") !== false || strpos($log_content, "doesn't exist") !== false) {
    return;
}
echo "\n\n", "=================================================================================================================", "\n\n";
$ret = dbUtil(SaveCodePathInfo, $svnUrl, $version, $prodName, $ldap);
$retArr = dbUtil(GetStatus);
Ejemplo n.º 5
0
<?php

/**
 * Created by PhpStorm.
 * User: Nomad_Mystic
 * Date: 11/17/2015
 * Time: 11:05 PM
 */
require_once 'includes/constants.php';
require_once 'includes/utilities.php';
require_secure();
$key = isset($_POST['key']) ? $_POST['key'] : null;
$value = isset($_POST['value']) ? $_POST['value'] : null;
if (!empty($key) && !empty($value)) {
    update_file(htmlentities($key), password_hash($value, PASSWORD_DEFAULT));
}
?>

<!doctype html>
<html lang="en">
<head>
     <meta charset="UTF-8">
     <title>Modify File</title>
</head>
<body>
     <form action="login.php" method="POST">
          <lable>
               Username:
          </lable>
          <input type="text" name="key"><br>
          <lable>
Ejemplo n.º 6
0
/**
 * Author : Jan Germann
 * Datum : 05.05.2010
 * Modul : images
 * Beschreibung : Dateiendaten Editieren
 *				  in 3 Schritten: Datei auswählen, Dateidaten anzeigen und ändern
 *				  und am ende die Dateidaten Updaten
*/
function edit()
{
    global $msg, $log, $mysql;
    if (!isset($_POST['id'])) {
        //Prüfen ob Dateien zum Editieren in der Datenbank vorhanden sind
        if (1 > mysql_result(mysql_query("SELECT count(*) FROM " . _PREFIX_ . "images"), 0)) {
            $msg->error("Es gibt noch keine Bilder die editiert werden können.");
            return;
        }
        //Auswahl mit Bilddateien vorbereiten
        $tpl = @file_get_contents(dirname(__FILE__) . "/template/form.edit.choose.token.tpl");
        $q = mysql_query("SELECT * FROM " . _PREFIX_ . "images ORDER BY name");
        while ($r = mysql_fetch_object($q)) {
            $data .= str_replace(array("%id%", "%name%", "%fullurl%", "%thumburl%"), array($r->id, $r->name, IMAGE_DIR . $r->file, IMAGE_DIR . $r->file_t), $tpl);
        }
        // Template ausfüllen -->
        $tpl = @file_get_contents(dirname(__FILE__) . "/template/form.edit.choose.tpl");
        $tpl = str_replace("%files%", $data, $tpl);
        // <-- Template ausfüllen
        return $tpl;
    } elseif (isset($_POST['id']) && !isset($_POST['name'])) {
        $q = mysql_query("SELECT * FROM " . _PREFIX_ . "images WHERE id='" . intval($_POST['id']) . "'");
        $o = mysql_fetch_object($q);
        // Template ausfüllen -->
        $tpl = @file_get_contents(dirname(__FILE__) . "/template/form.edit.tpl");
        $tpl = str_replace(array("%id%", "%name%", "%description%", "%file%"), array($o->id, $o->name, $o->description, $o->file), $tpl);
        // <-- Template ausfüllen
        return $tpl;
    } elseif (isset($_POST['id']) && isset($_POST['name'])) {
        $id = intval($_POST['id']);
        $name = mysql_real_escape_string($_POST['name']);
        $description = mysql_real_escape_string($_POST['description']);
        /**
         * Überprüfen ob überhaupt ein Name angegeben wurde und wenn,
         * dass dieser nicht schon vorhanden ist
         */
        if (empty($_POST['name'])) {
            $msg->error("Es wurde kein Name angegeben.");
        } else {
            $cThisName = $mysql->query("SELECT count(*) FROM " . _PREFIX_ . "images WHERE id <>'" . $id . "' AND name = '" . $name . "'");
            if (mysql_result($cThisName, 0)) {
                $msg->error("Es existiert bereits ein anderes Bild mit diesem Namen.");
            }
        }
        /**
         * Wenn überprüfen ob ein Bild hochgeladen wurde,
         * falls es der Fall ist, überprüfen ob die Dateiendung die selbe wie die der vorhandenen Datei ist.
         * Ist dies auch der Fall, Datei updaten
         */
        if (!$_FILES['file']['error']) {
            /**
             * Dateiendung der neuen Datei
             */
            $ext = pathinfo($_FILES['file']['name']);
            $ext_new = mb_convert_case($ext['extension'], MB_CASE_LOWER);
            /**
             * Dateiendung der Datei in der DB
             */
            $qExtension = $mysql->query("SELECT * FROM " . _PREFIX_ . "images WHERE id = '" . $id . "'");
            $oExtension = mysql_fetch_object($qExtension);
            $ext_now = end(explode(".", $oExtension->file));
            if ($ext_new != $ext_now) {
                $msg->error("Die Dateiendung, der neuen Bilddatei [." . $ext_new . "] muss die selbe sein, wie die der vorhandenen Bilddatei [." . $ext_now . "].");
            } else {
                update_file($_POST['id'], $_FILES['file']);
            }
        }
        /**
         * Wenn ein Fehler aufgetreten ist in den vorherigen Schritt springen.
         */
        if ($msg->error) {
            unset($_POST['name']);
            return edit();
        }
        $mysql->query("UPDATE " . _PREFIX_ . "images\r\n\t\t\t\t\t   SET name = '" . $name . "',\r\n\t\t\t\t\t\t   description = '" . $description . "'\r\n\t\t\t\t\t   WHERE id = '" . $id . "'\r\n\t\t\t\t\t   LIMIT 1");
        $msg->success("Datei editiert.");
        $log->add("Dateiupdate", "<id>" . $id . "</id><name>" . $name . "</name><description>" . $description . "</description>");
    }
}
Ejemplo n.º 7
0
//stop queue
if ($set == "stop" && $doit == 1 && check_dbid($q_id)) {
    $QUEUE->setStatus($q_id, 5);
    $LOG = "[" . microtime(TRUE) . "][0]," . date("Y-m-d H:i:s") . ",q:" . $q_id . ",n:0,g:0,a:0,t: Q ID {$q_id} halted\n";
    update_file($tm_logpath, $logfilename, $LOG);
}
//restart queue with failed or canceled/skipped records
if ($set == "restart_failed" && $doit == 1 && check_dbid($q_id)) {
    $QUEUE->restart_failed($q_id);
    $QUEUE->setStatus($q_id, 1);
}
//continue stopped queue
if ($set == "continue" && $doit == 1 && check_dbid($q_id)) {
    $QUEUE->setStatus($q_id, 2);
    $LOG = "[" . microtime(TRUE) . "][0]," . date("Y-m-d H:i:s") . ",q:" . $q_id . ",n:0,g:0,a:0,t: Q ID {$q_id} continues\n";
    update_file($tm_logpath, $logfilename, $LOG);
}
//delete, delete all
if (($set == "delete" || $set == "delete_all") && $doit == 1 && check_dbid($q_id)) {
    //nl auf status queued setzen =2
    //Q holen
    $Q = $QUEUE->getQ($q_id);
    if (isset($Q[0]['id'])) {
        //und q fuer newsletter aus aktueller q holen
        //eintraege zaehlen, wieviele qs fuer newsletter dieser q
        $QNL = $QUEUE->getQ(0, 0, 0, $Q[0]['nl_id']);
        $nqc = count($QNL);
        if ($nqc > 0) {
        }
        //wenn hoechstens 1 eintrag, dann status des nl auf archiv setzen, ...5=archiv
        //ansonsten weiter
Ejemplo n.º 8
0
//controllo se si sta facendo un inserimento
if (isset($_POST["save"]) and $_POST["save"] == "si") {
    $titolo = $_POST["titolo"];
    $descrizione = $_POST["descrizione"];
    $news = new Prodotto();
    if (isset($_POST["insert"]) and $_POST["insert"] == "si") {
        $news->add($data, $link, $titolo, $abstract, $descrizione, $titolo_ita, $abstract_ita, $descrizione_ita, $titolo_ted, $abstract_ted, $descrizione_ted, $home);
        //recupero l'ultimo id inserito
        $db = new Db();
        $id = $db->get_last_id();
    } elseif (isset($_POST["update"]) and $_POST["update"] == "si") {
        $id = aggiusta_post($_GET["id"]);
        $news->update($id, $data, $link, $titolo, $abstract, $descrizione, $titolo_ita, $abstract_ita, $descrizione_ita, $titolo_ted, $abstract_ted, $descrizione_ted, $home);
        //upload dei file
        update_file("news", "news_dettaglio.php?errore=file&id=" . $id, $id);
    }
    print "<script language='Javascript'>window.location.replace('news_dettaglio.php?id=" . $id . "&ins=si');</script>";
}
$data = date("d") . "/" . date("m") . "/" . date("Y");
$link = "";
$titolo = "";
$abstract = "";
$descrizione = "";
$titolo_ita = "";
$abstract_ita = "";
$descrizione_ita = "";
$titolo_ted = "";
$abstract_ted = "";
$descrizione_ted = "";
$home = "";
Ejemplo n.º 9
0
	
	$update = $updates[$module];
	
	$test = true;
	
	include("/home/tigerbox/install/updates/update-db.php");
	
	foreach($updates as $code => $update)	{		  
		if($code == 'GESTION_CONTENU' && !$contenu) {
			// Ne pas mettre a jour la gestion des contenus
		}
		else {
			$files = $update['file'];
			if(count($files)) {
				foreach($files as $file) {
					$success = update_file($file);
				}
			}
		}
	}
	
	$a = 0;
	break;
	
}

/*------------------------------------------------------
		A FAIRE DANS TOUS LES CAS
--------------------------------------------------------*/
?>
<!-- InstanceEndEditable -->
Ejemplo n.º 10
0
function update_attachments($var, $upload_path, $file_name_prefix, $max_count, $old_attachments)
{
    $temp = $old_attachments;
    for ($i = 1; $i <= $max_count; $i++) {
        if (isset($_REQUEST['is_' . $var . '_' . $i])) {
            $old_file_name = '';
            if (isset($temp[$i]['file'])) {
                $old_file_name = $temp[$i]['file'];
            }
            $file_name = update_file($var . '_' . $i, $upload_path, $file_name_prefix . '_' . $i, $old_file_name);
            if (!isset($temp[$i])) {
                $temp[$i] = array('file' => '', 'mime_type' => '', 'text' => '');
            }
            $temp[$i]['file'] = $file_name;
            $temp[$i]['mime_type'] = file_mimetype($file_name);
        } else {
            $old_file_name = '';
            if (isset($temp[$i]['file'])) {
                $old_file_name = $temp[$i]['file'];
            }
            if ($old_file_name != '') {
                delete_file($upload_path, $old_file_name);
            }
            unset($temp[$i]);
        }
        if (isset($_REQUEST[$var . '_' . $i . '_text'])) {
            if (!isset($temp[$i])) {
                $temp[$i] = array('file' => '', 'mime_type' => '', 'text' => '');
            }
            $temp[$i]['text'] = $_REQUEST[$var . '_' . $i . '_text'];
        }
        /*		
        		if($temp[$i]['text'] == '' && isset($_REQUEST['is_'.$var.'_'.$i]) &&
        			isset($_FILES[$var.'_'.$i]) && ($_FILES[$var.'_'.$i]['error'] == UPLOAD_ERR_OK))
        				$temp[$i]['text'] = file_filename($_FILES[$var.'_'.$i]['name']);
        */
    }
    $result = array();
    foreach ($temp as $i => $row) {
        if ($row['file'] || $row['text']) {
            $result[$i] = $row;
        }
    }
    ksort($result);
    return $result;
}
Ejemplo n.º 11
0
function append_file($file_path, $file_name, $file_content = "")
{
    update_file($file_path, $file_name, $file_content);
}
Ejemplo n.º 12
0
<?php

//homework
require_once 'actions.php';
if ($_REQUEST['dir']) {
    $dirNew = $_REQUEST['dir'];
    $path = $_SERVER['DOCUMENT_ROOT'] . $dirNew;
} else {
    $path = $_SERVER['DOCUMENT_ROOT'];
}
if ($_REQUEST['update']) {
    $path = $_REQUEST['path'];
    $content = update_file($path, $_REQUEST['text']);
    echo "File has been updated";
}
if ($_REQUEST['create_file']) {
    $file = create_file($_REQUEST['path'], $_REQUEST['filename']);
} elseif ($_REQUEST['create_folder']) {
    mk_dir($_REQUEST['path'], $_REQUEST['folder_name']);
}
if (is_file($path)) {
    ?>
		<?php 
    $content = read_file($path);
    ?>
		<form>
			<textarea name="text" cols="100" rows="20"><?php 
    echo $content;
    ?>
</textarea>
			<input type="hidden" name="path" value="<?php 
Ejemplo n.º 13
0
        ?>
</textarea>
		</div>
		<button class="btn btn-primary" type="submit" name="updateok" value="OK"><span class="fa fa-check"></span>&nbsp;Update File</button>
		<a href="<?php 
        echo "{$LSP_URL}?action=show&file=" . GET('file');
        ?>
" class="btn btn-warning"><span class="fa fa-close"></span>&nbsp;Cancel</a>
		<input type="hidden" name="fn" value="'.$file_name.'" />
		<input type="hidden" name="action" value="update" />
		<?php 
        $form->close();
        echo '</div>';
    } else {
        $category = explode(' - ', POST('category'))[0];
        $subcategory = explode(' - ', POST('category'))[1];
        $category_id = get_category_id($category);
        $subcategory_id = get_subcategory_id($category_id, $subcategory);
        $license_id = get_license_id(POST('license'));
        $success = false;
        if (update_file(GET('file'), $category_id, $subcategory_id, $license_id, POST('description'))) {
            $success = true;
        }
        show_file(GET('file'), SESSION(), $success);
    }
} else {
    display_error('Sorry, you cannot edit this file.', array('Edit', get_file_url()));
}
?>

        $pubblicato_eur = "t";
    }
    if (isset($_POST["pubblicato_uk"]) and $_POST["pubblicato_uk"] == "t") {
        $pubblicato_uk = "t";
    }
    $object = new Sottocategorie();
    if (isset($_POST["insert"]) and $_POST["insert"] == "si") {
        $object->add($fk_cat, $sottocategoria, $sottocategoria_ita, $sottocategoria_ted, $pubblicato_eur, $pubblicato_uk);
        //recupero l'ultimo id inserito
        $db = new Db();
        $id = $db->get_last_id();
    } elseif (isset($_POST["update"]) and $_POST["update"] == "si") {
        $id = aggiusta_post($_GET["id"]);
        $object->update($id, $fk_cat, $sottocategoria, $sottocategoria_ita, $sottocategoria_ted, $pubblicato_eur, $pubblicato_uk);
        //upload dei file
        update_file("pr_sottocategoria", "sottocategorie_dettaglio.php?errore=file&id=" . $id, $id);
    }
    print "<script language='Javascript'>window.location.replace('sottocategorie_dettaglio.php?id=" . $id . "&ins=si');</script>";
}
$fkclasse = "";
$sottocategoria = "";
$sottocategoria_ita = "";
$sottocategoria_ted = "";
$pubblicato_eur = "";
$pubblicato_uk = "";
if (isset($_GET["id"]) and $_GET["id"] != "") {
    $id = aggiusta_post($_GET["id"]);
    $objCat = new Categorie();
    $arrCat = $objCat->getById($array["sc_fkcat"]);
    $fkclasse = $arrCat["cat_fkclasse"];
    $sottocategoria = $array["sc_sottocat"];
Ejemplo n.º 15
0
    if (isset($_POST["prodotti"]) and $_POST["prodotti"] == "t") {
        $prodotti = "t";
    } else {
        $prodotti = "f";
    }
    $foto = new Foto();
    if (isset($_POST["insert"]) and $_POST["insert"] == "si") {
        $foto->add($titolo, $titolo_ita, $titolo_ted, $home, $prodotti);
        //recupero l'ultimo id inserito
        $db = new Db();
        $id = $db->get_last_id();
    } elseif (isset($_POST["update"]) and $_POST["update"] == "si") {
        $id = aggiusta_post($_GET["id"]);
        $foto->update($id, $titolo, $titolo_ita, $titolo_ted, $home, $prodotti);
        //upload dei file
        update_file("foto", "foto_dettaglio.php?errore=file&id=" . $id, $id);
    }
    print "<script language='Javascript'>window.location.replace('foto_dettaglio.php?id=" . $id . "&ins=si');</script>";
}
$titolo = "";
$titolo_ita = "";
$titolo_ted = "";
$home = "";
$prodotti = "";
if (isset($_GET["id"]) and $_GET["id"] != "") {
    $id = aggiusta_post($_GET["id"]);
    $titolo = $array["ft_titolo"];
    $titolo_ita = $array["ft_titolo_ita"];
    $titolo_ted = $array["ft_titolo_ted"];
    $home = $array["ft_home"];
    $prodotti = $array["ft_prodotti"];
Ejemplo n.º 16
0
//controllo se si sta facendo un inserimento
if (isset($_POST["save"]) and $_POST["save"] == "si") {
    $nome = $_POST["nome"];
    $nome_ita = $_POST["nome_ita"];
    $nome_ted = $_POST["nome_ted"];
    $object = new Classi();
    if (isset($_POST["insert"]) and $_POST["insert"] == "si") {
        $object->add($nome, $nome_ita, $nome_ted);
        //recupero l'ultimo id inserito
        $db = new Db();
        $id = $db->get_last_id();
    } elseif (isset($_POST["update"]) and $_POST["update"] == "si") {
        $id = aggiusta_post($_GET["id"]);
        $object->update($id, $nome, $nome_ita, $nome_ted);
        //upload dei file
        update_file("pr_classe_merceologica", "classi_dettaglio.php?errore=file&id=" . $id, $id);
    }
    print "<script language='Javascript'>window.location.replace('classi_dettaglio.php?id=" . $id . "&ins=si');</script>";
}
$nome = "";
$nome_ita = "";
$nome_ted = "";
if (isset($_GET["id"]) and $_GET["id"] != "") {
    $id = aggiusta_post($_GET["id"]);
    $nome = $array["cm_nome"];
    $nome_ita = $array["cm_nome_ita"];
    $nome_ted = $array["cm_nome_ted"];
}
?>