* http://php.net/manual/en/language.exceptions.php */ /** * require init.php */ require_once "../core/init.php"; /** * Du skal være logget ind for at kunne se denne side */ loggedinorreturn(); headers(); try { if (!isset($_GET['id']) or empty($_GET['id'])) { throw new Exception("Mangler id"); } $_com = new _Com(); if (isset($_POST['submit'])) { $date = new DateTime(); if (!isset($_POST['comment']) or empty($_POST['comment'])) { throw new Exception("Indsæt kommentar"); } $date = new DateTime(); $date = $_POST['date']; $comment = $_POST['comment']; $_com->setDate($date->format("Y-m-d H:i:s")); $_com->setComment($comment); $_com->set_user_id($_user_id); $_com->set_image_id($_image_id); $_com->save(); } ?>
// name-edit.php fra andre sider skal fixes fordi jeg har lavet mappe structuren lidt om! /** * require init.php */ require_once "../core/init.php"; /** * Du skal være logget ind for at kunne se denne side */ loggedinorreturn(); headers(); try { if (!isset($_GET['id']) or empty($_GET['id'])) { throw new Exception("Mangler id"); } $id = $_GET['id']; $_com = new _Com(); $_com->load($id); if (isset($_POST['submit'])) { $date = new DateTime(); if (!isset($_POST['comment']) or empty($_POST['comment'])) { throw new Exception("Indsæt kommentar"); } $date = $_POST['date']; $comment = $_POST['comment']; $_com->setDate($date->format("Y-m-d H:i:s")); $_com->setComment($comment); $guru_com->save(); } ?>