-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_profile.php
92 lines (80 loc) · 2.48 KB
/
update_profile.php
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
<?php
session_start();
if (!isset($_SESSION['email'])) {
header("Location: index.html");
exit();
}
$conn = new mysqli('localhost', 'root', '', 'donation');
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$notification = "";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$email = $_POST['email'];
$name = $_POST['name'];
$dob = $_POST['dob'];
$nic = $_POST['nic'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$password = $_POST['password'];
$sql = "UPDATE doctor SET name=?, dofbirth=?, nic=?, address=?, pnumber=?, password=? WHERE email=?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sssssss", $name, $dob, $nic, $address, $phone, $password, $email);
if ($stmt->execute()) {
$notification = "Profile updated successfully";
} else {
$notification = "Error updating profile: " . $conn->error;
}
$stmt->close();
}
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Profile Update</title>
<style>
.notification {
position: fixed;
top: 20px;
right: 20px;
background-color: #4caf50;
color: white;
padding: 15px;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
opacity: 0;
transform: translateY(-20px);
transition: opacity 0.5s, transform 0.5s;
}
.notification.show {
opacity: 1;
transform: translateY(0);
}
.notification.error {
background-color: #f44336;
}
</style>
</head>
<body>
<div id="notification" class="notification <?php echo $notification ? 'show' : ''; ?> <?php echo strpos($notification, 'Error') !== false ? 'error' : ''; ?>">
<?php echo $notification; ?>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
var notification = document.getElementById('notification');
if (notification.classList.contains('show')) {
setTimeout(function() {
notification.classList.remove('show');
}, 3000);
}
});
</script>
</body>
</html>
<?php
header("refresh:3;url=doctor_dashboard.php");
exit();
?>