forked from bindumareedu/PhotoFlock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpages-profile.php
executable file
·370 lines (353 loc) · 19.6 KB
/
pages-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
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicon icon -->
<link rel="icon" type="image/png" sizes="16x16" href="../assets/images/favicon.png">
<title>Dashboard</title>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/dashboard-style.css" rel="stylesheet">
<!-- You can change the theme colors from here -->
<link href="css/default-dark.css" id="theme" rel="stylesheet">
<link href="css/sidebar.scss" rel="stylesheet">
<!-- Favicon -->
<link rel="icon" href="img/core-img/favicon.ico">
<!-- Core Style CSS -->
<link rel="stylesheet" href="css/core-style.css">
<link rel="stylesheet" href="style.css">
<!-- Responsive CSS -->
<link href="css/responsive.css" rel="stylesheet">
<!-- <link href="netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> -->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="fix-header card-no-border fix-sidebar">
<style>
.entry:not(:first-of-type)
{
margin-top: 10px;
}
</style>
<?php
session_start();
if (isset($_SESSION['username'])){
$username = $_SESSION['username'];
}
// if(isset($_GET['message'])){
// $msg_status = $_GET['message'];
// if($msg_status == "sent"){
// echo '<script language="javascript">';
// echo 'alert("Message successfully sent!")';
// echo '</script>';
// }
// }
?>
<!-- Gradient Background Overlay -->
<div class="gradient-background-overlay"></div>
<!-- Header Area Start -->
<header class="header-area">
<div class="container-fluid h-100">
<div class="row h-100 align-items-center">
<div class="col-12 h-100">
<div class="main-menu h-100">
<nav class="navbar h-100 navbar-expand-lg">
<!-- Logo Area -->
<a class="navbar-brand" href="#"><img src="img/core-img/logo.png" width="240px" height="100px" alt="Logo" style="margin-left: -25%;"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#studioMenu" aria-controls="studioMenu" aria-expanded="false" aria-label="Toggle navigation"><i class="fa fa-bars"></i> Menu</button>
<div class="collapse navbar-collapse" id="studioMenu">
<!-- Menu Area Start -->
<ul class="navbar-nav ml-auto">
</li>
<li class="nav-item">
<a class="nav-link" href="backend/logout.php"><i class="mdi mdi-logout"></i><span class="hide-menu">Logout</span></a>
</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
</header>
<!-- Header Area End -->
<!-- ============================================================== -->
<!-- Left Sidebar - style you can find in sidebar.scss -->
<!-- ============================================================== -->
<aside class="left-sidebar">
<!-- Sidebar scroll-->
<div class="scroll-sidebar" style="padding-top:5%;">
<!-- Sidebar navigation-->
<nav class="sidebar-nav">
<ul id="sidebarnav">
<li> <a class="waves-effect waves-dark" href="pages-profile.php" aria-expanded="false"><i class="mdi mdi-account-check"></i><span class="hide-menu">Profile</span></a></li>
<li> <a class="waves-effect waves-dark" href="dashboard.php" aria-expanded="false"><i class="mdi mdi-gauge"></i><span class="hide-menu">Dashboard</span></a></li>
<li> <a class="waves-effect waves-dark" href="photos.php" aria-expanded="false"><i class="mdi mdi-image"></i><span class="hide-menu">Photos</span></a></li>
<li> <a class="waves-effect waves-dark" href="profile-photo.php" aria-expanded="false"><i class="mdi mdi-face"></i><span class="hide-menu">Profile Photo</span></a></li>
</ul>
</nav>
<!-- End Sidebar navigation -->
</div>
<!-- End Sidebar scroll-->
</aside>
<!-- ============================================================== -->
<!-- End Left Sidebar - style you can find in sidebar.scss -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Page wrapper -->
<!-- ============================================================== -->
<div class="page-wrapper">
<!-- ============================================================== -->
<!-- Container fluid -->
<!-- ============================================================== -->
<div class="container-fluid">
<!-- ============================================================== -->
<!-- Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<div class="row page-titles">
<div class="col-md-5 align-self-center">
<h3 class="text-themecolor">Profile</h3>
</div>
</div>
<!-- ============================================================== -->
<!-- End Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Start Page Content -->
<!-- ============================================================== -->
<!-- Row -->
<div class="row">
<!-- Column -->
<div class="col-lg-8 col-xlg-9 col-md-7">
<div class="card">
<div class="card-body">
<form class="form-horizontal form-material" id="updateForm">
<input type="hidden" name="username" id="username" value="<?php echo htmlspecialchars($username);?>" >
<div class="form-group">
<label class="col-md-12">First Name</label>
<div class="col-md-12">
<input type="text" placeholder="Johnathan" class="form-control form-control-line" id="fname">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Last Name</label>
<div class="col-md-12">
<input type="text" placeholder="Doe" class="form-control form-control-line" id="lname">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Job Title</label>
<div class="col-md-12">
<input type="text" placeholder="Photographer/Web Designer/Artist" class="form-control form-control-line" id="title">
</div>
</div>
<div class="form-group">
<label class="col-md-12">About</label>
<div class="col-md-12">
<textarea rows="5" class="form-control form-control-line" placeholder="What do you want the users to know about you, your work and your accomplishments" id="about"></textarea>
</div>
</div>
<div class="multiple form-group">
<label class="col-md-12">Add Skills</label>
<div class="entry input-group col-md-12">
<input type="text" placeholder="Skill" class="form-control form-control-line" style="margin-right:5%" id="skill1">
<input type="number" min="0" max="100" step="0.1" placeholder="0-100" class="form-control form-control-line" id="perc1">
<span class="input-group-btn">
<button class="btn btn-success btn-add" type="button">
<i class="mdi mdi-plus"></i>
</button>
</span>
</div>
</div>
<div class="form-group">
<label class="col-md-12">Projects completed</label>
<div class="col-md-12">
<input type="number" min="0" step="1" placeholder="Number" class="form-control form-control-line" id="projects">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Clients</label>
<div class="col-md-12">
<input type="number" min="0" step="1" placeholder="Number" class="form-control form-control-line" id="clients">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Address</label>
<div class="col-md-12">
<input type="text" placeholder="00 St, City, State, Country" class="form-control form-control-line" id="address">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Phone No</label>
<div class="col-md-12">
<input type="text" placeholder="123 456 7890" class="form-control form-control-line" id="phone">
</div>
</div>
<div class="form-group">
<label for="example-email" class="col-md-12">Email</label>
<div class="col-md-12">
<input type="email" placeholder="[email protected]" class="form-control form-control-line" name="email" id="email">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Facebook</label>
<div class="col-md-12">
<input type="text" placeholder="www.facebook.com/johndoe" class="form-control form-control-line" id="facebook">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Instagram</label>
<div class="col-md-12">
<input type="text" placeholder="www.instagram.com/johndoe" class="form-control form-control-line" id="instagram">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Twitter</label>
<div class="col-md-12">
<input type="text" placeholder="www.twitter.com/johndoe" class="form-control form-control-line" id="twitter">
</div>
</div>
<div class="form-group">
<label class="col-md-12">Pinterest</label>
<div class="col-md-12">
<input type="text" placeholder="www.pinterest.com/johndoe" class="form-control form-control-line" id="pinterest">
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<button class="btn btn-success">Update Profile</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Column -->
</div>
<!-- Row -->
</div>
</div>
</div>
<!-- ============================================================== -->
<!-- All Jquery -->
<!-- ============================================================== -->
<script src="js/jquery/jquery-2.2.4.min.js"></script>
<!-- Bootstrap tether Core JavaScript -->
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script src="js/perfect-scrollbar.jquery.min.js"></script>
<!--Wave Effects -->
<script src="js/waves.js"></script>
<!--Menu sidebar -->
<script src="js/sidebarmenu.js"></script>
<!--Custom JavaScript -->
<script src="js/custom.min.js"></script>
<script>
$(function()
{
$(document).on('click', '.btn-add', function(e)
{
e.preventDefault();
var controlForm = $('.card-body form:first'),
multiple = $('.multiple'),
currentEntry = $(this).parents('.entry:first'),
newEntry = $(currentEntry.clone()).appendTo(multiple);
newEntry.find('input').val('');
controlForm.find('.entry:not(:last) .btn-add')
.removeClass('btn-add').addClass('btn-remove')
.removeClass('btn-success').addClass('btn-danger')
.html('<i class="mdi mdi-minus"></i>');
var set = document.getElementsByClassName("multiple")[0];
var input_num = set.childElementCount - 1;
var skill_id = "skill"+input_num;
var perc_id = "perc"+input_num;
set.lastElementChild.childNodes[1].id = skill_id;
set.lastElementChild.childNodes[3].id = perc_id;
}).on('click', '.btn-remove', function(e)
{
$(this).parents('.entry:first').remove();
e.preventDefault();
return false;
});
});
$("#updateForm").submit(function () {
// console.log("Hello");
event.preventDefault();
var username = document.getElementById("username").value;
var fname = document.getElementById("fname").value;
var lname = document.getElementById("lname").value;
var email = document.getElementById("email").value;
var facebook = document.getElementById("facebook").value;
var twitter = document.getElementById("twitter").value;
var title = document.getElementById("title").value;
var about = document.getElementById("about").value;
var instagram = document.getElementById("instagram").value;
var address = document.getElementById("address").value;
var phone = document.getElementById("phone").value;
var projects = document.getElementById("projects").value;
var clients = document.getElementById("clients").value;
var pinterest = document.getElementById("pinterest").value;
var skill_num = document.getElementsByClassName("multiple")[0].childElementCount;
var skill_arr = [];
var i;
for(i=1; i < skill_num; i++){
var id = "skill" + i;
skill_arr.push(document.getElementById(id).value);
}
var skills_jsonString = JSON.stringify(skill_arr);
var perc_arr = [];
for(i=1; i < skill_num; i++){
var id = "perc" + i;
perc_arr.push(document.getElementById(id).value);
}
var percs_jsonString = JSON.stringify(perc_arr);
document.getElementById("updateForm").reset();
// var username = document.getElementbyId("username").value();
$.ajax({
url: 'backend/profile-update.php',
type: 'GET',
data: {
username: username,
fname: fname,
lname: lname,
email: email,
facebook: facebook,
twitter: twitter,
title: title,
about: about,
instagram: instagram,
address: address,
phone: phone,
projects: projects,
clients: clients,
pinterest: pinterest,
skills: skills_jsonString,
percs: percs_jsonString
},
success: function(data) {
alert(data);
if(data == 'success'){
alert("Profile Updated!");
}else if(data == 'error'){
alert("Profile Update failed!");
}
},
error: function() {
alert('Request failed!');
}
});
});
</script>
</body>
</html>