t
This commit is contained in:
@@ -1,27 +1,15 @@
|
||||
<?php
|
||||
require('.hta_config/env.php');
|
||||
try {
|
||||
// Database connection
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
// Query the database
|
||||
$stmt = $conn->prepare("SELECT * FROM `scc24`");
|
||||
$stmt->execute();
|
||||
$content = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// Check and render content
|
||||
if ($content && isset($content['content']) && $content['content']) {
|
||||
echo '<div class="container mx-auto">
|
||||
<div style="padding-top:20px; padding-bottom:15px; font-size:25px;">
|
||||
<p style="text-align: center;">' . htmlspecialchars($content['title']) . '</p>
|
||||
</div>
|
||||
<div>' . $content['content'] . '</div>
|
||||
</div>';
|
||||
} else {
|
||||
echo '<div class="container mx-auto"><p style="text-align: center;">Content not found (404).</p></div>';
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "<p class='text-danger'>Error: " . htmlspecialchars($e->getMessage()) . "</p>";
|
||||
}
|
||||
|
||||
if(isset($url[2])){
|
||||
$slug2="";
|
||||
if (strpos($url[2], "?") !== false) {
|
||||
$url2 = explode('?', $url[2]);
|
||||
$slug2=$url2[0];
|
||||
} else $slug2=$url[2];
|
||||
if($slug2=="") require_once('notice/_home.php');
|
||||
elseif(file_exists(__DIR__."/notice/".$slug2.".php")) include __DIR__."/notice/".$slug2.".php";
|
||||
else require_once('notice/.hta_404.php');
|
||||
}
|
||||
else require_once('notice/_home.php');
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user