Location: PHPKode > projects > Network Managment / Inventory System > clearsite/include/user/graph_add.php
<?php

extract($_POST);
extract($_GET);

$configpath = str_replace("/user/graph_add.php", "", __FILE__) . "/config.php";
include($configpath);

mysql_connect("$DBhost:$DBport",$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");

  if (empty($act)) {
    $graph_page_query = "SELECT DISTINCT page_name FROM user_groups WHERE user_ID = \"$user_ID\" ORDER BY page_name";
    $graph_page_results = mysql_query($graph_page_query);
    $graph_page_num_rows = mysql_num_rows($graph_page_results);
    if ($interface_type == "css_cr") {
      $detail_name = "cr_ID";
    } else if ($interface_type == "cpus") {
      $detail_name = "cpu_ID";
    } else if ($interface_type == "css_sv") {
      $detail_name = "sv_ID";
    } else if ($interface_type == "css_owner") {
      $detail_name = "owner_ID";
    } else if ($interface_type == "vpn_stats") {
      $detail_name = "device_ID";
    } else if ($interface_type == "wap_stats") {
      $detail_name = "device_ID";
    } else {
      $detail_name = "interface_ID";
    };
    print "
            <form action=\"$ClearsiteBaseURL/include/user/graph_add.php\" method=\"POST\" onsubmit=\"docClickLoader.submitInto(this, 'graph_page', event)\">
             <input type=\"hidden\" name=\"act\" value=\"add\">
             <input type=\"hidden\" name=\"user_ID\" value=\"$user_ID\">
             <input type=\"hidden\" name=\"interface_type\" value=\"$interface_type\">
             <input type=\"hidden\" name=\"interface_ID\" value=\"$detail_ID\">
             <input type=\"hidden\" name=\"label\" value=\"$label\" />";
    if ($graph_page_num_rows >= "1") {
      print "Add to: <select name=\"page_name_exist\">";
      while ($graph_page_row = mysql_fetch_assoc($graph_page_results)) {
        print "<option value=\"$graph_page_row[page_name]\">$graph_page_row[page_name]</option>";
      };
      print "</select>";
    };
    print "<br />
           Create new group name:<input type=\"text\" name=\"page_name_new\">
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"submit\" value=\"SUBMIT\">
          </form>";
  } else if ($act == "add") {
    if (empty($page_name_new)) {
      $page_name_final = $page_name_exist;
    } else {
      $page_name_final = $page_name_new;
    };
    $graph_add_query = "INSERT INTO user_groups SET user_ID=\"$user_ID\", page_name=\"$page_name_final\", interface_type=\"$interface_type\", interface_ID=\"$interface_ID\", label=\"$label\"";
    $graph_add_result = mysql_query($graph_add_query);
    print "I type = $interface_type<br>
           I ID = $interface_ID<br>
           Label = $label<br />
           Page Name = $page_name_final<br>
           Added";
  };

mysql_close();

?>
Return current item: Network Managment / Inventory System