-
Notifications
You must be signed in to change notification settings - Fork 1
/
manage_website.php
258 lines (204 loc) · 11.1 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
<?php include('./constant/layout/head.php');?>
<?php include('./constant/layout/header.php');?>
<?php include('./constant/layout/sidebar.php');?>
<?php
//session_start();
//error_reporting(0);
include('./constant/connect1.php');
if(isset($_POST["btn_web"]))
{
extract($_POST);
$target_dir = "./assets/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("../assets/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("./assets/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("./assets/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("../assets/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'];
}
?>
<div class="page-wrapper">
<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>
<div class="container-fluid">
<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">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">Mobile No.</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">Address</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="./assets/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="./assets/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="./assets/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="./assets/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>
<?php
include('./constant/layout/footer.php');
?>