Exemple #1
0
         //if it doesn't exist then start adding
         if (!$exist) {
             //set the information
             $my_vlan->set_vlan_id($_POST['id']);
             $my_vlan->set_name($_POST["name"]);
             $my_vlan->set_status($_POST["status"]);
             $my_vlan->set_location($_POST["location"]);
             $my_vlan->set_assigned_to($_POST["assign"]);
             $my_vlan->set_notes($_POST["notes"]);
             $my_vlan->set_vlan_distinguisher($_POST['distinguish']);
             //insert a new vlan, if inserted then show the new vlan
             if ($new_id = $my_vlan->insert()) {
                 echo "<meta http-equiv=\"REFRESH\" content=\"0;url=" . $_SERVER['SCRIPT_NAME'] . "?tab=" . $_GET['tab'] . "&pluginID=" . $_GET['pluginID'] . "&className=" . $_GET['className'] . "&family=vlan&success=add\">";
             } else {
                 //if it failed show why
                 Form::warning("INSERT Failed. Reason: " . $my_vlan->get_error());
             }
         } else {
             //if check failed, show that
             Form::warning("The VLAN is already in use.");
         }
     } else {
         //if the id is invalid show that
         Form::warning("The VLAN ID is invalid.");
     }
 } else {
     if (isset($_POST['searchVLAN'])) {
         //search the database with the information
         $results = Vlan_database::Search($_POST['id'], $_POST['name'], $_POST['status'], $_POST['location'], $_POST['assign'], $_POST['distinguish'], $_POST['notes']);
         //if search was successful, show it
         echo "<div style='float:left; clear:both'>" . Form::success("Search successful. Found " . count($results) . " results") . "</div>";