From 900e26c7e5dffd292c0b3ab93e81618d4f67c879 Mon Sep 17 00:00:00 2001 From: dev2 Date: Fri, 20 Dec 2024 05:41:03 +0000 Subject: [PATCH 1/2] t --- .hta_404.php | 74 +- .hta_footer.php | 2 +- .hta_header1.php => .hta_header-preserved.php | 127 +- .hta_header.php | 239 ++-- .hta_slug/_home.php | 3 +- .hta_slug/about | 48 +- .hta_slug/aqsiqg | 656 +++++++++ .hta_slug/favicon.ico | 48 +- .hta_slug/notice.php | 38 +- .hta_slug/theme-1-footer | 656 +++++++++ about | 739 ++++++++++ about-iqac | 727 ++++++++++ academics | 928 +++++++++++++ administration | 919 +++++++++++++ admission | 946 +++++++++++++ aishe | 934 +++++++++++++ alumni-association | 964 ++++++++++++++ aqar | 930 +++++++++++++ cbsc | 1184 +++++++++++++++++ clubs-cells | 978 ++++++++++++++ code-of-conduct | 923 +++++++++++++ composition-of-gb | 1155 ++++++++++++++++ department-of-geography | 978 ++++++++++++++ department-of-journalism-mass-communication | 960 +++++++++++++ department-of-political-science | 987 ++++++++++++++ favicon.ico | 653 +++++++++ fee-structure | 918 +++++++++++++ index.php | 14 +- notice/.hta_404.php | 64 + notice/_home.php | 52 + notice/final-merit-list-pg-2024 | 712 ++++++++++ notice/index.php | 4 +- test.txt => temp_html_file/test.txt | 0 33 files changed, 18289 insertions(+), 271 deletions(-) rename .hta_header1.php => .hta_header-preserved.php (89%) create mode 100644 .hta_slug/aqsiqg create mode 100644 .hta_slug/theme-1-footer create mode 100644 about create mode 100644 about-iqac create mode 100644 academics create mode 100644 administration create mode 100644 admission create mode 100644 aishe create mode 100644 alumni-association create mode 100644 aqar create mode 100644 cbsc create mode 100644 clubs-cells create mode 100644 code-of-conduct create mode 100644 composition-of-gb create mode 100644 department-of-geography create mode 100644 department-of-journalism-mass-communication create mode 100644 department-of-political-science create mode 100644 favicon.ico create mode 100644 fee-structure create mode 100644 notice/.hta_404.php create mode 100644 notice/_home.php create mode 100644 notice/final-merit-list-pg-2024 rename test.txt => temp_html_file/test.txt (100%) diff --git a/.hta_404.php b/.hta_404.php index 208fb9d..383ad9c 100644 --- a/.hta_404.php +++ b/.hta_404.php @@ -1,41 +1,61 @@ Page saved successfully at $filePath.

"; + } else { + // echo "

Failed to save the page.

"; + } + } + 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 = $conn->prepare("SELECT * FROM `scc24` WHERE type='page' AND `slug` = :querySlug"); + $stmt->bindParam(':querySlug', $querySlug, PDO::PARAM_STR); $stmt->execute(); $content = $stmt->fetchAll(PDO::FETCH_ASSOC); - if(isset($content[0]['content']) && $content[0]['content']) - $pageContent = '
-

'.$content[0]['title'].'

-
'.$content[0]['content'].'
-
'; - else $pageContent = ' -

Page not found (404).

+ + if (isset($content[0]['content']) && $content[0]['content']) { + $pageContent = ' +
+
+

' . htmlspecialchars($content[0]['title']) . '

+
+
' . $content[0]['content'] . '
+
'; + + // Call the function to save the HTML file + saveHtmlFile($fileName, $headerContent, $pageContent); + } else { + $pageContent = ' +
+

Page not found (404).

Back to home -
- '; +
'; + } } catch (PDOException $e) { - $in_page_message = "

Error: " . $e->getMessage() . "

"; + $pageContent = "

Error: " . $e->getMessage() . "

"; } // Render page content here @@ -43,22 +63,6 @@ $footerContent = file_get_contents('./.hta_footer.php'); - // if($fileExtension[1] && $fileExtension[1] === 'html'){ - // $filePath = __DIR__ . '/notice/' . $fileName; - // } else{ - // $filePath = __DIR__ . '/notice/' . $fileName . '.html'; - // } + // Function to save HTML file - - if($urlParts[1] === 'notice'){ - $filePath = __DIR__ . '/notice/' . $fileName; - $totalPageContent = $headerContent . $pageContent . $footerContent; - } else{ - $filePath = __DIR__ . '/.hta_slug/' . $fileName; - $totalPageContent = $headerContent . $pageContent . $footerContent; - } - - - file_put_contents($filePath, $totalPageContent); - -?> \ No newline at end of file +?> diff --git a/.hta_footer.php b/.hta_footer.php index 8e8327a..2cbdc47 100644 --- a/.hta_footer.php +++ b/.hta_footer.php @@ -1,5 +1,5 @@