-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
334 lines (289 loc) · 14.1 KB
/
index.php
File metadata and controls
334 lines (289 loc) · 14.1 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
<?php
// index.php - Client Login Page
require_once 'config.php';
$error_message = '';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Client login only - must have client role
if (true) {
// Client/Staff login (client role only, not admin)
$userid = $_POST['userid'];
$password = $_POST['password'];
// Client login - must have client role (not admin)
$stmt = $conn->prepare("SELECT * FROM staff WHERE user_id = ? AND password = ? AND status = 'Enable' AND role = 'client'");
if ($stmt === false) {
error_log('DB prepare error (client): ' . $conn->error);
$error_message = "System error. Please try again.";
} else {
$stmt->bind_param("ss", $userid, $password);
$stmt->execute();
$result = $stmt->get_result();
if ($result && $result->num_rows == 1) {
$user = $result->fetch_assoc();
$_SESSION['loggedin'] = true;
$_SESSION['role'] = 'client';
$_SESSION['userid'] = $user['id'];
$_SESSION['user_id_string'] = $userid;
$_SESSION['name'] = $user['name'];
$_SESSION['client_name'] = $user['client_name'];
header("location: client_dashboard.php");
exit;
} else {
$error_message = "Invalid client credentials or access denied.";
}
$stmt->close();
}
}
}
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Client Login - DS Diamonds</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Cormorant+Garamond:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
<style>
body {
font-family: 'Inter', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}
.brand-font {
font-family: 'Sora', sans-serif;
}
.serif-font {
font-family: 'Cormorant Garamond', serif;
}
.floating {
animation: float 6s ease-in-out infinite;
}
@keyframes float {
0%,
100% {
transform: translateY(0px);
}
50% {
transform: translateY(-20px);
}
}
.diamond-shine {
position: relative;
overflow: hidden;
}
.diamond-shine::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
animation: shine 3s infinite;
}
@keyframes shine {
0% {
transform: translateX(-100%) translateY(-100%) rotate(45deg);
}
100% {
transform: translateX(100%) translateY(100%) rotate(45deg);
}
}
.input-field {
transition: all 0.3s ease;
}
.input-field:focus {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.gradient-border {
position: relative;
background: white;
border-radius: 1rem;
}
.gradient-border::before {
content: '';
position: absolute;
inset: -2px;
border-radius: 1rem;
padding: 2px;
background: linear-gradient(135deg, #667eea, #764ba2, #f093fb);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
opacity: 0;
transition: opacity 0.3s;
}
.gradient-border:hover::before {
opacity: 1;
}
</style>
</head>
<body class="min-h-screen flex items-center justify-center p-4 relative overflow-hidden">
<!-- Animated Background Elements -->
<div class="absolute inset-0 overflow-hidden pointer-events-none">
<div class="absolute top-20 left-10 w-72 h-72 bg-white/5 rounded-full blur-3xl floating"></div>
<div class="absolute bottom-20 right-10 w-96 h-96 bg-purple-300/10 rounded-full blur-3xl floating"
style="animation-delay: -3s;"></div>
<div class="absolute top-1/2 left-1/3 w-64 h-64 bg-pink-300/10 rounded-full blur-3xl floating"
style="animation-delay: -1.5s;"></div>
</div>
<div class="max-w-6xl w-full mx-auto grid grid-cols-1 lg:grid-cols-2 gap-8 items-center relative z-10">
<!-- Left Side - Branding & Info -->
<div class="text-white hidden lg:block">
<!-- Logo -->
<div class="mb-8">
<div class="flex items-center space-x-3">
<div
class="w-14 h-14 bg-white/10 backdrop-blur-xl rounded-2xl flex items-center justify-center diamond-shine border border-white/20">
<i class="fas fa-gem text-3xl text-white"></i>
</div>
<div>
<h1 class="text-4xl font-bold brand-font">DS Diamonds</h1>
<p class="text-sm text-white/70">Premium Diamond Reseller Portal</p>
</div>
</div>
</div>
<!-- Welcome Text -->
<div class="mb-8">
<h2 class="text-5xl font-bold mb-4 serif-font leading-tight">
Welcome to Your<br />
<span class="bg-gradient-to-r from-white via-purple-200 to-pink-200 bg-clip-text text-transparent">
Diamond Portal
</span>
</h2>
<p class="text-lg text-white/80 leading-relaxed">
Access your exclusive diamond inventory, create custom invite links for your customers,
and manage your business with elegance and precision.
</p>
</div>
<!-- Feature Cards -->
<div class="grid grid-cols-2 gap-4">
<div
class="bg-white/10 backdrop-blur-xl rounded-xl p-4 border border-white/20 hover:bg-white/15 transition">
<div
class="w-10 h-10 bg-gradient-to-br from-blue-400 to-blue-600 rounded-lg flex items-center justify-center mb-3">
<i class="fas fa-diamond text-white"></i>
</div>
<h3 class="font-semibold mb-1">Browse Inventory</h3>
<p class="text-sm text-white/70">Access premium diamonds</p>
</div>
<div
class="bg-white/10 backdrop-blur-xl rounded-xl p-4 border border-white/20 hover:bg-white/15 transition">
<div
class="w-10 h-10 bg-gradient-to-br from-purple-400 to-purple-600 rounded-lg flex items-center justify-center mb-3">
<i class="fas fa-link text-white"></i>
</div>
<h3 class="font-semibold mb-1">Create Invites</h3>
<p class="text-sm text-white/70">Share with customers</p>
</div>
<div
class="bg-white/10 backdrop-blur-xl rounded-xl p-4 border border-white/20 hover:bg-white/15 transition">
<div
class="w-10 h-10 bg-gradient-to-br from-pink-400 to-pink-600 rounded-lg flex items-center justify-center mb-3">
<i class="fas fa-shield-alt text-white"></i>
</div>
<h3 class="font-semibold mb-1">Secure Access</h3>
<p class="text-sm text-white/70">Protected account</p>
</div>
<div
class="bg-white/10 backdrop-blur-xl rounded-xl p-4 border border-white/20 hover:bg-white/15 transition">
<div
class="w-10 h-10 bg-gradient-to-br from-orange-400 to-orange-600 rounded-lg flex items-center justify-center mb-3">
<i class="fas fa-chart-line text-white"></i>
</div>
<h3 class="font-semibold mb-1">Track Activity</h3>
<p class="text-sm text-white/70">Monitor engagement</p>
</div>
</div>
</div>
<!-- Right Side - Login Form -->
<div class="w-full max-w-md mx-auto">
<!-- Mobile Logo -->
<div class="lg:hidden text-center mb-8 text-white">
<div class="flex items-center justify-center space-x-3 mb-2">
<div
class="w-12 h-12 bg-white/10 backdrop-blur-xl rounded-xl flex items-center justify-center diamond-shine border border-white/20">
<i class="fas fa-gem text-2xl text-white"></i>
</div>
<h1 class="text-3xl font-bold brand-font">DS Diamonds</h1>
</div>
<p class="text-sm text-white/70">Client Portal</p>
</div>
<!-- Login Card -->
<div class="gradient-border bg-white rounded-2xl shadow-2xl p-8 relative z-20">
<?php if (!empty($error_message)): ?>
<div class="mb-6 rounded-xl bg-red-50 border-2 border-red-200 px-4 py-3 text-red-800 flex items-center"
role="alert">
<i class="fas fa-exclamation-circle mr-3 text-red-500"></i>
<span><?php echo htmlspecialchars($error_message); ?></span>
</div>
<?php endif; ?>
<div class="text-center mb-8">
<h3 class="text-3xl font-bold text-gray-800 mb-2 brand-font">Client Sign In</h3>
<p class="text-gray-600">Enter your credentials to access your portal</p>
</div>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post" novalidate
class="relative z-10">
<div class="mb-6">
<label for="userid" class="block text-sm font-semibold text-gray-700 mb-2">
<i class="fas fa-user mr-2 text-purple-600"></i>Username
</label>
<input type="text" id="userid" name="userid" required autocomplete="username"
class="input-field w-full rounded-xl border-2 border-gray-200 p-4 text-gray-800 placeholder-gray-400 focus:outline-none focus:border-purple-500 focus:ring-2 focus:ring-purple-200 relative z-20"
placeholder="Enter your username" style="pointer-events: auto;">
</div>
<div class="mb-6">
<label for="password" class="block text-sm font-semibold text-gray-700 mb-2">
<i class="fas fa-lock mr-2 text-purple-600"></i>Password
</label>
<input type="password" id="password" name="password" required autocomplete="current-password"
class="input-field w-full rounded-xl border-2 border-gray-200 p-4 text-gray-800 placeholder-gray-400 focus:outline-none focus:border-purple-500 focus:ring-2 focus:ring-purple-200 relative z-20"
placeholder="Enter your password" style="pointer-events: auto;">
</div>
<button type="submit"
class="w-full py-4 rounded-xl bg-gradient-to-r from-purple-600 via-purple-700 to-pink-600 hover:from-purple-700 hover:via-purple-800 hover:to-pink-700 transition-all duration-300 text-white font-bold text-lg shadow-lg hover:shadow-xl transform hover:scale-[1.02]">
<i class="fas fa-sign-in-alt mr-2"></i>Sign In
</button>
</form>
<!-- Divider -->
<div class="relative my-6">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-200"></div>
</div>
<div class="relative flex justify-center text-sm">
<span class="px-4 bg-white text-gray-500">or</span>
</div>
</div>
<!-- Admin Link -->
<div class="text-center">
<a href="admin_login.php"
class="inline-flex items-center text-purple-600 hover:text-purple-800 font-semibold transition group">
<i class="fas fa-crown mr-2 group-hover:text-pink-600"></i>
Administrator Login
<i class="fas fa-arrow-right ml-2 transform group-hover:translate-x-1 transition-transform"></i>
</a>
</div>
<!-- Trust Badge -->
<div class="mt-6 pt-6 border-t border-gray-100 text-center text-xs text-gray-500">
<i class="fas fa-shield-check text-green-500 mr-1"></i>
Secured with enterprise-grade encryption
</div>
</div>
<!-- Back to Landing -->
<div class="text-center mt-6">
<a href="landing.php"
class="text-white/80 hover:text-white font-semibold transition inline-flex items-center group">
<i class="fas fa-arrow-left mr-2 transform group-hover:-translate-x-1 transition-transform"></i>
Back to Home
</a>
</div>
</div>
</div>
</body>
</html>