コード例 #1
0
function Save()
{
    $ocs = new ocs();
    $ocs->HARDWARE_ID = $_POST["HARDWARE_ID"];
    $ocs->LoadParams();
    $ocs->ComputerName = $_POST["computername"];
    $ocs->ComputerIP = $_POST["ipaddr"];
    $ocs->mac = $_POST["MAC"];
    $ocs->UpdateDirect();
}
コード例 #2
0
function softwares_search()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $cmp = new computers($_GET["uid"]);
    $ocs = new ocs($cmp->ComputerMacAddress);
    $ocs->LoadParams();
    $q = new mysql();
    $search = $_GET["search"];
    $search = "*{$search}*";
    $search = str_replace("**", "*", $search);
    $search = str_replace("**", "*", $search);
    $search = str_replace("*", "%", $search);
    $group_text = $tpl->_ENGINE_parse_body("{group}");
    $sql = "SELECT * FROM softwares WHERE HARDWARE_ID={$ocs->HARDWARE_ID} AND ((PUBLISHER LIKE '{$search}') OR (NAME LIKE '{$search}') OR (COMMENTS LIKE '{$search}')) ORDER BY NAME LIMIT 0,50";
    $results = $q->QUERY_SQL($sql, "ocsweb");
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><code style='font-size:11px'>{$sql}</code>";
    }
    $html = "<center>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1% nowrap colspan=2>{PUBLISHER}</th>\n\t\t<th width=99%>{software}</th>\n\t\t<th width=1% align='center'>{version}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (trim($ligne["PUBLISHER"]) == null) {
            $ligne["PUBLISHER"] = "&nbsp;";
        }
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $color = "black";
        $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src='img/software-task-32.png'></td>\n\t\t\t<td style='font-size:14px;font-weight:normal;color:{$color}' nowrap>{$ligne["PUBLISHER"]}</td>\n\t\t\t<td style='font-size:14px;font-weight:normal;color:{$color}'>{$ligne["NAME"]}<div style='font-size:10px'><i>{$ligne["COMMENTS"]}</i></td>\n\t\t\t<td style='font-size:14px;font-weight:normal;color:{$color}' align='center'>{$ligne["VERSION"]}</td>\n\t\t</tr>\n\t\t";
    }
    $html = $html . "</table>\n\t</center>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}