public static function delete_comm($idComm) { switch ($_SERVER['REQUEST_METHOD']) { case 'GET': if (isset($_SESSION['user'])) { $c = Commentaire::get_by_id($idComm); $c->delete(); } else { $_SESSION['message']['type'] = 'error'; $_SESSION['message']['text'] = "You aren't connected"; include 'views/connexion.php'; } break; case 'POST': if (isset($_SESSION['user'])) { $c = Commentaire::get_by_id($idComm); $c->delete(); } else { $_SESSION['message']['type'] = 'error'; $_SESSION['message']['text'] = "You aren't connected"; include 'views/connexion.php'; } break; } }