-
Notifications
You must be signed in to change notification settings - Fork 0
/
usercontact.php
366 lines (304 loc) · 14.8 KB
/
usercontact.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
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
<?php
//Starts Session
session_start();
ob_start();
//If not logged in as user
if (!isset($_SESSION['username'])) {
$_SESSION['msg'] = "You must log in first";
header('location: login.php');
}
//Logout
if (isset($_GET['logout'])) {
session_destroy();
unset($_SESSION['username']);
header("location: login.php");
}
$db = mysqli_connect("localhost","root","", "projectwd");
// initializing variables
$name = "";
$email = "";
$phoneNumber = "";
$inquiries = "";
$errors = array();
// REGISTER USER
if (isset($_POST['contact'])) {
// receive all input values from the form
$name = mysqli_real_escape_string($db, $_POST['name']);
$email = mysqli_real_escape_string($db, $_POST['email']);
$phoneNumber = mysqli_real_escape_string($db, $_POST['phoneNumber']);
$inquiries = mysqli_real_escape_string($db, $_POST['inquiries']);
// form validation: ensure that the form is correctly filled ...
// by adding (array_push()) corresponding error unto $errors array
if (empty($name)) { array_push($errors, "Nama diperlukan"); }
if (empty($email)) { array_push($errors, "Email diperlukan"); }
if (empty($phoneNumber)) { array_push($errors, "Nombor telefon diperlukan"); }
if (empty($inquiries)) { array_push($errors, "Borang tidak boleh kosong"); }
// Finally, register user if there are no errors in the form
if (count($errors) == 0) {
$query = "INSERT INTO contact (name, email, phoneNumber, inquiries)
VALUES('$name', '$email', '$phoneNumber', '$inquiries')";
mysqli_query($db, $query);
}
}
?>
<!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">
<title>BJBshop</title>
<!-- Google Fonts -->
<link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,200,300,700,600' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Raleway:400,100' rel='stylesheet' type='text/css'>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="css/owl.carousel.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="css/responsive.css">
<style>
.column {
float: left;
padding: 36px;
}
</style>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="header-area">
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="user-menu">
</div>
</div>
<div class="col-md-4">
<div class="header-right">
</div>
</div>
</div>
</div>
</div> <!-- End header area -->
<div class="site-branding-area">
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="logo">
<h1><a href="index.php"><span>BJBshop | Laman Utama</span></a></h1>
</div>
</div>
<div class="col-sm-6">
<div class="shopping-item">
<?php
if(!empty($_SESSION["shopping_cart"])) {
$cart_count = count(array_keys($_SESSION["shopping_cart"]));
?>
<div class="cart_div">
<a href="usercart.php">
<img src="cart-icon.png" /> Cart
<span><?php echo $cart_count; ?></span></a>
</div>
<?php
}
else if(empty($_SESSION["shopping_cart"])) {
?>
<div class="cart_div">
<a href="usercart.php">
<img src="cart-icon.png" /> Cart
</a>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div> <!-- End site branding area -->
<div class="mainmenu-area">
<div class="container">
<div class="row">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li ><a id="homePage" href="userindex.php">Laman Utama</a></li>
<li ><a href="usershop.php">Halaman Kedai</a></li>
<li class="active"><a href="usercontact.php">Hubungi Kami</a></li>
<div class="dropdownnew">
<button class="dropbtn"><a href="#" class="profileIcon"></a><img src="img/images.jpeg" class="image-circle"/>  <?php echo $_SESSION['username']; ?></button>
<div class="dropdownnew-content">
<a id="myAcct" href="useraccount.php">Akaun saya</a>
<a id="myPurchase" href="userpurchase.php">Pembelian Saya</a>
<a id="logout" href="logout.php">Log Keluar</a>
</div>
</div>
</ul>
</div>
</div>
</div>
</div> <!-- End mainmenu area -->
</div>
<div class="product-big-title-area">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="product-bit-title text-center">
<h2>Hubungi Kami</h2>
</div>
</div>
</div>
</div>
</div>
<ul class="breadcrumb">
<li><a href="userindex.php">Halaman Utama</a></li>
<li>Hubungi Kami</li>
</ul>
<!----------------------------------------------------------------------------------------------->
<div style="background-image: url('img/theme3.jpg');">
<div class="product-widget-area">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="brand-wrapper">
<br><br><br>
<div class="row">
<center>
<h1>
BANGSA JOHOR BAHAGIA
</h1>
<BR></BR>
<div class="column" style="background-color:rgb(112, 110, 114);">
<h3>
Alamat
</h3>
<h4>
Jalan Pulai Harmoni 3, <br>
Bandar Baru Kangkar Pulai, <br>
Skudai, Johor Bahru
</h4>
<br>
<h3>
Hubungi kami
</h3>
<h4>
019-970 3189 (Pn Su)
</h4>
<br>
<h3>
Email
</34>
<h4>
<a href="mailto:[email protected]" target="_top">[email protected]</a>
</h4>
</center>
<div class="column" style="background-color:rgb(144, 106, 179);">
<div>
<form method="post" action="usercontact.php">
<b>
<h4>Nama:</h4> <input type="text" name="name" size="50" placeholder="Nama"><br><br>
<h4>Email:</h4> <input type="email" name="email" size="50" placeholder="Email"><br><br>
<h4>No Telefon:</h4> <input type="number" name="phoneNumber" onkeypress="return mask(this,event);" size="53" placeholder="Nombor Telefon"><br><br>
<h4>Tinggalkan Mesej anda:</h4> <textarea type="textarea" name="inquiries" rows="10" cols="70" placeholder="Mesej"></textarea><br><br>
</b>
<?php include('errors.php'); ?>
<div class="input-group">
<button type="submit" class="btn" name="contact" onclick="alert('Mesej anda telah dihantar. Terima kasih!')">Hantar</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!------------------------------------------------------------------------------------------------------------------------->
<!-- End brands area -->
</div>
<div class="footer-top-area">
<div class="zigzag-bottom"></div>
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-6">
<div class="footer-about-us">
<h2><span>BJBshop</span></h2>
<p>Bangsa Johor Bahagia(BJB) dengan kerjasama UTM telah menciptakan medium terbaik untuk setiap pengguna mencari dan membeli pelbagai barangan harian seperti barangan kosmetik, makanan, minuman, pakaian dan sebagainya. BJBshop telah dicipta sejak Januari 2021. Laman web kami diciptakan bagi memudahkan urusniaga dalam talian anda. Langgani laman web kami & bersedia dengan kemaskini dan promosi terbaru! </p>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footer-menu">
<h2 class="footer-wid-title">Navigasi Pengguna </h2>
<ul>
<li><a href="">Akaun saya</a></li>
<li><a href="">Halaman kedai</a></li>
<li><a href="">Hubungi kami</a></li>
</ul>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footer-menu">
<h2 class="footer-wid-title">Kategori</h2>
<ul>
<li><a href="">Peralatan dapur</a></li>
<li><a href="">Kosmetik</a></li>
<li><a href="">Makanan</a></li>
<li><a href="">Minuman</a></li>
<li><a href="">Pakaian</a></li>
</ul>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footer-newsletter">
<h2 class="footer-wid-title">Ikuti kami</h2>
<div class="footer-social">
<a href="#" target="_blank"><i class="fa fa-facebook"></i></a>
<a href="#" target="_blank"><i class="fa fa-twitter"></i></a>
<a href="#" target="_blank"><i class="fa fa-youtube"></i></a>
<a href="#" target="_blank"><i class="fa fa-linkedin"></i></a>
<a href="#" target="_blank"><i class="fa fa-pinterest"></i></a>
</div>
</div>
</div>
</div>
</div>
</div> <!-- End footer top area -->
<div class="footer-bottom-area">
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="copyright">
<p>Penaja: <img src="img/bjblogo.jpg" width="50" height="50"> <img src="img/utmlogo.jpg" width="50" height="50">
</div>
</div>
</div>
</div>
</div> <!-- End footer bottom area -->
<!-- Latest jQuery form server -->
<script src="https://code.jquery.com/jquery.min.js"></script>
<!-- Bootstrap JS form CDN -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- jQuery sticky menu -->
<script src="js/owl.carousel.min.js"></script>
<script src="js/jquery.sticky.js"></script>
<!-- jQuery easing -->
<script src="js/jquery.easing.1.3.min.js"></script>
<!-- Main Script -->
<script src="js/main.js"></script>
</body>
</html>