Пример #1
0
require_once 'app/capsule.php';
use App\Controller\ThreadController;
use App\Controller\UserController;
use Illuminate\Database\Capsule\Manager as Capsule;
$con = mysqli_connect($hostname, $dbusername, $dbpassword, $db);
$UserController = new UserController();
$ThreadController = new ThreadController();
$User = UserController::User();
if (!isset($_GET['C'], $_GET['add_thread'])) {
    header('Location:/index.php');
} elseif ($_GET['add_thread'] != 'true') {
    header('Location:/index.php');
}
if (isset($_GET['logout'])) {
    if ($_GET['logout'] == true) {
        $UserController->logout();
    }
}
if (isset($_SESSION['username'], $_SESSION['id'])) {
    $loggedin = true;
}
if (isset($_GET['C'])) {
    $category_id = $_GET['C'];
    $threads = $ThreadController->show($category_id);
}
if (isset($_GET['T'])) {
    $thread_id = $_GET['T'];
    $posts = $ThreadController->showthread($thread_id);
}
if (isset($_GET['logout'])) {
    if ($_GET['logout'] == true) {