diff options
author | Cflip <36554078+cflip@users.noreply.github.com> | 2021-02-10 20:40:32 -0700 |
---|---|---|
committer | Cflip <36554078+cflip@users.noreply.github.com> | 2021-02-10 20:40:32 -0700 |
commit | f83530a122119d7f69812493f9c2f4987ccb2065 (patch) | |
tree | 691ed8597a8d3275998f7db951b7b055ef5baf3b /index.php | |
parent | 4c9d433ba1c52ad67e4cccabf04e709bb8b85070 (diff) |
Reorganize code and add info to front page
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 62 |
1 files changed, 16 insertions, 46 deletions
@@ -1,21 +1,22 @@ -<?php -include_once 'header.php'; -?> +<?php include_once 'header.php';?> <section> <h2>Welcome to the cflip.net forum!</h2> - Latest Updates: - <ul> - <li>5 latest threads are displayed on the homepage</li> - </ul> + <p> + This is the beta test of the forum website, so there are lots of features missing. Since there are no moderation features built into the website, + <i>for the most part</i> I don't care that much about what is posted here. Some links and buttons may not have any functionality either! + </p> + <p> + If you notice a problem or have an idea for a feature that is missing, <a href="http://51.195.90.7/forum/thread.php?id=40">reply to this thread!</a> + </p> </section> - - <table> - <tr> - <th class="left">Category</th> - <th class="right">Latest Thread</th> - </tr> +<table> + <tr> + <th class="left">Category</th> + <th class="right">Latest Thread</th> + </tr> <?php include_once 'includes/db_inc.php'; + include_once 'includes/functions_display.php'; $sql = "SELECT cat_id, cat_name, cat_description FROM categories"; $result = mysqli_query($dbc, $sql); @@ -24,46 +25,17 @@ include_once 'header.php'; die('Failure trying to display categories: ' . mysqli_error($dbc)); } - $sql = "SELECT thread_id, thread_subject, thread_date, user_id, user_name FROM threads JOIN users ON thread_author = user_id WHERE thread_cat = ? ORDER BY thread_id DESC LIMIT 1"; - $stmt = mysqli_stmt_init($dbc); - - if (!mysqli_stmt_prepare($stmt, $sql)) { - die('Could not create thread due to internal error: ' . mysqli_error($dbc)); - } - - while ($row = mysqli_fetch_assoc($result)) { - mysqli_stmt_bind_param($stmt, "i", $row['cat_id']); - mysqli_stmt_execute($stmt); - - $thread_res = mysqli_stmt_get_result($stmt); - $thread = mysqli_fetch_assoc($thread_res); - - echo '<tr><td class="left">'; - echo '<h4><a href="category.php?id=' . $row['cat_id'] . '">' . $row['cat_name'] . '</a></h4>'; - echo $row['cat_description']; - if ($thread) { - echo '</td><td class="right">' . $thread['thread_subject'] . '<br>'; - echo '<small>by <b><a href="user.php?id=' . $thread['user_id'] . '">' . $thread['user_name'] . '</a></b></small></td></tr>'; - } else { - $no_threads_msg = 'There are no threads in this category yet.'; - echo '</td><td class="right"><small>'. $no_threads_msg .'</small></td>'; - } - } - - mysqli_stmt_close($stmt); - mysqli_free_result($result); + display_categories($dbc, $result); ?> - </table> <table> <tr> <th class="left">Latest Threads <a href="all.php">View All</a></th> <th class="right">Latest Post</th> </tr> - <?php include_once 'includes/db_inc.php'; - include_once 'includes/functions_inc.php'; + include_once 'includes/functions_display.php'; $sql = "SELECT thread_id, thread_subject, thread_date, user_id, user_name, cat_id, cat_name FROM threads JOIN users ON thread_author = user_id JOIN categories ON thread_cat = cat_id ORDER BY thread_id DESC LIMIT 5"; $result = mysqli_query($dbc, $sql); @@ -75,7 +47,5 @@ include_once 'header.php'; display_threads($dbc, $result, true); mysqli_free_result($result); ?> - </table> - <?php include_once 'footer.php';?>
\ No newline at end of file |