Example #1
0
     }
     if (!Error::occurred()) {
         $url = AmpConfig::get('web_path') . '/admin/access.php';
         show_confirmation(T_('Added'), T_('Your new Access Control List(s) have been created'), $url);
     } else {
         $action = 'show_add_' . $_POST['type'];
         require_once AmpConfig::get('prefix') . '/templates/show_add_access.inc.php';
     }
     break;
 case 'update_record':
     if (!Core::form_verify('edit_acl')) {
         UI::access_denied();
         exit;
     }
     $access = new Access($_REQUEST['access_id']);
     $access->update($_POST);
     if (!Error::occurred()) {
         show_confirmation(T_('Updated'), T_('Access List Entry updated'), AmpConfig::get('web_path') . '/admin/access.php');
     } else {
         $access->format();
         require_once AmpConfig::get('prefix') . '/templates/show_edit_access.inc.php';
     }
     break;
 case 'show_add_current':
 case 'show_add_rpc':
 case 'show_add_local':
 case 'show_add_advanced':
     $action = $_REQUEST['action'];
     require_once AmpConfig::get('prefix') . '/templates/show_add_access.inc.php';
     break;
 case 'show_edit_record':
$database = new Database();
$db = $database->getConnection();
$originalOption = new Access($db);
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $originalOption->Id = $id;
    $originalOption->selectById();
}
if (isset($_POST['update'])) {
    $updatedOption = new Access($db);
    $updatedOption->Id = $_POST['id'];
    $updatedOption->Code = $_POST['code'];
    $updatedOption->Staff_Id = null;
    $updatedOption->Staff = '';
    $updatedOption->Guest_Id = $_POST['guestid'];
    if ($updatedOption->update() == true) {
        header("location:access.php");
    } else {
        echo "<script>alert('There was an error updating this item');window.location = 'access.php' </script>";
    }
}
if (isset($_POST['delete'])) {
    $updatedOption = new Access($db);
    $updatedOption->Id = $_POST['id'];
    if ($updatedOption->delete() == true) {
        header("location:access.php");
    } else {
        echo "<script>alert('There was an error deleting this item');window.location = 'access.php' </script>";
    }
}
?>