-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain banners.php
More file actions
161 lines (143 loc) · 6.2 KB
/
Copy pathmain banners.php
File metadata and controls
161 lines (143 loc) · 6.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="styles.css" />
<link rel="icon" href="fevicone\favicon.ico">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>page_update!Nimsara_computers</title>
<style>
body {
background-color: #282828; /* Dark background */
color: #fff; /* White text */
font-family: 'Roboto', sans-serif;
}
.container {
background-color:black; /* Slightly lighter background for content */
padding: 20px;
border-radius: 10px;
}
.form-label,
.btn {
color: #fff; /* White text for labels and buttons */
}
.btn-primary {
background-color: #007bff; /* Blue button */
border: none;
}
.btn-primary:hover {
background-color: #0069d9; /* Darker blue on hover */
}
.img-fluid {
animation: fadeInOut 3s ease-in-out infinite; /* Add fade-in/out animation */
max-width: 100%; /* Ensure images scale responsively */
height: auto; /* Maintain aspect ratio */
}
@keyframes fadeInOut {
0% {
opacity: 0.5;
}
50% {
opacity: 1;
}
100% {
opacity: 0.5;
}
}
/* Responsive Styling for Smaller Screens */
@media (max-width: 768px) {
.offset-lg-3 {
/* Remove offset for smaller screens */
offset: 0;
}
.col-lg-6 {
/* Make columns full width on smaller screens */
width: 100%;
}
.img-fluid {
width: 100%; /* Images fill full width */
height: auto; /* Maintain aspect ratio */
}
}
</style>
</head>
<body>
<?php
session_start();
if (!isset($_SESSION['admin'])) {
header("Location: index.php");
exit;
}
?>
<?php include 'adminnavbar.php';?>
<div class="container">
<div class="row">
<div class="col-12">
<center> <label class="form-label fw-bold" style="font-size: 20px;">Change main banners</label>
</center>
</div>
<div class="offset-lg-3 col-12 col-lg-6">
<div class="row">
<form method="POST" action="upload_banners.php" enctype="multipart/form-data">
<div class="col-12 border border-primary rounded mb-3">
<img src="AUTOMATED FUTURE.png" class="img-fluid" id="i0" />
</div>
<div class="offset-lg-3 col-12 col-lg-6 d-grid mb-3">
<label class="form-label" for="banner1Upload">Select Image 1:</label>
<input type="file" class="form-control" name="banner1" id="banner1Upload" accept="image/*"
onchange="previewImage(this, 'i0')"/>
</div>
<button class="col-12 btn btn-primary" type="submit" name="updateBanner1">Update Image</button>
<div class="col-12 border border-primary rounded mb-3">
<img src="AUTOMATED FUTURE.png" class="img-fluid" id="i1" />
</div>
<div class="offset-lg-3 col-12 col-lg-6 d-grid mb-3">
<label class="form-label" for="banner2Upload">Select Image 2:</label>
<input type="file" class="form-control" name="banner2" id="banner2Upload" accept="image/*"
onchange="previewImage(this, 'i1')"/>
</div>
<button class="col-12 btn btn-primary" type="submit" name="updateBanner2">Update Image</button>
<div class="col-12 border border-primary rounded mb-3">
<img src="AUTOMATED FUTURE.png" class="img-fluid" id="i2" />
</div>
<div class="offset-lg-3 col-12 col-lg-6 d-grid mb-3">
<label class="form-label" for="banner3Upload">Select Image 3:</label>
<input type="file" class="form-control" name="banner3" id="banner3Upload" accept="image/*"
onchange="previewImage(this, 'i2')"/>
</div>
<button class="col-12 btn btn-primary" type="submit" name="updateBanner3">Update Image</button>
</form>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous">
</script>
<script>
function previewImage(input, imgId) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
document.getElementById(imgId).src = e.target.result;
};
reader.readAsDataURL(input.files[0]);
}
}
window.onload = function () {
const successMessage = document.querySelector("#upload_response").textContent.trim();
if (successMessage === "Banner updated successfully!") {
setTimeout(() => {
alert("Banner updated successfully!");
window.location.href = "admindashboard.php";
}, 1000);
}
};
</script>
</body>
<?php
include 'main footer.php';
?>
</html>