forked from Bibhushan17/Vetinary-Shop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.php
More file actions
192 lines (167 loc) · 6.31 KB
/
settings.php
File metadata and controls
192 lines (167 loc) · 6.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
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
<!DOCTYPE html>
<?php
session_start();
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
header("Location: login.php");
exit();
}
include('nav.php');
include('db.php');
$username = $_SESSION['username'];
$query = "SELECT * FROM users WHERE username='$username'";
$result = mysqli_query($conn, $query);
if (!$result) {
die("Database query failed: " . mysqli_error($conn));
}
$userData = mysqli_fetch_assoc($result);
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['update'])) {
if ($_FILES['profile_image']['name']) {
$profileImage = $_FILES['profile_image']['name'];
$targetDirectory = "profile_images/";
$targetFile = $targetDirectory . basename($profileImage);
move_uploaded_file($_FILES['profile_image']['tmp_name'], $targetFile);
mysqli_query($conn, "UPDATE users SET profile_image='$profileImage' WHERE username='$username'");
$_SESSION['profile_image'] = $profileImage;
header("Location: settings.php");
exit();
}
}
if (isset($_POST['sendemail'])) {
echo "Send button clicked";
}
if (isset($_POST['submitupdate'])) {
$newpass = $_POST['updatepassword'];
$sssqqqlll = "UPDATE `users` SET `password` ='$newpass' WHERE username = '$username';";
if (mysqli_query($conn, $sssqqqlll)) {
echo '<script>alert("Your password has been changed")</script>';
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
}
if (isset($_POST['email']) && isset($_POST['feedback'])) {
$email = mysqli_real_escape_string($conn, $_POST['email']);
$feedback = mysqli_real_escape_string($conn, $_POST['feedback']);
$sql = "INSERT INTO feedback (email, feedback) VALUES ('$email', '$feedback')";
if (mysqli_query($conn, $sql)) {
echo "Feedback submitted successfully!";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
} else {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
echo "Please fill out the feedback form.";
}
}
mysqli_close($conn);
}
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laundry Management System - Profile Settings</title>
<style>
/* Your CSS styles here */
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: white;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}
.profile-info {
text-align: center;
}
.profile-info p {
font-size: 1.5em;
color: #333;
margin: 5px 0;
}
/* Increase font size of label */
label {
font-size: 1.2em;
}
/* Display value of label just after label */
p {
display: inline-block;
}
.formX {
background-color: #f9f9f9;
padding: 20px;
border-radius: 5px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
}
.formX h2 {
color: #333;
text-align: center;
}
/* Increase change password text size and text field area, and adjust margin-top */
.formX label[for="updatepassword"] {
font-size: 1.2em;
margin-top: 20px;
display: block;
}
.formX input[type="Password"] {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
}
/* Decrease width of update button */
.formX input[type="Submit"] {
background-color: #333;
color: white;
border: none;
padding: 10px 15px; /* Adjusted padding */
border-radius: 5px;
cursor: pointer;
}
.formX input[type="Submit"]:hover {
background-color: #555;
}
</style>
</head>
<body>
<div class="container">
<div class="profile-info">
<h1>User Profile Settings</h1>
<form method="POST" enctype="multipart/form-data">
<label>Fullname:</label>
<p style="color: black; font-size: 1.5em;"><?php echo $userData['fullname']; ?></p>
<label>Username:</label>
<p style="color: black; font-size: 1.5em;"><?php echo $userData['username']; ?></p>
<label>Email:</label>
<p style="color: black; font-size: 1.5em;"><?php echo $userData['email']; ?></p>
<label>Address:</label>
<p style="color: black; font-size: 1.5em;"><?php echo $userData['address']; ?></p>
<label>Phone Number:</label>
<p style="color: black; font-size: 1.5em;"><?php echo $userData['phone']; ?></p>
</form>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="updatepassword">Change Password:</label>
<input type="Password" name="updatepassword" required>
<input type="Submit" name="submitupdate" value="Update">
</form>
</div>
<div class="formX">
<form class="formX" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<h2>Contact Us</h2>
<label for="email">Email:</label>
<input type="email" id="email" name="email" placeholder="Enter your email address." required><br>
<label for="feedback">Feedback:</label>
<textarea id="feedback" name="feedback" placeholder="Enter your feedback or any queries." required></textarea>
<button type="submit" name="sendemail">Send</button><br><br>
<p>Call us at: +977-9842245984</p>
</form>
</div>
</div>
</body>
</html>