Exemple #1
0
 //if a modification action is called
 if (isset($_GET['action'])) {
     //if this action is delete
     if ($_GET['action'] == 'delete') {
         //create a form to prompt if they really want to delete
         echo "<div style='clear:both'>";
         $form = new Form("auto", 2);
         $form->setAction($_SERVER['SCRIPT_NAME'] . "?tab=" . $_GET['tab'] . "&pluginID=" . $_GET['pluginID'] . "&className=" . $_GET['className'] . "&family=vlan&v_id=" . $_GET['v_id'] . "&action=deleteConfirm");
         $form->prompt("Are you sure you want to delete this vlan?");
         echo "</div>";
     } else {
         if ($_GET['action'] == 'deleteConfirm') {
             //get rid of the vlan from the database and refresh
             if (isset($_POST['deleteYes'])) {
                 $my_vlan = new Vlan_database($_GET['v_id']);
                 if ($my_vlan->delete()) {
                     echo "<meta http-equiv=\"REFRESH\" content=\"0;url=" . $_SERVER['SCRIPT_NAME'] . "?tab=" . $_GET['tab'] . "&pluginID=" . $_GET['pluginID'] . "&className=" . $_GET['className'] . "&family=vlan&success=delete\">";
                 } else {
                     echo $my_vlan->get_error();
                 }
             } else {
                 //if not then go back to the current vlan
                 echo "<meta http-equiv=\"REFRESH\" content=\"0;url=" . $_SERVER['SCRIPT_NAME'] . "?tab=" . $_GET['tab'] . "&pluginID=" . $_GET['pluginID'] . "&className=" . $_GET['className'] . "&family=vlan&v_id=" . $_GET['v_id'] . "\">";
             }
         }
     }
 } else {
     //show the current vlan if nothing else is called
     $form = new Form("auto", 2);
     $v_id = $_GET['v_id'];
     $my_vlan = new Vlan_database($v_id);