-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit_announcement.php
More file actions
99 lines (86 loc) · 2.58 KB
/
edit_announcement.php
File metadata and controls
99 lines (86 loc) · 2.58 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
<?php
session_start();
include 'db_connect.php';
if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != "Tutor") {
exit("Δεν έχετε άδεια να επεξεργαστείτε ανακοινώσεις.");
}
if (!isset($_GET["id"])) {
exit("Λάθος πρόσβαση στη σελίδα.");
}
$announcement_id = intval($_GET["id"]);
$stmt = $conn->prepare("SELECT id, title, message FROM announcements WHERE id = ?");
$stmt->bind_param("i", $announcement_id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows == 0) {
exit("Η ανακοίνωση δεν βρέθηκε.");
}
$row = $result->fetch_assoc();
?>
<style>
.popup-container {
width: 400px;
background: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
padding: 20px;
position: relative;
text-align: center;
}
.popup-header {
font-size: 18px;
font-weight: bold;
padding-bottom: 10px;
border-bottom: 1px solid #ddd;
}
.popup-content {
margin-top: 15px;
}
.popup-container input,
.popup-container textarea {
width: 100%;
padding: 8px;
margin: 5px 0;
border: 1px solid #ccc;
border-radius: 5px;
}
.popup-container button {
background-color: #007bff;
color: white;
padding: 10px 15px;
border: none;
cursor: pointer;
border-radius: 5px;
margin-top: 10px;
width: 100%;
}
.popup-container button:hover {
background-color: #0056b3;
}
.close {
position: absolute;
top: 10px;
right: 15px;
font-size: 20px;
cursor: pointer;
}
</style>
<div class="popup-container">
<span class="close" onclick="closeEditPopup()">×</span>
<div class="popup-header">
Επεξεργασία Ανακοίνωσης
</div>
<div class="popup-content">
<form>
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
<label for="title">Τίτλος:</label>
<input type="text" id="title" name="title"
value="<?php echo htmlspecialchars($row['title'], ENT_QUOTES, 'UTF-8'); ?>" required>
<label for="message">Περιεχόμενο:</label>
<textarea id="message" name="message" rows="5" required><?php
echo htmlspecialchars($row['message'], ENT_QUOTES, 'UTF-8');
?></textarea>
<button type="submit">Αποθήκευση Αλλαγών</button>
</form>
</div>
</div>