Jedi123jet.github.io

<?php // Initialize the session session_start();

require_once “init.php”; // Check if the user is logged in, if not then redirect him to login page if(!isset($_SESSION[“loggedin”]) || $_SESSION[“loggedin”] !== true){ header(“location: login.php”); exit; } $search = $_SESSION[“search”]; $username = $_SESSION[“username”];

//Submit Button if (isset($_POST[“submit”])){ $_SESSION[“search”] = trim($_POST[“search”]); $search = $_SESSION[“search”]; } //Upload Button

//prepare all posts $postQuery = $db->prepare(“ SELECT id, username, title, video, score, date FROM videos ORDER BY id DESC “);

$postQuery->execute([ ]);

$posts = $postQuery->rowCount() ? $postQuery : [];

//Search posts $searchQuery = $db->prepare(“ SELECT id, username, title, video, score, date FROM videos WHERE title = :search “);

$searchQuery->execute([ ‘search’ => $search ]);

$searchs = $searchQuery->rowCount() ? $searchQuery : []; // To get User-specific posts $userQuery = $db->prepare(“ SELECT id, username, title, video, score, date FROM videos WHERE username = :username “);

$userQuery->execute([ ‘username’ => $username ]);

$users = $userQuery->rowCount() ? $userQuery : [];

//To search for post $searchQuery = $db->prepare(“ SELECT * FROM videos WHERE title = :search “);

$searchQuery->execute([ ‘search’ => $search ]);

$searchs = $searchQuery->rowCount() ? $searchQuery : [];

//get User foreach ($db->query(“SELECT id, username, password, score FROM users WHERE username = ‘”.$username.”’”) as $row){ $_SESSION[“score”] = $row[‘score’]; } ?>

<!DOCTYPE html>

Form Forum Home

Welcome to Form Forum!

Form Rating:

<a href="command.php?as=increase&item=" class="btn btn-primary">+1</a> <a href="command.php?as=decrease&item=" class="btn btn-primary">-1</a>

Form Rating:

+1 -1
Search
Profile
Card image cap

Account Form Rating: