Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(-1);
- session_start();
- include 'includes/mysqli_connect.php';
- include 'includes/functions.php';
- ?>
- <?php include 'includes/template/header.php'; ?>
- <center>
- <div id="wrap">
- <br>
- <?php include 'includes/template/navbar.php'; ?>
- <div class="wrapbg">
- <span class="corners-top"><span></span></span>
- <div id="content">
- <?php
- //Defines id to get_id
- $id = mysqli_real_escape_string($link, $_GET['id']);
- //does sql querying based on the id
- $sql = "SELECT * from users where id = '$id'";
- $result = mysqli_query($link, $sql);
- ?>
- <table>
- <?php
- //echoes error if profile does not exist
- if(mysqli_num_rows($result) == 0){ echo "The profile you are looking for does not exist."; }
- //if exists does a while loop to echo the shizz out
- while($row = mysqli_fetch_assoc($result)){
- $username = $row['username'];
- echo "About " . $username;
- ?>
- <hr class='hr1'>
- <?php echo $row['about_me']; ?>
- <hr class='hr1'>
- <?php
- if($row['status'] == 0){ "$username is not <font color='red'>online</font>"; } else { if($row['status'] == 1) { echo "$username is <font color='green'>online</font>"; } } ?>
- </table>
- </div>
- <span class="corners-bottom"><span></span></span>
- </div>
- <div class="wrapbg">
- <span class="corners-top"><span></span></span>
- <div id="content">
- Forum posts by <?php echo $row['username'] ?>
- <?php
- //Querying to show forum posts by the user
- $forum = "SELECT * from posts where poster = '$username'";
- $run = mysqli_query($link, $forum) or die(mysqli_error($link));
- //Doing a while loop to echo out the forum posts
- while($row1 = mysqli_fetch_assoc($run)){
- $topicid = $row1['topic_id'];
- $catid = $row1['cat_id'];
- //Fetching topics info based on catid, topicsid and username to echo it out.
- $topsql = "SELECT title from topics where starter = '$username' and id = '$topicid' and cat_id = '$catid'";
- $topsqlrun = mysqli_query($link, $topsql);
- if(mysqli_num_rows($topsqlrun) == 0){ echo "This user has not created any forum posts yet"; }
- $topinfo = mysqli_fetch_assoc($topsqlrun);
- ?>
- <br><a href='forum_topic.php?cat_id=<?php echo $row1['cat_id'] ?>&topic_id=<?php echo $row1['topic_id'] ?>'><h1><?php echo $topinfo['title'] ?></h1></a><hr class='hr1'> <?php
- } } ?>
- </div>
- <span class="corners-bottom"><span></span></span>
- </div>
- <br />
- <?php include 'includes/template/footer.php'; ?>
Add Comment
Please, Sign In to add comment