threadr.lostcave.ddnss.de/threadr/board/index.php

74 lines
2.2 KiB
PHP
Raw Normal View History

2020-03-02 08:52:22 +01:00
<?php
session_start();
%SET_LOGIN_VARIABLE%
2020-03-02 08:52:22 +01:00
%NO_CHEAP_SESSION_STEALING%
%PLEAZE_NO_CACHE%
2020-03-02 08:52:22 +01:00
$navbar="boards";
2020-03-06 10:27:57 +01:00
$id=$_GET['id'];
2020-03-02 08:52:22 +01:00
?>
<!DOCTYPE html>
<html>
2020-03-08 17:48:18 +01:00
<head>
<title>ThreadR - Boards</title>
%STYLESHEET%
<link rel="icon" type="image/png" href="%CONTENT_DIR%/img/favicon-32x32.png" sizes="32x32" />
<?php
2020-03-08 17:50:38 +01:00
if(isset($_GET['action'])) {
if ($_GET['action']=='submit') {
2021-09-07 06:49:29 +02:00
echo "<meta http-equiv=\"refresh\" content=\"5;URL=%CONTENT_DIR%/board/?id=$id?end\">";
}
2020-03-08 17:48:18 +01:00
} else {
2020-03-08 17:57:54 +01:00
echo "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">";
2020-03-08 17:48:18 +01:00
}
?>
</head>
2021-09-07 06:49:29 +02:00
<body <?php if (isset($_GET['end'])) { echo "onLoad=\"window.scrollTo(0,document.body.scrollHeight)\""; } ?> >
2020-03-08 17:48:18 +01:00
%NAVBAR%
<div class="container">
<div class="item-1">
<h1><center>
2020-03-08 03:41:05 +01:00
<?php
2021-09-02 17:01:28 +02:00
$pdo = new PDO('mysql:host=%DB_SERVER%;dbname=%DB_NAME%', '%DB_USERNAME%', '%DB_PASSWORD%');
2020-03-08 17:48:18 +01:00
$error = false;
$error_message = "";
if (!$error) {
$statement = $pdo->prepare("SELECT * FROM boards WHERE id=:id");
$statement->execute(array("id"=>$id));
$result = $statement->fetch();
echo $result['name'];
}
if (!$result) {
$error_message = "Error: SQL error.\n" . $statement->queryString . "\n" . $statement->errorInfo()[2];
}
2020-03-08 03:41:05 +01:00
?>
2020-03-08 17:48:18 +01:00
</center></h1>
</div>
<div class="item-2">
<?php
include("./board.php");
?>
</div>
<div class="item-3">
<?php
if($login) {
if(isset($_GET['action'])) {
if($_GET['action']=='post') {
include("./post.php");
} elseif($_GET['action']=='submit') {
include("./submit.php");
} elseif($_GET['action']=='edit') {
include("./edit.php");
}
} else {
include("./default.php");
2020-03-08 17:48:18 +01:00
}
2020-03-08 18:26:12 +01:00
} else {
2020-03-08 18:24:48 +01:00
echo "<div class='margin'><a href='%CONTENT_DIR%/login/'><button> Log in to post something </button></a></div>";
2020-03-08 17:48:18 +01:00
}
?>
2020-03-02 08:52:22 +01:00
</div>
2020-03-08 17:48:18 +01:00
</div>
2020-03-09 12:22:30 +01:00
%BANNER_COOKIES%
2020-03-08 17:48:18 +01:00
</body>
2020-03-02 08:52:22 +01:00
</html>