-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcontact.php
More file actions
657 lines (566 loc) · 23 KB
/
contact.php
File metadata and controls
657 lines (566 loc) · 23 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
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
<!-- form submission using php by sagar -->
<?php
session_start(); // Start the session at the very beginning
require 'vendor/autoload.php'; // Load Composer's autoloader
// Initialize variables
$name = $email = $subject = $message = '';
$errors = [];
$success_message = $error_message = '';
// Check if the form is submitted
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['submit'])) {
// Get and sanitize form data
$name = htmlspecialchars(trim($_POST['name']));
$email = htmlspecialchars(trim($_POST['email']));
$subject = htmlspecialchars(trim($_POST['subject']));
$message = htmlspecialchars(trim($_POST['message']));
// Validate inputs
if (empty($name)) {
$errors[] = "Name is required";
} elseif (strlen($name) > 100) {
$errors[] = "Name must be less than 100 characters";
}
if (empty($email)) {
$errors[] = "Email is required";
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$errors[] = "Invalid email format";
}
if (empty($message)) {
$errors[] = "Message is required";
} elseif (strlen($message) > 1000) {
$errors[] = "Message must be less than 1000 characters";
}
// If no errors, proceed with sending email
if (empty($errors)) {
try {
// Load Composer's autoloader
require 'vendor/autoload.php';
// Create an instance of PHPMailer
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
// Server settings
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com'; // Use Gmail SMTP server
$mail->SMTPAuth = true;
include 'pass.php'; // Include your config file for email credentials
$mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
// Recipients
$mail->setFrom($email, $name);
$mail->addAddress('sagarsahu5976@gmail.com'); // Where you want to receive emails
// Content
$mail->isHTML(true);
$mail->Subject = $subject ?: "Contact Form Submission";
$mail->Body = "
<h2>Contact Form Submission</h2>
<p><strong>Name:</strong> {$name}</p>
<p><strong>Email:</strong> {$email}</p>
<p><strong>Subject:</strong> {$subject}</p>
<p><strong>Message:</strong></p>
<p>" . nl2br($message) . "</p>
";
$mail->send();
$_SESSION['success_message'] = "Thank you for contacting us. We will get back to you soon!";
// Clear form fields after successful submission
$name = $email = $subject = $message = '';
// Redirect to prevent form resubmission
header("Location: " . $_SERVER['PHP_SELF']);
exit();
} catch (Exception $e) {
$error_message = "Mailer Error: " . $mail->ErrorInfo;
}
}
}
// Get success message from session and clear it
if (isset($_SESSION['success_message'])) {
$success_message = $_SESSION['success_message'];
unset($_SESSION['success_message']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Contact</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" />
<!-- <link rel="stylesheet" href="/assets/styles.css"> -->
<link rel="stylesheet" href="/src/output.css">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
<!-- AOS CSS -->
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<!-- AOS JS -->
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
AOS.init({
duration: 800,
once: true,
offset: 0,
disable: 'mobile'
});
});
</script>
<style>
/* styles.css */
@import url("https://fonts.googleapis.com/css2?family=Spartan:wght@100;200;300;400;500;600;700;800;900&display=swap");
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Spartan', sans-serif;
}
/* h1{
font-size: 50px;
line-height: 64px;
color: #222;
}
h2{
font-size: 46px;
line-height: 54px;
color: #222;
}
h4{
font-size: 20px;
color: #222;
}
h6{
font-weight: 700;
font-size: 12px;
}
p{
font-size: 16px;
color: #465b52;
margin:15px 0 20px 0;
} */
.section-p1{
padding:40px 80px;
}
.section-m1{
margin:40px 0;
}
button.normal{
font-size: 14px;
padding: 15px 30px;
color: #000;
background-color: #fff;
border-radius: 4px;
cursor: pointer;
border: none;
outline: none;
transition: 0.2s ease;
}
/* Footer */
footer {
display: flex;
justify-content: center;
align-items: center;
padding: 40px 60px 40px 70px;
margin: 0 auto;
line-height: 2rem;
}
#footer-inner{
padding-bottom: 40px;
}
footer h4{
color: #fff;
padding-bottom: 10px;
font-size:1rem;
line-height: 1.75/1.125;
}
.special{
padding-top: 30px ;
font-size: 14px;
font-weight: 500;
}
/* ABOUT */
/* who are we */
#about-head{
display: flex;
align-items: center;
}
#about-head img{
width: 50%;
height: auto;
}
#about-head div{
padding-left: 40px;
}
#about-head p{
padding:20px 0 20px 0;
}
/* about app */
#about-app{
text-align: center;
}
#about-app .video{
width: 70%;
height: 100%;
margin: 30px auto 0 auto;
}
#about-app .video video{
width: 100%;
height: 100%;
border-radius: 20px;
}
/* Contact */
#page-header.contact-header{
background-image: url('/SyllabiSync/assets/image/banner/banner.png');
}
#contact-details{
display: flex;
align-items: center;
justify-content: space-between;
}
#contact-details .details{
width: 40%;
}
#contact-details .details .span,
#form-details form span{
font-size: 12px;
}
#contact-details .details h2,
#form-details form h2{
font-size: 26px;
line-height: 35px;
padding: 20px 0;
}
#contact-details .details h3{
font-size: 16px;
padding-bottom: 15px;
}
#contact-details .details li{
list-style: none;
display: flex;
padding: 10px 0;
}
#contact-details .details li i{
font-size: 14px;
padding-right: 22px;
}
#contact-details .details li p{
font-size: 14px;
margin: 0;
}
#contact-details .map{
width: 55%;
height: 400px;
}
#contact-details .map iframe{
width: 100%;
height: 100%;
}
#form-details{
display: flex;
justify-content: space-between;
margin: 30px;
padding: 80px;
border: 1px solid #e1e1e1;
}
#form-details form{
width: 65%;
display: flex;
flex-direction: column;
align-items: flex-start;
}
#form-details form input,
#form-details form textarea{
width: 100%;
padding: 12px 15px;
outline: none;
margin-bottom: 20px;
border: 1px solid #e1e1e1;
}
#form-details form button{
padding: 15px 32px;
background-color: #1E88E5;
color: #fff;
border-radius: 4px;
}
#form-details .people div{
padding-bottom: 25px;
display: flex;
align-items: flex-start;
}
#form-details .people div img{
width: 65px;
height: 65px;
object-fit: cover;
margin-right: 15px;
}
#form-details .people div p{
margin: 0;
font-size: 13px;
line-height: 25px;
}
#form-details .people div p span{
display: block;
font-size: 16px;
font-weight: 600;
color: #000;
}
/* Newsletter */
#newsletter{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
align-items: center;
background-image: url('/src/pro/assets/image/banner/b14.png');
background-repeat: no-repeat;
background-position: 20% 30%;
background-color: #000501;
padding: 60px 40px;
margin: 0px;
}
#newsletter h4{
font-size: 22px;
font-weight: 700;
color: #fff;
}
#newsletter p{
font-size: 14px;
font-weight: 600;
color: #818ea0;
}
#newsletter p span{
color: #ffbd27;
}
#newsletter .form{
display: flex;
width: 40%;
}
#newsletter input{
height: 3.125rem;
padding: 0 1.25rem;
font-size: 14px;
width: 100%;
border: 1px solid transparent ;
border-radius: 4px;
outline: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
background-color: #fff;
}
#newsletter button{
background-color: #1E88E5;
color: #fff;
white-space: nowrap;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
</style>
</head>
<body class="font-[Poppins] flex flex-col min-h-screen">
<!--NAVBAR -->
<nav class="flex justify-around gap-10 fixed top-0 h-20 w-full p-6 text-center items-center shadow-md shadow-gray-400/50 bg-white z-50">
<div class="container mx-auto flex items-center justify-between p-5">
<!-- logo -->
<div class="flex items-center space-x-2">
<span class="text-2xl text-white bg-blue-600 px-2 py-1 rounded-md font-semibold">Syllabi</span>
<span class="text-2xl text-blue-600 font-semibold">Sync</span>
</div>
<!-- Desktop Menu -->
<div class="hidden md:flex justify-between space-x-9 gap-18 font-semibold ">
<a href="landing_page.php" class="relative text-sm text-gray-800 hover:text-blue-500 after:block after:h-[2px] after:w-0 after:bg-blue-500 after:transition-all after:duration-300 hover:after:w-full">Home</a>
<a href="about.php" class="relative text-sm text-gray-800 hover:text-blue-500 after:block after:h-[2px] after:w-0 after:bg-blue-500 after:transition-all after:duration-300 hover:after:w-full">About</a>
<a href="Curriculum.php" class="relative text-sm text-gray-800 hover:text-blue-500 after:block after:h-[2px] after:w-0 after:bg-blue-500 after:transition-all after:duration-300 hover:after:w-full">Curriculum</a>
<a href="contact.php" class="relative text-sm text-gray-800 hover:text-blue-500 after:block after:h-[2px] after:w-0 after:bg-blue-500 after:transition-all after:duration-300 hover:after:w-full">Contact</a>
</div>
</div>
</nav>
<!-- MAIN BANNER -->
<div id="page-header" class="w-full h-[50vh] bg-cover flex justify-center text-center flex-col p-4 text-white bg-[url('/SyllabiSync/assets/image/banner/banner.png')] shadow-lg mt-20">
<h2 class="text-white text-shadow-md text-5xl font-bold mb-4">#let's_talk</h2>
<p class="text-white text-shadow-md">LEAVE A MESSAGE, WE LOVE TO HEAR FROM YOU!</p>
</div>
<!-- CONTACT US -->
<section id="contact-details" class="section-p1" data-aos="fade-up" data-aos-anchor-placement="top-bottom">
<div class="details">
<span>GET IN TOUCH</span>
<h2 class="font-bold">Visit one of our agency locations or contact us today</h2>
<h3 class="font-bold">Head Office</h3>
<div>
<li>
<i class="fal fa-map"></i>
<p>Jalandhar - Delhi, Grand Trunk Rd,Phagwara, Punjab</p>
</li>
<li>
<i class="fal fa-envelope"></i>
<p>contact@example.com</p>
</li>
<li>
<i class="fal fa-phone-alt"></i>
<p>contact@example.com</p>
</li>
<li>
<i class="fal fa-clock"></i>
<p>Monday to Sunday: 9.00am to 16.00pm</p>
</li>
</div>
</div>
<div class="map">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6821.539321670383!2d75.69947334407317!3d31.2547991973461!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x391a5f5e9c489cf3%3A0x4049a5409d53c300!2sLovely%20Professional%20University!5e0!3m2!1sen!2sin!4v1701365479707!5m2!1sen!2sin" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
</section>
<!-- Error Messages -->
<?php if (!empty($errors)): ?>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-6">
<strong>Please correct the following errors:</strong>
<ul class="list-disc pl-5 mt-2">
<?php foreach ($errors as $error): ?>
<li><?php echo htmlspecialchars($error); ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<!-- Success Message -->
<?php if (!empty($success_message)): ?>
<div class="fixed top-30 right-5 z-50 ">
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 px-4 py-3 rounded-lg shadow-lg" role="alert">
<div class="flex items-center">
<div class="py-1">
<svg class="fill-current h-6 w-6 text-green-500 mr-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"/>
</svg>
</div>
<div>
<p class="font-bold">Success!</p>
<p><?php echo htmlspecialchars($success_message); ?></p>
</div>
<button onclick="this.parentElement.parentElement.remove()" class="ml-auto text-green-500 hover:text-green-700">
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"/>
</svg>
</button>
</div>
</div>
</div>
<?php endif; ?>
<!-- Mail Error Message -->
<?php if (!empty($error_message)): ?>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-6">
<?php echo htmlspecialchars($error_message); ?>
</div>
<?php endif; ?>
<!-- FORM SECTION -->
<section id="form-details" data-aos="fade-up" data-aos-anchor-placement="top-bottom">
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" id="contactForm" method="POST">
<span>LEAVE A MESSAGE</span>
<h2 class="font-bold">We Love To Hear From You</h2>
<input type="text" id="name" name="name" placeholder="Your Name" required
class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent hover:border-blue-400 transition duration-300"><span class="text-red-500">*</span>
<input type="email" id="email" name="email" placeholder="Your E-mail" required
class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent hover:border-blue-400 transition duration-300"><span class="text-red-500">*</span>
<input type="text" id="subject" name="subject" placeholder="Your Subject" required
class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent hover:border-blue-400 transition duration-300"><span class="text-red-500">*</span>
<textarea id="message" name="message" cols="30" rows="10" placeholder="Your Message"
class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent hover:border-blue-400 transition duration-300"></textarea>
<button type="submit" name="submit"
class="w-full bg-indigo-600 text-white rounded-lg px-6 py-3 hover:bg-indigo-700 transition duration-300">
Submit
</button>
</form>
<!-- people -->
<div class="people">
<div>
<img src="assets/image/people/1.png" alt="">
<p><span>John Doe</span> Senior Marketing Manager <br> Phone: + 000 123 000 77 88 <br>Email: contact@example.com</p>
</div>
<div>
<img src="assets/image/people/2.png" alt="">
<p><span>William Smith</span> Senior Marketing Manager <br> Phone: + 000 123 000 77 88 <br>Email: contact@example.com</p>
</div>
<div>
<img src="assets/image/people/3.png" alt="">
<p><span>Emma Stone</span> Senior Marketing Manager <br> Phone: + 000 123 000 77 88 <br>Email: contact@example.com</p>
</div>
</div>
</section>
<!-- NEWSLETTER -->
<section id="newsletter" class="section-p1 section-m1">
<div class="newstext">
<h4>Looking For News Letters?</h4>
<p>Get E-mail Updates About Our Latest Syllabus And <span>Special Curriculum.</span></p>
</div>
<div class="pr-0 mr-0">
<!-- <input type="text" placeholder="Your email address"> -->
<a class="w-64 h-15 bg-blue-500 rounded-sm text-white font-medium text-xl flex justify-center items-center" href="https://facilities.aicte-india.org/AICTEConnect/FEB2025/#p=1" target="_blank">Newsletter</a>
</div>
</section>
<!-- FOOTER -->
<footer class="bg-gray-900 text-white">
<div class="mx-auto px-4">
<div class="grid grid-cols-4 gap-18" id="footer-inner">
<div>
<h4 class="text-sm font-semibold mb-4 ">About AICTE</h4>
<p class="text-gray-400">
All India Council for Technical Education (AICTE) is the statutory body and a national-level council for technical education.
</p>
</div>
<div class="p-12">
<h4 class="text-base font-semibold mb-4 ">Quick Links</h4>
<ul class="space-y-12 text-gray-400 flex flex-col justify-between">
<li><a href="landing_page.php" class="hover:text-orange-300">Home</a></li>
<li><a href="about.php" class="hover:text-orange-300">About</a></li>
<li><a href="curriculum.php" class="hover:text-orange-300">Curriculum</a></li>
<li><a href="contact.php" class="hover:text-orange-300">Contact</a></li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-4">Resources</h4>
<ul class="space-y-2 text-gray-400">
<li><a href="#" class="hover:text-orange-300">Documentation</a></li>
<li><a href="#" class="hover:text-orange-300">Guidelines</a></li>
<li><a href="#" class="hover:text-orange-300">FAQs</a></li>
<li><a href="#" class="hover:text-orange-300">Support</a></li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-4">Contact</h4>
<address class="text-gray-400 not-italic">
Nelson Mandela Marg<br>
Vasant Kunj, New Delhi-110070<br>
India<br>
<a href="mailto:support@aicte-india.org" class="hover:text-orange-300">support@aicte-india.org</a>
</address>
</div>
</div>
<div class="mt-8 pt-8 border-t border-gray-800 text-center text-gray-400 special">
<p>© <?php echo date('Y'); ?> CTRL+C. All rights reserved.</p>
</div>
</div>
</footer>
<!-- Form validation -->
<script>
document.querySelector('form').addEventListener('submit', function(e) {
let valid = true;
// Validate name
const name = document.getElementById('name');
if (name.value.trim() === '') {
valid = false;
name.classList.add('border-red-500');
} else {
name.classList.remove('border-red-500');
}
// Validate email
const email = document.getElementById('email');
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(email.value)) {
valid = false;
email.classList.add('border-red-500');
} else {
email.classList.remove('border-red-500');
}
// Validate message
const message = document.getElementById('message');
if (message.value.trim() === '') {
valid = false;
message.classList.add('border-red-500');
} else {
message.classList.remove('border-red-500');
}
if (!valid) {
e.preventDefault();
}
});
</script>
</body>
</html>