-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess_edit_user.php
More file actions
94 lines (79 loc) · 2.35 KB
/
Copy pathprocess_edit_user.php
File metadata and controls
94 lines (79 loc) · 2.35 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit User </title>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
}
.message-container {
background-color: #fff;
border-radius: 5px;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
max-width: 400px;
margin: 20px auto;
}
.message-container img {
width: 100px;
height: auto;
margin-bottom: 20px;
}
.success-message {
color: #4CAF50;
font-weight: bold;
}
.error-message {
color: #f44336;
font-weight: bold;
}
.back-btn {
background-color: #333;
color: #fff;
padding: 8px 16px;
border: none;
border-radius: 4px;
text-decoration: none;
margin-top: 20px;
display: inline-block;
}
.back-btn:hover {
background-color: #555;
}
</style>
</head>
<body>
<div class="message-container">
<?php
require("connector.php");
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$user_id = $_POST["user_id"];
$user_name = $_POST["user_name"];
$email = $_POST["email"];
$password = $_POST["password"];
$role = $_POST["role"];
$db = new DBConnection;
$success = $db->updateUser($user_id, $user_name, $email, $password, $role);
if ($success) {
echo "<img src='aset/agree.png' alt='Success'>";
echo "<p class='success-message'>User updated successfully!</p>";
echo "<a class='back-btn' href='index.php'>Back</a>";
exit;
} else {
header("Location: index.php?update_error=true");
exit;
}
} else {
header("Location: index.php");
exit;
}
?>
</div>
</body>
</html>