Advertisement
karlokokkak

Untitled

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