-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontact.php
More file actions
127 lines (117 loc) · 4.57 KB
/
contact.php
File metadata and controls
127 lines (117 loc) · 4.57 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
<?php
include "core.php";
head();
if ($settings['sidebar_position'] == 'Left') {
sidebar();
}
?>
<div class="col-md-8 mb-3">
<div class="card">
<div class="card-header"><i class="fas fa-envelope"></i> Contact</div>
<div class="card-body">
<h5 class="mb-3">Social Profiles</h5>
<div class="list-group">
<a class="list-group-item list-group-item-action" href="mailto:<?php
echo $settings['email'];
?>" target="_blank"><i class="fa fa-envelope"></i><span> E-Mail: <strong><?php
echo $settings['email'];
?></span></strong></a>
<?php
if ($settings['facebook'] != '') {
?>
<a class="list-group-item list-group-item-primary list-group-item-action" href="<?php
echo $settings['facebook'];
?>" target="_blank"><strong><i class="fab fa-facebook-square"></i> Facebook</strong></a>
<?php
}
if ($settings['instagram'] != '') {
?>
<a class="list-group-item list-group-item-warning list-group-item-action" href="<?php
echo $settings['instagram'];
?>" target="_blank"><strong><i class="fab fa-instagram"></i> Instagram</strong></a>
<?php
}
if ($settings['twitter'] != '') {
?>
<a class="list-group-item list-group-item-info list-group-item-action" href="<?php
echo $settings['twitter'];
?>" target="_blank"><strong><i class="fab fa-twitter-square"></i> Twitter</strong></a>
<?php
}
if ($settings['youtube'] != '') {
?>
<a class="list-group-item list-group-item-danger list-group-item-action" href="<?php
echo $settings['youtube'];
?>" target="_blank"><strong><i class="fab fa-youtube-square"></i> YouTube</strong></a>
<?php
}
if ($settings['linkedin'] != '') {
?>
<a class="list-group-item list-group-item-primary list-group-item-action" href="<?php
echo $settings['linkedin'];
?>" target="_blank"><strong><i class="fab fa-linkedin"></i> LinkedIn</strong></a>
<?php
}
?>
</div>
<h5 class="mt-4 mb-2">Leave Your Message</h5>
<?php
if (isset($_POST['send'])) {
if ($logged == 'No') {
$name = $_POST['name'];
$email = $_POST['email'];
} else {
$name = $rowu['username'];
$email = $rowu['email'];
}
$content = $_POST['text'];
$date = date('d F Y');
$time = date('H:i');
$captcha = '';
if (isset($_POST['g-recaptcha-response'])) {
$captcha = $_POST['g-recaptcha-response'];
}
if ($captcha) {
$url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($settings['gcaptcha_secretkey']) . '&response=' . urlencode($captcha);
$response = file_get_contents($url);
$responseKeys = json_decode($response, true);
if ($responseKeys["success"]) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo '<div class="alert alert-danger">The entered E-Mail Address is invalid.</div>';
} else {
$query = mysqli_query($connect, "INSERT INTO messages (name, email, content, date, time) VALUES('$name','$email','$content','$date','$time')");
echo '<div class="alert alert-success">Your message has been sent successfully.</div>';
}
}
}
}
?>
<form method="post" action="">
<?php
if ($logged == 'No') {
?>
<label for="name"><i class="fa fa-user"></i> Name:</label>
<input type="text" name="name" id="name" value="" class="form-control" required />
<br />
<label for="email"><i class="fa fa-envelope"></i> E-Mail Address:</label>
<input type="email" name="email" id="email" value="" class="form-control" required />
<br />
<?php
}
?>
<label for="input-message"><i class="far fa-file-alt"></i> Message:</label>
<textarea name="text" id="input-message" rows="8" class="form-control" required></textarea>
<br /><center><div class="g-recaptcha" data-sitekey="<?php
echo $settings['gcaptcha_sitekey'];
?>"></div></center>
<input type="submit" name="send" class="btn btn-primary col-12" value="Send" />
</form>
</div>
</div>
</div>
<?php
if ($settings['sidebar_position'] == 'Right') {
sidebar();
}
footer();
?>