Repository navigation
Expand file tree
/
Copy pathfindwork.php
More file actions
292 lines (268 loc) · 13.3 KB
/
Copy pathfindwork.php
File metadata and controls
292 lines (268 loc) · 13.3 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
<?php
require_once 'includes/session_config.php';
include 'conn.php';
// Check for remember_me cookie to restore session if needed
if (!isset($_SESSION['logged_in']) && isset($_COOKIE['remember_me']) && $_COOKIE['remember_me'] === 'true') {
if (isset($_COOKIE['user_id']) && isset($_COOKIE['user_type'])) {
// Verify the user from database
$user_id = $_COOKIE['user_id'];
$sql = "SELECT * FROM users WHERE user_id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $user_id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
$user = $result->fetch_assoc();
// Restore session
$_SESSION['user_id'] = $user['user_id'];
$_SESSION['user_name'] = $user['name'];
$_SESSION['user_type'] = $user['user_type'];
$_SESSION['email'] = $user['email'];
$_SESSION['logged_in'] = true;
}
}
}
// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
header("Location: signin.php");
exit();
}
// Refresh the cookies only - REMOVED the ini_set calls that were causing errors
if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] === true) {
// Refresh the cookies for 1 day
$cookie_expiry = time() + (24 * 60 * 60); // 1 day
setcookie('user_id', $_SESSION['user_id'], $cookie_expiry, '/');
setcookie('user_type', $_SESSION['user_type'], $cookie_expiry, '/');
setcookie('remember_me', 'true', $cookie_expiry, '/');
}
$user_id = $_SESSION['user_id'];
$user_name = $_SESSION['user_name'] ?? '';
$user_type = $_SESSION['user_type'] ?? '';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Find Work - BidProHub</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
</head>
<body class="bg-gray-50 font-sans">
<!-- Navbar Section -->
<nav class="bg-gradient-to-r from-indigo-900 to-blue-900 text-white py-4 shadow-lg">
<div class="container mx-auto flex justify-between items-center px-6">
<div class="flex items-center space-x-2">
<a href="index.html" class="text-2xl font-bold">BidProHub</a>
<p class="text-sm text-indigo-200">Where Ambitions Meet Opportunities</p>
</div>
<div class="hidden md:flex space-x-8">
<a href="home_user.php" class="text-md font-light hover:text-blue-300 transition-colors duration-300">
<i class="fas fa-home mr-2"></i>Home
</a>
<a href="findwork.php" class="text-md font-light hover:text-blue-300 transition-colors duration-300">
<i class="fas fa-briefcase mr-2"></i>Find Work
</a>
<a href="About.html" class="text-md font-light hover:text-blue-300 transition-colors duration-300">
<i class="fas fa-info-circle mr-2"></i>About Us
</a>
</div>
</div>
</nav>
<!-- Hero Section with Search -->
<section class="bg-gradient-to-r from-indigo-900 to-blue-900 text-white py-16">
<div class="container mx-auto text-center px-6">
<h1 class="text-4xl font-bold mb-4">Explore Exciting Projects</h1>
<p class="text-xl mb-8">Find work that matches your skills and interests.</p>
<!-- Search Bar -->
<div class="max-w-2xl mx-auto">
<div class="flex gap-4">
<div class="flex-1 relative">
<i class="fas fa-search absolute left-4 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
<input type="text" placeholder="Search projects..."
class="w-full pl-12 pr-4 py-3 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-800">
</div>
<select class="px-4 py-3 rounded-lg bg-white text-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">All Categories</option>
<option value="web">Web Development</option>
<option value="mobile">Mobile Development</option>
<option value="design">Design</option>
<option value="marketing">Marketing</option>
</select>
</div>
</div>
</div>
</section>
<!-- Projects Listing Section -->
<section class="py-12 bg-gray-100">
<div class="container mx-auto px-6">
<div class="flex justify-between items-center mb-8">
<h2 class="text-2xl font-bold text-gray-800">Available Projects</h2>
<div class="flex gap-4">
<button class="flex items-center gap-2 px-4 py-2 bg-white rounded-lg shadow hover:shadow-md transition-shadow">
<i class="fas fa-filter text-indigo-600"></i>
<span class="text-gray-700">Filter</span>
</button>
<select class="px-4 py-2 bg-white rounded-lg shadow hover:shadow-md transition-shadow text-gray-700">
<option value="recent">Most Recent</option>
<option value="budget-high">Highest Budget</option>
<option value="budget-low">Lowest Budget</option>
</select>
</div>
</div>
<?php
include 'conn.php';
// Fetch all active projects
$sql = "SELECT id, title, description, company, budget, deadline, status, expertise, created_at,
bid_duration_days, bid_duration_hours, bid_duration_minutes
FROM projects
WHERE status = 'Open'
ORDER BY created_at DESC";
$result = $conn->query($sql);
?>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<?php
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
// Calculate if bid time is still valid
$createdAt = strtotime($row['created_at']);
$now = time();
$elapsedSeconds = $now - $createdAt;
$totalSeconds = ($row['bid_duration_days'] * 24 * 60 * 60) +
($row['bid_duration_hours'] * 60 * 60) +
($row['bid_duration_minutes'] * 60);
// Only display if bid time hasn't expired
if ($totalSeconds > $elapsedSeconds) {
?>
<div class="bg-white rounded-xl shadow-lg p-6 hover:shadow-xl transition-shadow duration-300">
<div class="flex justify-between items-start mb-4">
<h3 class="text-lg font-semibold text-gray-800"><?php echo htmlspecialchars($row['company']); ?></h3>
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">
<?php echo htmlspecialchars($row['status']); ?>
</span>
</div>
<h4 class="text-indigo-600 font-medium mb-3"><?php echo htmlspecialchars($row['title']); ?></h4>
<div class="space-y-2 mb-4">
<p class="flex items-center text-gray-600">
<i class="fas fa-indian-rupee-sign w-6"></i>
<span>₹<?php echo number_format($row['budget']); ?></span>
</p>
<p class="flex items-center text-gray-600">
<i class="fas fa-calendar w-6"></i>
<span>Deadline: <?php echo date('M d, Y', strtotime($row['deadline'])); ?></span>
</p>
<p class="flex items-center text-gray-600">
<i class="fas fa-code w-6"></i>
<span><?php echo htmlspecialchars($row['expertise']); ?></span>
</p>
<p class="flex items-center text-gray-600">
<i class="fas fa-clock w-6"></i>
<span class="countdown"
data-days="<?php echo $row['bid_duration_days']; ?>"
data-hours="<?php echo $row['bid_duration_hours']; ?>"
data-minutes="<?php echo $row['bid_duration_minutes']; ?>"
data-created="<?php echo $row['created_at']; ?>">
</span>
</p>
</div>
<div class="flex gap-2">
<button class="flex-1 bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm hover:bg-indigo-700 transition-colors duration-300">
<a href="project_details.php?id=<?php echo $row['id']; ?>" class="text-white">View Details</a>
</button>
<button class="px-4 py-2 border border-indigo-600 text-indigo-600 rounded-lg text-sm hover:bg-indigo-50 transition-colors duration-300">
<i class="far fa-bookmark"></i>
</button>
</div>
</div>
<?php
}
}
} else {
echo "<p class='text-gray-600 col-span-3 text-center'>No projects available at the moment.</p>";
}
?>
</div>
<!-- Add countdown timer script before closing body tag -->
<script>
document.querySelectorAll('.countdown').forEach(function(element) {
const createdAt = new Date(element.dataset.created).getTime();
const now = new Date().getTime();
const elapsedSeconds = Math.floor((now - createdAt) / 1000);
let days = parseInt(element.dataset.days) || 0;
let hours = parseInt(element.dataset.hours) || 0;
let minutes = parseInt(element.dataset.minutes) || 0;
let totalSeconds = (days * 24 * 60 * 60) + (hours * 60 * 60) + (minutes * 60);
totalSeconds = Math.max(0, totalSeconds - elapsedSeconds);
function updateCountdown() {
if (totalSeconds <= 0) {
element.textContent = "Bidding Closed";
return;
}
const d = Math.floor(totalSeconds / (24 * 60 * 60));
const h = Math.floor((totalSeconds % (24 * 60 * 60)) / (60 * 60));
const m = Math.floor((totalSeconds % (60 * 60)) / 60);
const s = Math.floor(totalSeconds % 60);
element.textContent = `${d}d ${h}h ${m}m ${s}s remaining`;
totalSeconds--;
}
updateCountdown();
setInterval(updateCountdown, 1000);
});
</script>
<!-- Pagination -->
<div class="mt-8 flex justify-center gap-2">
<button class="px-4 py-2 rounded-lg bg-white shadow hover:shadow-md transition-shadow text-gray-700">
<i class="fas fa-chevron-left"></i>
</button>
<button class="px-4 py-2 rounded-lg bg-indigo-600 text-white">1</button>
<button class="px-4 py-2 rounded-lg bg-white shadow hover:shadow-md transition-shadow text-gray-700">2</button>
<button class="px-4 py-2 rounded-lg bg-white shadow hover:shadow-md transition-shadow text-gray-700">3</button>
<button class="px-4 py-2 rounded-lg bg-white shadow hover:shadow-md transition-shadow text-gray-700">
<i class="fas fa-chevron-right"></i>
</button>
</div>
</div>
</section>
<!-- Enhanced Contact Section -->
<section class="py-12 bg-white">
<div class="container mx-auto px-6">
<div class="max-w-4xl mx-auto text-center">
<h3 class="text-2xl font-bold text-gray-800 mb-6">Need Help?</h3>
<div class="grid md:grid-cols-2 gap-8">
<div class="bg-gray-50 p-6 rounded-xl">
<i class="fas fa-envelope text-3xl text-indigo-600 mb-4"></i>
<h4 class="text-lg font-semibold mb-2">Email Support</h4>
<a href="mailto:bidprohub@gmail.com" class="text-indigo-600 hover:text-indigo-800 transition-colors duration-300">
bidprohub@gmail.com
</a>
</div>
<div class="bg-gray-50 p-6 rounded-xl">
<i class="fas fa-phone text-3xl text-indigo-600 mb-4"></i>
<h4 class="text-lg font-semibold mb-2">Phone Support</h4>
<a href="tel:+919380456113" class="text-indigo-600 hover:text-indigo-800 transition-colors duration-300">
+91 9380456113
</a>
</div>
</div>
</div>
</div>
</section>
<!-- Enhanced Footer -->
<footer class="bg-gradient-to-r from-indigo-900 to-blue-900 text-white py-8">
<div class="container mx-auto px-6">
<div class="text-center">
<h4 class="text-xl font-semibold mb-4">BidProHub</h4>
<p class="text-indigo-200 mb-4">Where Ambitions Meet Opportunities</p>
<div class="flex justify-center space-x-4 mb-6">
<a href="#" class="hover:text-blue-300 transition-colors duration-300"><i class="fab fa-facebook"></i></a>
<a href="#" class="hover:text-blue-300 transition-colors duration-300"><i class="fab fa-twitter"></i></a>
<a href="#" class="hover:text-blue-300 transition-colors duration-300"><i class="fab fa-linkedin"></i></a>
<a href="#" class="hover:text-blue-300 transition-colors duration-300"><i class="fab fa-instagram"></i></a>
</div>
<p class="text-sm text-indigo-200">© 2025 BidProHub. All rights reserved.</p>
</div>
</div>
</footer>
<!-- Remove the session destruction script at the bottom of the file -->
</body>
</html>