karlokokkak

Untitled

Mar 31st, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.36 KB | None | 0 0
  1. <?php
  2. if (session_status() == PHP_SESSION_NONE) {
  3.     session_start();
  4. }
  5. ?>
  6. <html>
  7. <head>
  8. <link rel="stylesheet" type="text/css" href="class.css">
  9. <title>Interpage</title>
  10. </head>
  11.  
  12. <body style="background-color:#48D1CC;">
  13.  
  14. <h1>Your Timeline</h1>
  15.  
  16. <nav>
  17.     <ul>
  18.            <li style="font-size: 20px"><a href="profile.php">Profile</a></li>
  19.            <li style="font-size: 20px"><a href="home.php">Timeline</a></li>
  20.     </ul>  
  21. <center>
  22. <form action="search2.php" method="post">
  23. <input type="text" name="searchbar" placeholder="Search user ...">
  24. <button type="submit" name="Search">Search</button>
  25.  
  26. </form>
  27. </center>
  28.  
  29. <div class="w3-container">
  30. <div class="right-align">
  31. <h2 style= "word-break: break-word;">
  32. <?php
  33.  
  34. ini_set('display_errors', 1);
  35. ini_set('display_startup_errors', 1);
  36. error_reporting(E_ALL);
  37.  
  38. include("connect.php");
  39. include("auth_login.php");
  40.  
  41. $username = isset($_SESSION['username']) ? $_SESSION['username'] : '';
  42. $username = isset($_GET['username']) ? $_GET['username'] : $username;
  43.  
  44. //Write the query
  45. $sql = "SELECT * FROM posts WHERE username = '" . $username. "' ";
  46. $result = $conn->query($sql);
  47.  
  48. if ($result->num_rows > 0) {
  49.     // output data of each row
  50.     while($row = $result->fetch_assoc()) {
  51.         echo "<p>".$row['body']. "</p>";
  52.     }
  53. }
  54. else {
  55.     echo "No posts";
  56. }
  57. ?>
  58. </h2>
  59. </div>
  60. </div>
  61.  
  62. </body>
  63. </html>
Add Comment
Please, Sign In to add comment