diff --git a/add_item.php b/add_item.php new file mode 100644 index 0000000..c5b2b2a --- /dev/null +++ b/add_item.php @@ -0,0 +1,109 @@ +prepare($sql); + $stmt->execute([ + ':vendor_id' => $vendor_id, + ':name' => $name, + ':description' => $description, + ':price_per_day' => $price_per_day, + ':location' => $location + ]); + header("Location: dashboard.php?item_added=true"); + exit(); + } catch (PDOException $e) { + $errors[] = "Database error: " . $e->getMessage(); + } + } +} + +?> + + + + + + Add New Item - RentEase + + + + + + + +
+
+
+
+
+

Add a New Rental Item

+
+
+ +
+ +

+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+ + + + + + diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..4aa61a3 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,105 @@ +/* Google Fonts */ +@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Lato:wght@400;700&display=swap'); + +:root { + --primary-color: #1E90FF; + --secondary-color: #007BFF; + --background-color: #F8F9FA; + --surface-color: #FFFFFF; + --text-color: #212529; + --border-radius: 0.5rem; +} + +body { + font-family: 'Lato', sans-serif; + background-color: var(--background-color); + color: var(--text-color); +} + +h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { + font-family: 'Poppins', sans-serif; + font-weight: 600; +} + +.btn-primary { + background-color: var(--primary-color); + border-color: var(--primary-color); + border-radius: var(--border-radius); + padding: 0.75rem 1.5rem; + font-weight: 500; + transition: all 0.3s ease; +} + +.btn-primary:hover { + background-color: var(--secondary-color); + border-color: var(--secondary-color); + transform: translateY(-2px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); +} + +.navbar-brand { + font-family: 'Poppins', sans-serif; + font-weight: 700; + color: var(--primary-color) !important; +} + +.hero { + background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); + color: white; + padding: 8rem 0 6rem; + text-align: center; +} + +.hero h1 { + font-size: 3.5rem; + font-weight: 700; +} + +.search-bar { + max-width: 600px; + margin: 2rem auto 0; +} + +.search-input { + height: 3.5rem; + border-radius: var(--border-radius); + border: none; +} + +.search-button { + height: 3.5rem; + border-radius: var(--border-radius); +} + +.section { + padding: 4rem 0; +} + +.section-title { + text-align: center; + margin-bottom: 3rem; + font-weight: 700; +} + +.how-it-works-icon { + font-size: 3rem; + color: var(--primary-color); +} + +.card { + border: none; + border-radius: var(--border-radius); + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); + transition: all 0.3s ease; +} + +.card:hover { + transform: translateY(-5px); + box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); +} + +footer { + background-color: var(--surface-color); + padding: 2rem 0; + border-top: 1px solid #e9ecef; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..73e5ffa --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,13 @@ +document.addEventListener('DOMContentLoaded', function() { + const searchForm = document.getElementById('locationSearchForm'); + if (searchForm) { + searchForm.addEventListener('submit', function(event) { + event.preventDefault(); + const locationInput = document.getElementById('locationInput'); + const location = locationInput.value.trim(); + if (location) { + window.location.href = `listings.php?location=${encodeURIComponent(location)}`; + } + }); + } +}); diff --git a/dashboard.php b/dashboard.php new file mode 100644 index 0000000..cef3829 --- /dev/null +++ b/dashboard.php @@ -0,0 +1,36 @@ + + + +
+
+
+
+
+

Welcome, !

+
+
+

Welcome to your RentEase dashboard.

+

Your role is:

+ + Add New Item + +

Click here to log out.

+
+
+
+
+
+ + diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..9856e38 --- /dev/null +++ b/footer.php @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..3992638 --- /dev/null +++ b/header.php @@ -0,0 +1,61 @@ + + + + + + + + RentEase - Your Neighborhood Rental Marketplace + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/index.php b/index.php index 7205f3d..5dab499 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,114 @@ - -$phpVersion = PHP_VERSION; -$now = date('Y-m-d H:i:s'); -?> - - - - - - New Style - - - - - - - - - - - - - - - - - - - - - -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

-
-
- - - + +
+
+

Your Neighborhood Rental Marketplace

+

Rent anything, from anyone, right around the corner.

+ +
+
+ + +
+
+

How It Works

+
+
+
+ +

1. Find Nearby

+

Enter your location to discover thousands of items available for rent in your area.

+
+
+
+
+ +

2. Book & Rent

+

Select your item, choose your dates, and book instantly with secure payments.

+
+
+
+
+ +

3. Enjoy & Return

+

Use your rental for as long as you need. Returning it is just as easy.

+
+
+
+
+
+ + +
+
+

Featured Items

+
+ +
+
+ Modern Chair +
+
Modern Chair
+

Furniture

+
+ $10 / day + Rent +
+
+
+
+ +
+
+ Laptop +
+
MacBook Pro
+

Electronics

+
+ $25 / day + Rent +
+
+
+
+ +
+
+ Camping Tent +
+
Camping Tent
+

Outdoors

+
+ $15 / day + Rent +
+
+
+
+ +
+
+ King Size Bed +
+
King Size Bed
+

Furniture

+
+ $30 / day + Rent +
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/item_details.php b/item_details.php new file mode 100644 index 0000000..c25dfb1 --- /dev/null +++ b/item_details.php @@ -0,0 +1,47 @@ + + +prepare("SELECT * FROM items WHERE item_id = ?"); + $stmt->execute([$_GET['id']]); + $item = $stmt->fetch(); + } catch (PDOException $e) { + error_log("Database error fetching item: " . $e->getMessage()); + // For production, you might redirect to an error page or show a generic error + header("Location: listings.php"); + exit(); + } +} + +if (!$item) { + header("Location: listings.php"); + exit(); +} +?> + +
+
+
+
+ <?php echo htmlspecialchars($item['name']); ?> +
+

+
+

+
+
+

$ / day

+ +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/listings.php b/listings.php new file mode 100644 index 0000000..2c1b19a --- /dev/null +++ b/listings.php @@ -0,0 +1,74 @@ + + +prepare("SELECT * FROM items WHERE location LIKE ? ORDER BY created_at DESC"); + $stmt->execute(["%{$location}%"]); + } else { + $stmt = $pdo->query("SELECT * FROM items ORDER BY created_at DESC"); + } + + $items = $stmt->fetchAll(); +} catch (PDOException $e) { + // For a real app, you'd log this error and show a user-friendly message + $items = []; + $db_error = "Database error: " . $e->getMessage(); +} + +?> + +
+

Listings

+ +
+
+ +
+
+ + +
+ + +
+ +
+
No items found.. Try a different search or check back later!
+
+ + +
+
+ <?php echo htmlspecialchars($item['name']); ?> +
+
+

+

...

+
+ $ / day + Rent Now +
+
+
+
+ + +
+
+ + + diff --git a/login.php b/login.php new file mode 100644 index 0000000..d7892ce --- /dev/null +++ b/login.php @@ -0,0 +1,91 @@ +prepare("SELECT * FROM users WHERE email = ?"); + $stmt->execute([$email]); + $user = $stmt->fetch(); + + if ($user && password_verify($password, $user['password'])) { + // Regenerate session ID + session_regenerate_id(true); + + // Set session variables + $_SESSION['user_id'] = $user['id']; + $_SESSION['user_name'] = $user['name']; + $_SESSION['user_role'] = $user['role']; + + // Redirect to dashboard + header("Location: dashboard.php"); + exit; + } else { + $errors[] = "Invalid email or password."; + } + } +} +?> + + +
+
+
+
+
+

Login to your Account

+
+
+ +
+ Registration successful! Please login. +
+ + +
+ +

+ +
+ +
+
+ + +
+
+ + +
+ +
+
+ +
+
+
+
+ + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..15c2b29 --- /dev/null +++ b/logout.php @@ -0,0 +1,20 @@ +prepare("SELECT id FROM users WHERE email = ?"); + $stmt->execute([$email]); + if ($stmt->fetch()) { + $errors[] = 'Email already in use'; + } + } + + if (empty($password)) { + $errors[] = 'Password is required'; + } + + if ($password !== $password_confirm) { + $errors[] = 'Passwords do not match'; + } + + if (empty($errors)) { + $role = isset($_POST['is_vendor']) && $_POST['is_vendor'] == '1' ? 'vendor' : 'user'; + $hashed_password = password_hash($password, PASSWORD_DEFAULT); + $stmt = db()->prepare("INSERT INTO users (name, email, password, role) VALUES (?, ?, ?, ?)"); + if ($stmt->execute([$name, $email, $hashed_password, $role])) { + // Redirect to login page + header("Location: login.php?registered=true"); + exit; + } else { + $errors[] = "Failed to create account. Please try again."; + } + } +} +?> + + +
+
+
+
+
+

Create an Account

+
+
+ +
+ +

+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ +
+
+
+
+ +