Пример #1
0
function delete_file()
{
    /*
    [_POST] => Array
            (
                [_database] => biochemistry
                [_tablename] => equipment_record
                [_pri_id] => 11
                [_attachment_id] => 14
                [attachment_name] => 
                [action] => delete_file
            )
    */
    $wr = make_where($_POST);
    //echo $wr;
    if (strlen($wr) > 0) {
        //echo $wr;
        $sql_attachment = 'delete from attachment where id=\'' . $_POST['_attachment_id'] . '\'';
        $sql_link = 'update `' . $_POST['_tablename'] . '` set attach=\'0\' where ' . $wr;
        //echo $sql_attachment.'<br>';
        //echo $sql_link.'<br>';
        $link = mysql_connect('127.0.0.1', $_SESSION['login'], $_SESSION['password']);
        mysql_select_db('attachment', $link);
        if (!($result = mysql_query($sql_attachment, $link))) {
            echo mysql_error();
        } else {
            echo mysql_affected_rows($link) . ' attachment id=' . $_POST['_attachment_id'] . ' deleted in attachment database<br>';
            mysql_select_db($_POST['_database'], $link);
            if (!($result = mysql_query($sql_link, $link))) {
                echo mysql_error();
            }
        }
    }
}
Пример #2
0
     } else {
         while (!$rg->EOF) {
             if ($rg->fields["name"] == "") {
                 $rg->fields["name"] = _("Unknown category");
             }
             $data .= "['" . str_replace("_", " ", $rg->fields["name"]) . "'," . $rg->fields["num_events"] . "],";
             $urls .= "'" . $forensic_link . "&category%5B0%5D=" . $rg->fields["cat_id"] . "&category%5B1%5D=" . $rg->fields["id"] . "',";
             $rg->MoveNext();
         }
     }
     $colors = '"#D1E8EF","#ADD8E6","#6FE7FF","#00BFFF","#4169E1","#4682B4","#0000CD","#483D8B","#5355DF","#00008B"';
     break;
     // System status - Last Week
 // System status - Last Week
 case "system":
     $taxonomy = make_where($conn, array("System" => array("Warning", "Emergency", "Critical", "Error", "Notification", "Information", "Debug", "Alert")));
     $sqlgraph = str_replace("TAXONOMY", $taxonomy, $query);
     //print_r($sqlgraph);
     if (!($rg =& $conn->Execute($sqlgraph))) {
         print $conn->ErrorMsg();
     } else {
         while (!$rg->EOF) {
             if ($rg->fields["name"] == "") {
                 $rg->fields["name"] = _("Unknown category");
             }
             $data .= "['" . str_replace("_", " ", $rg->fields["name"]) . "'," . $rg->fields["num_events"] . "],";
             $urls .= "'" . $forensic_link . "&category%5B0%5D=" . $rg->fields["cat_id"] . "&category%5B1%5D=" . $rg->fields["id"] . "',";
             $rg->MoveNext();
         }
     }
     $colors = '"#FFFBCF","#EEE8AA","#F0E68C","#FFD700","#FF8C00","#DAA520","#D2691E","#B8860B","#7F631F"';