function del() { $model = new Work(); $model->del(); if ($_POST['redirect']) { $this->redirect($_POST['redirect']); } elseif ($_SERVER['HTTP_REFERER']) { $this->redirect($_SERVER['HTTP_REFERER']); } else { $this->redirect('/work/' . $_GET['parent'] . '/'); } }