-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
281 lines (237 loc) · 8.91 KB
/
index.php
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?php
// Database connection file (db_connection.php)
$servername = "localhost:3307";
$username = "root";
$password = "";
$dbname = "asib";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Function to fetch all data from the database
function fetchAllData()
{
global $conn;
$data = array();
// Fetch navbar data
$data['navbarData'] = fetchData('navbar_table');
// Fetch home data
$data['homeData'] = fetchData('home_section');
// Fetch services data
$data['servicesData'] = fetchData('services_table');
// Fetch projects data
$data['projectsData'] = fetchData('projects_table');
// Fetch education data
$data['educationData'] = fetchData('education_table');
// Fetch social icons data
$data['socialIconsData'] = fetchData('social_icons');
// Fetch footer links data
$data['footerLinksData'] = fetchData('footer_links');
return $data;
}
// Function to fetch data from the database
function fetchData($tableName)
{
global $conn;
$sql = "SELECT * FROM $tableName";
$result = $conn->query($sql);
$data = array();
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$data[] = $row;
}
}
return $data;
}
// Function to insert a message into the database
function insertMessage($fullName, $email, $phoneNumber, $subject, $message)
{
global $conn;
$sql = "INSERT INTO contact_messages (full_name, email, phone_number, subject, message)
VALUES ('$fullName', '$email', '$phoneNumber', '$subject', '$message')";
if ($conn->query($sql) === TRUE) {
return true;
} else {
return false;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Atikur Rahman</title>
<link rel="stylesheet" href="style.css">
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
</head>
<body>
<header class="header">
<a href="#home" class="logo">Atikur<span>Rahman</span></a>
<i class='bx bx-menu' id="menu-icon"></i>
<nav class="navbar">
<?php
$navbarData = fetchData('navbar_table'); // Replace 'navbar_table' with your actual table name
foreach ($navbarData as $item) {
?>
<a href="<?php echo $item['link']; ?>" <?php echo ($item['is_active'] == 1) ? 'class="active"' : ''; ?>>
<?php echo $item['title']; ?>
</a>
<?php
}
?>
</nav>
</header>
<section class="home" id="home">
<?php
$homeData = fetchData('home_section'); // Replace 'home_section' with your actual table name
foreach ($homeData as $item) {
?>
<div class="home-img">
<img src="<?php echo $item['image_url']; ?>" alt="">
</div>
<div class="home-content">
<h1>Hi, It's<span><?php echo $item['name']; ?></span></h1>
<h3 class="text-animation">I am a <span><?php echo $item['role']; ?></span></h3>
<p><?php echo $item['description']; ?></p>
<div class="social-icons">
<?php
$socialIconsData = fetchData('social_icons'); // Replace 'social_icons' with your actual table name
foreach ($socialIconsData as $icon) {
?>
<a href="<?php echo $icon['link']; ?>"><i class='bx <?php echo $icon['icon_class']; ?>'></i></a>
<?php
}
?>
</div>
<a href="#" class="btn"><?php echo $item['cta_button_text']; ?></a>
</div>
<?php
}
?>
</section>
<section class="services" id="services">
<h2 class="heading">Services</h2>
<div class="service-container">
<?php
$servicesData = fetchData('services_table'); // Replace 'services_table' with your actual table name
foreach ($servicesData as $service) {
?>
<div class="services-box">
<i class='bx <?php echo $service['icon']; ?>'></i>
<h3><?php echo $service['title']; ?></h3>
<p><?php echo $service['description']; ?></p>
<a href="#" class="btn">Learn More</a>
</div>
<?php
}
?>
</div>
</section>
<section class="project" id="projects">
<h2 class="heading">Projects</h2>
<div class="projects-container">
<?php
$projectsData = fetchData('projects_table'); // Replace 'projects_table' with your actual table name
foreach ($projectsData as $project) {
?>
<div class="projects-box">
<img src="<?php echo $project['image_url']; ?>" alt="">
<div class="project-info">
<h4><?php echo $project['title']; ?></h4>
<p><?php echo $project['description']; ?><br>
<a href="<?php echo $project['github_link']; ?>">GitHub Link</a>
</p>
</div>
</div>
<?php
}
?>
</div>
</section>
<section class="timeline-section" id="education">
<h2 class="heading">Education</h2>
<div class="timeline-items">
<?php
$educationData = fetchData('education_table'); // Replace 'education_table' with your actual table name
foreach ($educationData as $educationItem) {
?>
<div class="timeline-item">
<div class="timeline-dot"></div>
<div class="timeline-date"><?php echo $educationItem['year']; ?></div>
<div class="timeline-content">
<h3><?php echo $educationItem['degree']; ?></h3>
<p><?php echo $educationItem['description']; ?><br>
<a href="<?php echo $educationItem['institution_link']; ?>"><?php echo $educationItem['institution']; ?></a>
</p>
</div>
</div>
<?php
}
?>
</div>
</section>
<!-- Contact Me Section -->
<section class="contact" id="contact">
<h2 class="heading">Contact<span> Me</span></h2>
<form action="#" method="post">
<div class="input-box">
<input type="text" name="full_name" placeholder="Full Name" required>
<input type="email" name="email" placeholder="Email" required>
</div>
<div class="input-box">
<input type="tel" name="phone_number" placeholder="Phone number" required>
<input type="text" name="subject" placeholder="Subject" required>
</div>
<textarea name="message" cols="30" rows="10" placeholder="Your Message" required></textarea>
<input type="submit" name="submit_message" value="Send Message" class="btn">
</form>
<?php
// Process form submission
if (isset($_POST['submit_message'])) {
$fullName = $_POST['full_name'];
$email = $_POST['email'];
$phoneNumber = $_POST['phone_number'];
$subject = $_POST['subject'];
$message = $_POST['message'];
if (insertMessage($fullName, $email, $phoneNumber, $subject, $message)) {
echo '<p class="success-message">Message sent successfully!</p>';
} else {
echo '<p class="error-message">Error: Unable to send the message. Please try again later.</p>';
}
}
?>
</section>
<footer class="footer">
<div class="social">
<?php
$socialIconsData = fetchData('social_icons'); // Replace 'social_icons' with your actual table name
foreach ($socialIconsData as $icon) {
?>
<a href="<?php echo $icon['link']; ?>"><i class='bx <?php echo $icon['icon_class']; ?>'></i></a>
<?php
}
?>
</div>
<ul class="list">
<?php
$footerLinksData = fetchData('footer_links'); // Replace 'footer_links' with your actual table name
foreach ($footerLinksData as $link) {
?>
<li>
<a href="<?php echo $link['url']; ?>"><?php echo $link['title']; ?></a>
</li>
<?php
}
?>
</ul>
</footer>
<script src="script.js"></script>
</body>
</html>
<?php
// Close the database connection
$conn->close();
?>