function getComments($id) { $query = "SELECT TIME_STAMP, COMMENT_TEXT, USER FROM COMMENTS WHERE POST_ID='{$id}'"; $output = ""; $result = queryMysql($query); if ($result->num_rows) { while ($row = $result->fetch_assoc()) { $comment_text = $row['COMMENT_TEXT']; $output = $output . '<hr><h4><strong>' . $row['USER'] . '</strong> said, </h4>' . '<p>"' . unescapeSpecialCharacters($comment_text) . '"</p>' . getRelTime($row['TIME_STAMP']); } } return $output; }
function getContent($_db, $user) { $query = "SELECT USER_USERNAME, STATUS_TITLE, STATUS_TEXT, TIME_STAMP, IMAGE_NAME, FILTER, COMMENT_ID FROM WALLI ORDER BY TIME_STAMP DESC"; if (!($result = $_db->query($query))) { die('There was an error running the query [' . $_db->error . ']'); } $output = ''; $count = 0; while ($row = $result->fetch_assoc()) { $title = $row['STATUS_TITLE']; $text = $row['STATUS_TEXT']; $time = getRelTime($row['TIME_STAMP']); $output = $output . '<div class="row"><div class="col-md-7"><img class="img-responsive center-block" src="' . $server_root . 'quarantine/' . $row['IMAGE_NAME'] . '" width="450px" style="-webkit-filter:' . $row['FILTER'] . '"></div><div class="col-md-5"><h3>' . unescapeSpecialCharacters($title) . '</h3>' . '<h4>Posted by <strong>' . $row['USER_USERNAME'] . '</strong> ' . $time . '</h4>' . "<p>" . unescapeSpecialCharacters($text) . "</p>" . '<form name="View Comments" action="./comments.php" method="GET">' . '<input type="hidden" name="post" value=' . hash('ripemd128', $row['TIME_STAMP'] . $row['USER_USERNAME']) . ">" . '<input class="btn btn-primary btn-xs" type="submit" value="View Comments >>">' . '</form>'; if ($user == 'Lilian' || $user == 'omarques') { $output = $output . '<br><form name="Remove Post ' . $count . '" class="form-horizontal" method="POST" action="./php/remove_post.php">' . '<input type="button" value="Remove Post ' . $count . '" class="btn btn-danger btn-xs" id="remove_post">' . '<input type="hidden" class="form-control" name="image_name" value="' . $row['IMAGE_NAME'] . '" id="image_name">' . '</form>'; } $output = $output . '</div></div><hr>'; $count = $count + 1; } return $output; }