<?php if (isset($_SESSION['user']) && isset($_GET['param'])) { $pageId = filter_input(INPUT_GET, 'param', FILTER_VALIDATE_INT); if ($pageId && pp_can_edit_page($pageId, $_SESSION['user']['userId'])) { echo '<p><a href="?page=pagelist">Back to page list</a></p>'; if (pp_delete_page($pageId)) { echo '<h2>Page was removed</h2>'; } else { echo '<h2>Page could not be removed</h2>'; } } else { echo '<h2>You are not authorized to remove this page!</h2>'; echo '<p>Your behaviour has been logged!</p>'; pp_write_log('NOTICE: User ' . $_SESSION['user']['userName'] . ' tried to remove page with ID ' . $pageId . ' but was not authorized!'); } }
<link rel="stylesheet" href="style.css" type="text/css"> <title>PHPress - <?php echo $pageTitle; ?> </title> </head> <body> <div id="container"> <div id="header"> <h1 id="header_title">Site title</h1> <?php if (isset($_SESSION['user']['userId'])) { //From right to left (I blame float) echo '<p><a href="?page=logout"><img class="header_icon" src="phpress/images/icon-exit.png" alt="icon"></a></p>'; echo '<p><a href="?page=admin"><img class="header_icon" src="phpress/images/icon-cp.png" alt="icon"></a></p>'; if ($displayMode === 2 && pp_can_edit_page($pageData['pageId'], $_SESSION['user']['userId'])) { echo '<p><a href="?page=editpage¶m=' . $pageId . '"><img class="header_icon" src="phpress/images/icon-edit-page.png" alt="icon"></a></p>'; } //Debug info echo '<p>' . $_SESSION['user']['userType'] . ' ' . $_SESSION['user']['userName'] . ' with userId ' . $_SESSION['user']['userId'] . ' is logged in</p>'; } else { echo '<p><a href="?page=login"><img class="header_icon" src="phpress/images/icon-login.png" alt="icon"></a></p>'; } ?> </div> <div id="menu"> <ul> <?php if ($displayMode === 2) { $pages = pp_get_menu(pp_get_user_details($pageData['authorId'])['activeMenu']); } else {