-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage_website.php
318 lines (266 loc) · 13.3 KB
/
manage_website.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
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<!-- Author Name: Sudipto Ghosh-->
<?php require_once('check_login.php');?>
<?php include('head.php');?>
<?php include('header.php');?>
<?php include('sidebar.php');?>
<?php
include('connect.php');
if(isset($_POST["btn_web"]))
{
extract($_POST);
$target_dir = "uploadImage/Logo/";
$website_logo = basename($_FILES["website_image"]["name"]);
if($_FILES["website_image"]["tmp_name"]!=''){
$image = $target_dir . basename($_FILES["website_image"]["name"]);
if (move_uploaded_file($_FILES["website_image"]["tmp_name"], $image)) {
@unlink("uploadImage/Logo/".$_POST['old_website_image']);
} else {
echo "Sorry, there was an error uploading your file.";
}
}
else {
$website_logo =$_POST['old_website_image'];
}
$login_logo = basename($_FILES["login_image"]["name"]);
if($_FILES["login_image"]["tmp_name"]!=''){
$image = $target_dir . basename($_FILES["login_image"]["name"]);
if (move_uploaded_file($_FILES["login_image"]["tmp_name"], $image)) {
@unlink("uploadImage/Logo/".$_POST['old_login_image']);
} else {
echo "Sorry, there was an error uploading your file.";
}
}
else {
$login_logo =$_POST['old_login_image'];
}
$invoice_logo = basename($_FILES["invoice_image"]["name"]);
if($_FILES["invoice_image"]["tmp_name"]!=''){
$image = $target_dir . basename($_FILES["invoice_image"]["name"]);
if (move_uploaded_file($_FILES["invoice_image"]["tmp_name"], $image)) {
@unlink("uploadImage/Logo/".$_POST['old_invoice_image']);
} else {
echo "Sorry, there was an error uploading your file.";
}
}
else {
$invoice_logo =$_POST['old_invoice_image'];
}
$background_login_image = basename($_FILES["back_login_image"]["name"]);
if($_FILES["back_login_image"]["tmp_name"]!=''){
$image = $target_dir . basename($_FILES["back_login_image"]["name"]);
if (move_uploaded_file($_FILES["back_login_image"]["tmp_name"], $image)) {
@unlink("uploadImage/Logo/".$_POST['old_back_login_image']);
} else {
echo "Sorry, there was an error uploading your file.";
}
}
else {
$background_login_image =$_POST['old_back_login_image'];
}
$q1="UPDATE `manage_website` SET `title`='$title',`short_title`='$short_title',`logo`='$website_logo',`footer`='$footer' ,`currency_code`= '$currency_code',`currency_symbol`= '$currency_symbol',`login_logo`='$login_logo',`invoice_logo`='$invoice_logo' , `background_login_image` = '$background_login_image'";
if ($conn->query($q1) === TRUE) {
$_SESSION['success']='Record Successfully Updated';
?>
<script type="text/javascript">
window.location = "manage_website.php";
</script>
<?php
} else {
$_SESSION['error']='Something Went Wrong';
}
?>
<script>
//window.location = "sms_config.php";
</script>
<?php
}
?>
<?php
$que="select * from manage_website";
$query=$conn->query($que);
while($row=mysqli_fetch_array($query))
{
//print_r($row);
extract($row);
$title = $row['title'];
$short_title = $row['short_title'];
$footer = $row['footer'];
$currency_code = $row['currency_code'];
$currency_symbol = $row['currency_symbol'];
$website_logo = $row['logo'];
$login_logo = $row['login_logo'];
$invoice_logo = $row['invoice_logo'];
}
?>
?>
<!-- Page wrapper -->
<div class="page-wrapper">
<!-- Bread crumb -->
<div class="row page-titles">
<div class="col-md-5 align-self-center">
<h3 class="text-primary">Website Management</h3> </div>
<div class="col-md-7 align-self-center">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0)">Home</a></li>
<li class="breadcrumb-item active">Website Management</li>
</ol>
</div>
</div>
<!-- End Bread crumb -->
<!-- Container fluid -->
<div class="container-fluid">
<!-- Start Page Content -->
<!-- /# row -->
<div class="row">
<div class="col-lg-8" style=" margin-left: 10%;">
<div class="card">
<div class="card-title">
</div>
<div class="card-body">
<div class="input-states">
<form class="form-horizontal" method="POST" enctype="multipart/form-data">
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Title</label>
<div class="col-sm-9">
<input type="text" value="<?php echo $title;?>" name="title" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Short Title</label>
<div class="col-sm-9">
<input type="text" value="<?php echo $short_title;?>" name="short_title" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Footer</label>
<div class="col-sm-9">
<textarea class="textarea_editor form-control" name="footer" rows="5" placeholder="Enter text ..." style="height:300px;"><?php echo $footer;?></textarea>
</div>
</div>
</div>
<!-- <div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Footer</label>
<div class="col-sm-9">
<input type="text" value="<?php// echo $footer;?>" name="footer" class="form-control">
</div>
</div>
</div> -->
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Currency Code</label>
<div class="col-sm-9">
<input type="text" value="<?php echo $currency_code;?>" name="currency_code" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Currency Symbol</label>
<div class="col-sm-9">
<input type="text" value="<?php echo $currency_symbol;?>" name="currency_symbol" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Website Logo</label>
<div class="col-sm-9">
<image class="profile-img" src="uploadImage/Logo/<?=$website_logo?>" style="height:35%;width:25%;">
<input type="hidden" value="<?=$website_logo?>" name="old_website_image">
<input type="file" class="form-control" name="website_image">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Invoice Logo</label>
<div class="col-sm-9">
<image class="profile-img" src="uploadImage/Logo/<?=$invoice_logo?>" style="height:35%;width:35%;">
<input type="hidden" value="<?=$invoice_logo?>" name="old_invoice_image">
<input type="file" class="form-control" name="invoice_image">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Login Page Logo</label>
<div class="col-sm-9">
<image class="profile-img" src="uploadImage/Logo/<?=$login_logo?>" style="height:35%;width:35%;">
<input type="hidden" value="<?=$login_logo?>" name="old_login_image">
<input type="file" class="form-control" name="login_image">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label">Background Image For Login Page</label>
<div class="col-sm-9">
<image class="profile-img" src="uploadImage/Logo/<?=$background_login_image?>" style="height:35%;width:35%;">
<input type="hidden" value="<?=$background_login_image?>" name="old_back_login_image">
<input type="file" class="form-control" name="back_login_image">
</div>
</div>
</div>
<button type="submit" name="btn_web" class="btn btn-primary btn-flat m-b-30 m-t-30">Update</button>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /# row -->
<!-- End PAge Content -->
<?php include('footer.php');?>
<link rel="stylesheet" href="popup_style.css">
<?php if(!empty($_SESSION['success'])) { ?>
<div class="popup popup--icon -success js_success-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Success
</h1>
<p><?php echo $_SESSION['success']; ?></p>
<p>
<button class="button button--success" data-for="js_success-popup">Close</button>
</p>
</div>
</div>
<?php unset($_SESSION["success"]);
} ?>
<?php if(!empty($_SESSION['error'])) { ?>
<div class="popup popup--icon -error js_error-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Error
</h1>
<p><?php echo $_SESSION['error']; ?></p>
<p>
<button class="button button--error" data-for="js_error-popup">Close</button>
</p>
</div>
</div>
<?php unset($_SESSION["error"]); } ?>
<script>
var addButtonTrigger = function addButtonTrigger(el) {
el.addEventListener('click', function () {
var popupEl = document.querySelector('.' + el.dataset.for);
popupEl.classList.toggle('popup--visible');
});
};
Array.from(document.querySelectorAll('button[data-for]')).
forEach(addButtonTrigger);
</script>
<script type="text/javascript">
function refresh_cls() {
setTimeout(function(){// wait for 5 secs(2)
location.reload(); // then reload the page.(3)
}, 1000);
}
</script>