Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (session_status() == PHP_SESSION_NONE) {
- session_start();
- }
- ?>
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="class.css">
- <title>Interpage</title>
- </head>
- <body style="background-color:#48D1CC;">
- <h1>Your Timeline</h1>
- <nav>
- <ul>
- <li style="font-size: 20px"><a href="profile.php">Profile</a></li>
- <li style="font-size: 20px"><a href="home.php">Timeline</a></li>
- </ul>
- <center>
- <form action="search2.php" method="post">
- <input type="text" name="searchbar" placeholder="Search user ...">
- <button type="submit" name="Search">Search</button>
- </form>
- </center>
- <div class="w3-container">
- <div class="right-align">
- <h2 style= "word-break: break-word;">
- <?php
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- include("connect.php");
- include("auth_login.php");
- $username = isset($_SESSION['username']) ? $_SESSION['username'] : '';
- $username = isset($_GET['username']) ? $_GET['username'] : $username;
- //Write the query
- $sql = "SELECT * FROM posts WHERE username = '" . $username. "' ";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo "<p>".$row['body']. "</p>";
- }
- }
- else {
- echo "No posts";
- }
- ?>
- </h2>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment