예제 #1
0
             if (is_numeric($id)) {
                 if ($protectedPost["newtype"] == 1) {
                     $type = "LONGTEXT";
                 } elseif ($protectedPost["newtype"] == 8) {
                     $type = "BLOB";
                 } else {
                     $type = "VARCHAR(255)";
                 }
                 $sql_add_column = "ALTER TABLE downloadwk_pack ADD COLUMN fields_" . $id . " " . $type . " default NULL";
                 mysql2_query_secure($sql_add_column, $_SESSION['OCS']["writeServer"]);
             } else {
                 msg_error("mysql_insert_id() problem");
             }
         }
         msg_success($l->g(1069));
         reloadform_closeme($protectedGet['form']);
         if ($protectedPost['Valid_modif_x'] != "") {
             unset($protectedPost['newfield'], $protectedPost['newlbl']);
         }
     } else {
         msg_error($ERROR);
     }
 }
 //NAME FIELD
 $name_field = array("newfield");
 $tab_name = array($l->g(1070) . ": ");
 $type_field = array(0);
 $value_field = array($protectedPost['newfield']);
 $config['JAVASCRIPT'][0] = $sql_field;
 if (isset($protectedGet['admin'])) {
     array_push($name_field, "newlbl");
// Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
//====================================================================================
require_once 'require/function_files.php';
require_once 'require/function_ipdiscover.php';
$form_name = 'ipdiscover_analyse';
$table_name = $form_name;
echo open_form($form_name);
$pas = $protectedGet['rzo'];
//$rez = $nomRez;
$values = look_config_default_values(array('IPDISCOVER_IPD_DIR'));
$fname = $values['tvalue']['IPDISCOVER_IPD_DIR'];
$file_name = $fname . "/ipd/" . $pas . ".ipd";
//reset cache?
if (isset($protectedPost['reset']) and $protectedPost['reset'] != '') {
    unlink($file_name);
    reloadform_closeme('', true);
} else {
    $fp = @fopen($file_name, "r");
    if (!$fp) {
        runCommand("-cache -net=" . $pas, $fname);
    }
    @fclose($fp);
    $tabBalises = array($l->g(34) => "IP", $l->g(95) => "MAC", $l->g(49) => "NAME", $l->g(232) => "DATE", $l->g(66) => "TYPE");
    $ret = array();
    $ret = parse_xml_file($file_name, $tabBalises, "HOST");
    if ($ret != array()) {
        $sql = "select ";
        $i = 0;
        while ($ret[$i]) {
            foreach ($ret[$i] as $key => $value) {
                $sql .= "'" . $value . "' as " . $key . ",";
         } else {
             msg_success($l->g(1141));
         }
         //erase ipdiscover cache
         unset($_SESSION['OCS']['DATA_CACHE'][$table_name], $_SESSION['OCS']["ipdiscover"], $protectedPost['ADD_SUB'], $protectedPost['MODIF']);
         require_once BACKEND . 'ipdiscover/ipdiscover.php';
         if (isset($protectedGet['value']) and $protectedGet['value'] != '') {
             reloadform_closeme("ipdiscover", true);
         }
     }
     $tab_options['CACHE'] = 'RESET';
 }
 if (isset($protectedPost['Reset_modif'])) {
     unset($protectedPost['ADD_SUB'], $protectedPost['MODIF']);
     if (isset($protectedGet['value']) and $protectedGet['value'] != '') {
         reloadform_closeme("ipdiscover", true);
     }
 }
 if (isset($protectedPost['ADD_SUB'])) {
     echo "<input type='hidden' name='ADD_SUB' id='ADD_SUB' value='" . $protectedPost['ADD_SUB'] . "'";
 }
 if ($protectedPost['MODIF'] != '') {
     echo "<input type='hidden' name='MODIF' id='MODIF' value='" . $protectedPost['MODIF'] . "'";
 }
 if (isset($protectedPost['ADD_SUB']) or $protectedPost['MODIF']) {
     if ($protectedPost['MODIF']) {
         $title = $l->g(931);
         $result = find_info_subnet($protectedPost['MODIF']);
         if (!isset($protectedPost['RSX_NAME'])) {
             $protectedPost['RSX_NAME'] = $result->NAME;
         }
        $_SESSION['OCS']['MODE_LANGUAGE'] = "ON";
    } elseif ($protectedPost["MODE"] == 4) {
        $_SESSION['OCS']['MODE_LANGUAGE'] = "ON";
        $_SESSION['OCS']['DEBUG'] = "ON";
    } elseif ($protectedPost["MODE"] == 5) {
        if (!isset($_SESSION['OCS']['TRUE_USER'])) {
            $true_user = $_SESSION['OCS']['loggeduser'];
            $list_page_profil = $_SESSION['OCS']['profile']->getPages();
            $restriction = $_SESSION['OCS']['profile']->getRestriction('GUI');
            $loggeduser = $protectedPost["FUSER"];
            unset($_SESSION['OCS']);
            $_SESSION['OCS']['TRUE_USER'] = $true_user;
            $_SESSION['OCS']['TRUE_PAGES'] = $list_page_profil;
            $_SESSION['OCS']['TRUE_RESTRICTION'] = $restriction;
            $_SESSION['OCS']['loggeduser'] = $loggeduser;
        } else {
            $loggeduser = $_SESSION['OCS']['TRUE_USER'];
            $restriction = $_SESSION['OCS']['TRUE_RESTRICTION'];
            unset($_SESSION['OCS']);
            $_SESSION['OCS']['loggeduser'] = $loggeduser;
            $_SESSION['OCS']['profile']->setRestriction('GUI', $restriction);
        }
    } elseif ($protectedPost["MODE"] == 6) {
        if (isset($_SESSION['OCS']["usecache"]) and $_SESSION['OCS']["usecache"] == 1) {
            $_SESSION['OCS']["usecache"] = 0;
        } else {
            $_SESSION['OCS']["usecache"] = 1;
        }
    }
    reloadform_closeme('log_out', true);
}