Guest User

Untitled

a guest
May 23rd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.30 KB | None | 0 0
  1. <?php
  2. error_reporting(-1);
  3. session_start();
  4. include 'includes/mysqli_connect.php';
  5. include 'includes/functions.php';
  6.  
  7. ?>
  8. <?php include 'includes/template/header.php'; ?>
  9. <center>
  10. <div id="wrap">
  11. <br>
  12. <?php include 'includes/template/navbar.php'; ?>
  13. <div class="wrapbg">
  14. <span class="corners-top"><span></span></span>
  15. <div id="content">
  16. <?php
  17. //Defines id to get_id
  18. $id = mysqli_real_escape_string($link, $_GET['id']);
  19. //does sql querying based on the id
  20. $sql = "SELECT * from users where id = '$id'";
  21. $result = mysqli_query($link, $sql);
  22. ?>
  23. <table>
  24. <?php
  25. //echoes error if profile does not exist
  26. if(mysqli_num_rows($result) == 0){ echo "The profile you are looking for does not exist."; }
  27. //if exists does a while loop to echo the shizz out
  28. while($row = mysqli_fetch_assoc($result)){
  29. $username = $row['username'];
  30. echo "About " . $username;
  31. ?>
  32. <hr class='hr1'>
  33. <?php echo $row['about_me']; ?>
  34. <hr class='hr1'>
  35. <?php
  36. 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>"; } } ?>
  37. </table>
  38. </div>
  39. <span class="corners-bottom"><span></span></span>
  40. </div>
  41.  
  42. <div class="wrapbg">
  43. <span class="corners-top"><span></span></span>
  44. <div id="content">
  45. Forum posts by <?php echo $row['username'] ?>
  46. <?php
  47. //Querying to show forum posts by the user
  48.  
  49. $forum = "SELECT * from posts where poster = '$username'";
  50. $run = mysqli_query($link, $forum) or die(mysqli_error($link));
  51. //Doing a while loop to echo out the forum posts
  52. while($row1 = mysqli_fetch_assoc($run)){
  53. $topicid = $row1['topic_id'];
  54. $catid = $row1['cat_id'];
  55. //Fetching topics info based on catid, topicsid and username to echo it out.
  56. $topsql = "SELECT title from topics where starter = '$username' and id = '$topicid' and cat_id = '$catid'";
  57. $topsqlrun = mysqli_query($link, $topsql);
  58. if(mysqli_num_rows($topsqlrun) == 0){ echo "This user has not created any forum posts yet"; }
  59. $topinfo = mysqli_fetch_assoc($topsqlrun);
  60. ?>
  61. <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
  62. } } ?>
  63. </div>
  64. <span class="corners-bottom"><span></span></span>
  65. </div>
  66.  
  67. <br />
  68. <?php include 'includes/template/footer.php'; ?>
Add Comment
Please, Sign In to add comment