-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
131 lines (124 loc) · 5.31 KB
/
profile.php
File metadata and controls
131 lines (124 loc) · 5.31 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
<?php
session_start();
include("config.php");
if (!isset($_SESSION["user_id"])) {
header("Location: login.php");
exit();
}
$user_id = $_SESSION["user_id"];
$sql = "SELECT * FROM users WHERE id='$user_id'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
$user = mysqli_fetch_array($result);
} else {
echo "User not found";
}
mysqli_close($conn);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Profile - Honey E-Commerce</title>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-color: #f8f9fa;
}
/* Custom styling for the navigation bar */
.nav-link {
color: #343a40 !important;
}
/* Card Styling */
.card {
border: none;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
</style>
</head>
<body>
<!-- Navigation Bar -->
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<div class="container">
<a class="navbar-brand" href="index.php">Honey E-Commerce</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="products.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="order_history.php">My orders</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Main Container -->
<div class="container mt-5">
<header class="mb-4">
<h1 class="text-center">Your Profile</h1>
<p class="text-center text-muted">View and update your profile details</p>
</header>
<!-- Profile Update Section -->
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="card mb-4">
<div class="card-header bg-primary text-white">
<h4 class="mb-0">Update Profile</h4>
</div>
<div class="card-body">
<form action="update_profile.php" method="POST">
<div class="mb-3">
<label for="name" class="form-label">Name:</label>
<input type="text" class="form-control" id="name" name="name"
value="<?php echo htmlspecialchars($user['name']); ?>" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email:</label>
<input type="email" class="form-control" id="email" name="email"
value="<?php echo htmlspecialchars($user['email']); ?>" required>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary">Update Profile</button>
</div>
</form>
</div>
</div>
<!-- Change Password Section -->
<div class="card">
<div class="card-header bg-warning text-dark">
<h4 class="mb-0">Change Password</h4>
</div>
<div class="card-body">
<form action="change_password.php" method="POST">
<div class="mb-3">
<label for="current_password" class="form-label">Current Password:</label>
<input type="password" class="form-control" id="current_password" name="current_password" required>
</div>
<div class="mb-3">
<label for="new_password" class="form-label">New Password:</label>
<input type="password" class="form-control" id="new_password" name="new_password" required>
</div>
<div class="text-center">
<button type="submit" class="btn btn-warning">Change Password</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Bootstrap JS Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>