-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
172 lines (167 loc) · 7.42 KB
/
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
<?php
require('top.php');
if (!isset($_SESSION['USER_ID'])) {
?>
<script>
window.location.href = 'index.php';
</script>
<?php }
?>
<!-- Start Bradcaump area -->
<div class="ht__bradcaump__area" style="background: rgba(0, 0, 0, 0) url(images/bg/4.jpg) no-repeat scroll center center / cover ;">
<div class="ht__bradcaump__wrap">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="bradcaump__inner">
<nav class="bradcaump-inner">
<a class="breadcrumb-item" href="index.php">Home</a>
<span class="brd-separetor"><i class="zmdi zmdi-chevron-right"></i></span>
<span class="breadcrumb-item active">Profile</span>
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Bradcaump area -->
<!-- Start Contact Area -->
<section class="htc__contact__area ptb--100 bg__white">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="contact-form-wrap mt--60">
<div class="col-xs-12">
<div class="contact-title">
<h2 class="title__line--6">Profile</h2>
</div>
</div>
<div class="col-xs-12">
<form id="login-form" action="#" method="post">
<div class="single-contact-form">
<div class="contact-box name">
<input type="text" name="name" id="name" value="<?php echo $_SESSION['USER_NAME'] ?>" placeholder="Your Name*" style="width:100%">
</div>
<span class="field_error" id="name_error"></span>
</div>
<div class="contact-btn">
<button type="button" onclick="update_profile()" id="btn_submit" class="fv-btn">Update</button>
</div>
</form>
<div class="form-output login_msg">
<p class="form-messege field_error"></p>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="contact-form-wrap mt--60">
<div class="col-xs-12">
<div class="contact-title">
<h2 class="title__line--6">Change Password</h2>
</div>
</div>
<div class="col-xs-12">
<form id="frmpassword" action="#" method="post">
<div class="single-contact-form">
<label class="password_label">Current Password</label>
<div class="contact-box name">
<input type="password" name="current_password" id="current_password" style="width:100%">
</div>
<span class="field_error" id="current_password_error"></span>
</div>
<div class="single-contact-form">
<label class="password_label">New Password</label>
<div class="contact-box name">
<input type="password" name="new_password" id="new_password" style="width:100%">
</div>
<span class="field_error" id="new_password_error"></span>
</div>
<div class="single-contact-form">
<label class="password_label">Confirm New Password</label>
<div class="contact-box name">
<input type="password" name="confirm_new_password" id="confirm_new_password" style="width:100%">
</div>
<span class="field_error" id="confirm_new_password_error"></span>
</div>
<div class="contact-btn">
<button type="button" onclick="update_password()" id="btn_update_password" class="fv-btn">Update</button>
</div>
</form>
<div class="form-output login_msg">
<p class="form-messege field_error"></p>
</div>
</div>
</div>
</div>
</div>
</section>
<script>
function update_profile() {
jQuery('.field_error').html('');
var name = jQuery('#name').val();
if (name == '') {
jQuery('#name_error').html('Please enter your name');
} else {
jQuery('#btn_submit').html('Please wait..');
jQuery('#btn_submit').attr('disabled', true);
jQuery.ajax({
url: 'update_profile.php',
type: 'post',
data: {
name: name
},
success: function(result) {
jQuery('#name_error').html(result);
jQuery('#btn_submit').html('Update');
jQuery('#btn_submit').attr('disabled', false);
}
});
}
}
function update_password() {
jQuery('.field_error').html('');
var current_password = jQuery('#current_password').val();
var new_password = jQuery('#new_password').val();
var confirm_new_password = jQuery('#confirm_new_password').val();
var is_error = '';
if (current_password == '') {
jQuery('#current_password_error').html('Please enter current password');
is_error = 'yes';
}
if (new_password == '') {
jQuery('#new_password_error').html('Please enter new password');
is_error = 'yes';
}
if (confirm_new_password == '') {
jQuery('#confirm_new_password_error').html('Please enter confirm new password');
is_error = 'yes';
}
if (new_password != '' && confirm_new_password != '' && new_password != confirm_new_password) {
jQuery('#confirm_new_password_error').html('Please enter same password');
is_error = 'yes';
}
if (is_error == '') {
jQuery('#btn_update_password').html('Please wait..');
jQuery('#btn_update_password').attr('disabled', true);
jQuery.ajax({
url: 'update_password.php',
type: 'post',
data: {
current_password: current_password,
new_password: new_password
},
success: function(result) {
jQuery('#current_password_error').html(result);
jQuery('#btn_update_password').html('Update');
jQuery('#btn_update_password').attr('disabled', false);
jQuery('#frmpassword')[0].reset();
}
});
}
}
</script>
<!-- End Contact Area -->
</div>
<?php require('footer.php'); ?>