require_once MODULE_DIR . "productcatalog/mod.product.substructure.inc"; //require_once(MODULE_DIR . "sitevariables/mod.sitevariables.inc"); if (!$objIPAccess->fnValidate($arrAllowIP["access"], $_SERVER["REMOTE_ADDR"]) or $objIPAccess->fnValidate($arrAllowIP["deny"], $_SERVER["REMOTE_ADDR"])) { header("Location: " . LOGINCENTER_PATH); } if (!is_object($_SESSION["user"])) { header("Location: " . LOGINCENTER_PATH); } require_once CONFIG_DIR . $_SESSION["lang"] . ".translation.inc"; if ($_GET['action'] == "delete") { if ($_GET['items']) { $items_arr = explode(";", $_GET["items"]); while (list($key, $val) = @each($items_arr)) { if (strlen($val) > 0) { delete_comment($val); } } header("location: frame.productcomments.php"); exit; } } $strTemplate = "content.productcomments.tpl"; $comments = get_all_comments(); $engSmarty->assign("comments", $comments); // $engSmarty->debug_tpl = "debug.tpl"; // $engSmarty->debugging = 1; // $engSmarty->error_reporting = 512; $engSmarty->assign("_GET", $_GET); $engSmarty->assign("boolRefreshTree", $_GET["refreshtree"]); $engSmarty->assign("arrTranslation", $arrTranslation); $engSmarty->display("admin/" . $strTemplate);
<input type="submit" name="logout" value="Logout!"> </form> </div> <div class="posts"> <h2>Post a message</h2> <form action="wall_process.php" method="post"> <textarea class="post" name="post"></textarea> <input type="hidden" name="action" value="post_message"> <input class="button" type="submit" name="post_message" value="Post a message"> </form> <?php get_all_messages(); foreach ($_SESSION["messages"] as $message) { $str_to_time = strtotime($message["created_at"]); $date = date("F jS Y", $str_to_time); get_all_comments($message['message_id']); // display messages echo "<p class='bold'>{$message['first_name']} {$message['last_name']} - {$date}</p>"; // display delete button if the message has been here less than 30 mins. // bug in this where if you don't refresh the page after 30min and the delete // button is still there then you can still delete, fix: add same check inside // wall_process.php to not allow deleting of row in DB if over 30min. if (round(abs(time() - $str_to_time) / 60) < 30) { // Delete message button echo "<form class='inline' action='wall_process.php' method='post'>"; echo "<input type='hidden' name='action' value='delete_message'>"; echo "<input type='hidden' name='message_id' value='{$message['message_id']}'>"; echo "<input type='submit' name='delete_message' value='Delete'>"; echo "</form>"; } // display messages (cont.)