-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.php
119 lines (79 loc) · 3.11 KB
/
contact.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
<?php
include 'components/connect.php';
session_start();
if(isset($_SESSION['user_id'])){
$user_id = $_SESSION['user_id'];
}else{
$user_id = '';
};
if(isset($_POST['send'])){
$name = $_POST['name'];
$name = filter_var($name, FILTER_SANITIZE_STRING);
$email = $_POST['email'];
$email = filter_var($email, FILTER_SANITIZE_STRING);
$number = $_POST['number'];
$number = filter_var($number, FILTER_SANITIZE_STRING);
$msg = $_POST['msg'];
$msg = filter_var($msg, FILTER_SANITIZE_STRING);
$select_message = $conn->prepare("SELECT * FROM `messages` WHERE name = ? AND email = ? AND number = ? AND message = ?");
$select_message->execute([$name, $email, $number, $msg]);
if($select_message->rowCount() > 0){
$message[] = 'already sent message!';
}else{
$insert_message = $conn->prepare("INSERT INTO `messages`(user_id, name, email, number, message) VALUES(?,?,?,?,?)");
$insert_message->execute([$user_id, $name, $email, $number, $msg]);
$message[] = 'sent message successfully!';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>contact</title>
<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<!-- custom css file link -->
<link rel="stylesheet" href="css/style.css">
<!-- aos cdn -->
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet">
</head>
<body>
<!-- header section starts -->
<?php include 'components/user_header.php'; ?>
<!-- header section ends -->
<div class="heading">
<h3 data-aos="zoom-in" data-aos-duration="1500">contact us</h3>
<p><a href="index.php">home</a> <span> / contact</span></p>
</div>
<!-- contact section starts -->
<section class="contact">
<div class="row">
<div class="image" data-aos="fade-left" data-aos-duration="1100">
<img src="images/contact-img.png" alt="">
</div>
<form action="" method="post" data-aos="fade-right" data-aos-duration="1200">
<h3>tell us something!</h3>
<input type="text" name="name" maxlength="50" class="box" placeholder="enter your name" required>
<input type="number" name="number" min="0" max="9999999999" class="box" placeholder="enter your number" required maxlength="10">
<input type="email" name="email" maxlength="50" class="box" placeholder="enter your email" required>
<textarea name="msg" class="box" required placeholder="enter your message" maxlength="500" cols="30" rows="10"></textarea>
<input type="submit" value="send message" name="send" class="btn">
</form>
</div>
</section>
<!-- contact section ends -->
<!-- footer section starts -->
<?php include 'components/footer.php'; ?>
<!-- footer section ends -->
<!-- custom js file link -->
<script src="js/script.js"></script>
<!-- aos js cdn -->
<script src="https://unpkg.com/[email protected]/dist/aos.js"></script>
<script>
AOS.init();
</script>
</body>
</html>