This commit is contained in:
2024-12-20 05:41:03 +00:00
parent 40750028b3
commit 900e26c7e5
33 changed files with 18289 additions and 271 deletions

64
notice/.hta_404.php Normal file
View File

@@ -0,0 +1,64 @@
<?php
require('.hta_config/env.php');
require('./.hta_header.php');
// echo 'Notice 404+1';
$headerContent = file_get_contents('./.hta_header.php');
$requestUri = $_SERVER['REQUEST_URI'];
// echo $requestUri;
$urlParts = explode('/', $requestUri);
if($urlParts[1] === 'notice'){
$slug = $urlParts[2];
} else{
$slug = $urlParts[1];
}
$querySlug = explode('.', $slug)[0];
// echo $slug;
$fileName = $slug;
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM `scc24` WHERE `slug` = '".$querySlug."'");
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
if(isset($content[0]['content']) && $content[0]['content'])
$pageContent = '<div class="container mx-auto" style="">
<div class="" style="padding-top:20px; padding-bottom:15px; font-size:25px;"><p style="text-align: center;">'.$content[0]['title'].'</p></div>
<div class="">'.$content[0]['content'].'</div>
</div>';
else $pageContent = '
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 100px 0;"><p style="text-align: center; font-size: 30px; font-weight: bold;">Page not found (404).</p>
<a href="/">Back to home</a>
</div>
';
} catch (PDOException $e) {
$in_page_message = "<p class='text-danger'>Error: " . $e->getMessage() . "</p>";
}
// Render page content here
echo $pageContent;
$footerContent = file_get_contents('./.hta_footer.php');
// if($fileExtension[1] && $fileExtension[1] === 'html'){
// $filePath = __DIR__ . '/notice/' . $fileName;
// } else{
// $filePath = __DIR__ . '/notice/' . $fileName . '.html';
// }
if($urlParts[1] === 'notice'){
$filePath = __DIR__ . '/' . $fileName;
// echo $filePath;
$totalPageContent = $headerContent . $pageContent . $footerContent;
} else{
$filePath = __DIR__ . $fileName;
$totalPageContent = $headerContent . $pageContent . $footerContent;
}
file_put_contents($filePath, $totalPageContent);
?>

52
notice/_home.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
require('.hta_config/env.php');
require('./.hta_header.php');
$noticeType = $_GET['type'];
if($noticeType === 'notice'){
$noticeHead = 'General Notice';
} elseif($noticeType === 'tender'){
$noticeHead = 'Tender Notice';
}
?>
<div class="container">
<h2 style="text-align: center; margin: 20px 0px;"><?php echo $noticeHead ?></h2>
<table style="border-collapse: collapse; width: 100%; ">
<thead>
<tr>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Sl No.</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Title</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Action</th>
</tr>
</thead>
<tbody>
<?php
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM `scc24` WHERE `type` = :type ORDER BY (`date_created` = CURDATE()) DESC, `date_created` DESC");
$stmt->bindParam(':type', $noticeType, PDO::PARAM_STR);
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
$serialNumber = 1;
foreach ($content as $notice) {
echo '<tr>
<td style="border: 1px solid #6b6245; padding: 8px;">' . $serialNumber . '</td>
<td style="border: 1px solid #6b6245; padding: 8px;">' . htmlspecialchars($notice['title']) . '</td>
<td style="border: 1px solid #6b6245; padding: 8px; text-align: center;">
<a href="/notice/'.$notice['slug'].'.html">View</a>
<a href="#"></a>
</td>
</tr>';
$serialNumber++;
}
echo '';
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . htmlspecialchars($e->getMessage()) . "</p>";
}
?>
</tbody>
</table>
</div>
<?php
require('./.hta_footer.php');
?>

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +1,12 @@
<?php
require('../.hta_header.php');
require('../.hta_config/env.php');
require('../.hta_header.php');
$noticeType = $_GET['type'];
if($noticeType === 'notice'){
$noticeHead = 'General Notice';
} elseif($noticeType === 'tender'){
$noticeHead = 'Tender Notice';
}
?>
<div class="container">
<h2 style="text-align: center; margin: 20px 0px;"><?php echo $noticeHead ?></h2>