-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.php
More file actions
164 lines (135 loc) · 6.38 KB
/
page.php
File metadata and controls
164 lines (135 loc) · 6.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
// page.php
require 'admin/db.php';
// Get the page slug from the URL, default to 'privacy' if not provided
$slug = isset($_GET['slug']) ? $_GET['slug'] : 'privacy';
// Fetch the page content based on slug
$stmt = $pdo->prepare("SELECT * FROM pages WHERE slug = ?");
$stmt->execute([$slug]);
$page = $stmt->fetch();
// Fetch settings from the database
$stmt = $pdo->query("SELECT * FROM settings LIMIT 1");
$settings = $stmt->fetch();
if (!$page) {
echo "Page not found.";
exit();
}
// Set up SEO meta details
$seo_title = $page['title'] ?? 'My Website';
$seo_description = substr(strip_tags($page['content']), 0, 160);
$favicon_path = '/admin/uploads/favicon.png'; // Replace with your favicon path
$logo_path = '/admin/uploads/logo.png'; // Replace with your logo path
$google_analytics_code = $settings['google_analytics_code'] ?? '';
// Fetch contact information from the database
$stmt = $pdo->query("SELECT * FROM contact_info LIMIT 1");
$contact_info = $stmt->fetch();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo htmlspecialchars($seo_title); ?></title>
<meta name="description" content="<?php echo htmlspecialchars($seo_description); ?>">
<!-- Google Analytics Code -->
<?php if (!empty($google_analytics_code)): ?>
<?php echo $google_analytics_code; ?>
<?php endif; ?>
<!-- Favicon -->
<link rel="icon" href="<?php echo htmlspecialchars($settings['favicon_path']); ?>" type="image/x-icon">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<style>
body { font-family: Arial, sans-serif; background-color: #f9f9f9; }
.container { max-width: 800px; margin: auto; padding: 20px; }
.footer { background-color: #333; color: white; padding: 15px; text-align: center; }
/* Footer Styling */
footer {
background-color: #333;
color: white;
padding: 15px;
text-align: center;
font-size: 0.9rem;
}
footer a {
color: #ccc;
text-decoration: none;
margin: 0 5px;
}
footer a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="/">
<img src="<?php echo htmlspecialchars($logo_path); ?>" height="70px" width="210px" alt="Logo"> <!-- Display logo from settings -->
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a class="nav-link" href="/">Home</a></li>
<li class="nav-item"><a class="nav-link" href="/page.php?slug=about">About Us</a></li>
<li class="nav-item"><a class="nav-link" href="/page.php?slug=privacy">Privacy</a></li>
<li class="nav-item"><a class="nav-link" href="/page.php?slug=terms">Terms</a></li>
<li class="nav-item"><a class="nav-link" href="/contact.php">Contact Us</a></li>
</ul>
</div>
</nav>
<div class="container mt-5">
<h1><?php echo htmlspecialchars($page['title']); ?></h1>
<div><?php echo $page['content']; ?></div>
</div>
<!-- Left-Aligned Modern Footer -->
<footer class="footer bg-dark text-white py-5">
<div class="container">
<div class="row">
<!-- About Us Section -->
<div class="col-md-4 mb-4 text-left">
<h5 class="text-uppercase">About Us</h5>
<p class="text-muted">
<?php echo htmlspecialchars($contact_info['faboutus'] ?? 'Not available'); ?>
</p>
</div>
<!-- Quick Links Section -->
<div class="col-md-4 mb-4 text-left">
<h5 class="text-uppercase">Quick Links</h5>
<ul class="list-unstyled">
<li><a href="/index.php" class="text-muted">Home</a></li>
<li><a href="/page.php?slug=about" class="text-muted">About Us</a></li>
<li><a href="/page.php?slug=privacy" class="text-muted">Privacy Policy</a></li>
<li><a href="/page.php?slug=terms" class="text-muted">Terms of Service</a></li>
<li><a href="/contact.php" class="text-muted">Contact Us</a></li>
</ul>
</div>
<!-- Contact Section -->
<div class="col-md-4 mb-4 text-left">
<h5 class="text-uppercase">Contact Us</h5>
<ul class="list-unstyled text-muted">
<li><strong>Email:</strong> <?php echo htmlspecialchars($contact_info['email'] ?? 'Not available'); ?></li>
<li><strong>Phone:</strong><?php echo htmlspecialchars($contact_info['phone'] ?? 'Not available'); ?></li>
<li><strong>Address:</strong> <?php echo nl2br(htmlspecialchars($contact_info['address'] ?? 'Not available')); ?></li>
</ul>
<!-- Social Media Icons -->
<div class="social-links mt-3">
<a href="#" class="text-white mr-3"><i class="fab fa-facebook fa-lg"></i></a>
<a href="#" class="text-white mr-3"><i class="fab fa-twitter fa-lg"></i></a>
<a href="#" class="text-white mr-3"><i class="fab fa-instagram fa-lg"></i></a>
<a href="#" class="text-white mr-3"><i class="fab fa-linkedin fa-lg"></i></a>
</div>
</div>
</div>
</div>
</div>
</footer>
<!-- Footer Section -->
<footer class="footer">
<p>© <?php echo date('Y'); ?> <?php echo htmlspecialchars($header_name); ?> | <a href="/page.php?slug=privacy">Privacy Policy</a> | <a href="/page.php?slug=terms">Terms of Service</a></p>
</footer>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>