-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.php
More file actions
232 lines (215 loc) · 6.48 KB
/
edit.php
File metadata and controls
232 lines (215 loc) · 6.48 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
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
<?php
session_start();
if(!$_SESSION['user_id'])
{
header('location:/rohit');
}
$alert=NULL;
include 'config.php';
if(isset($_POST['change_profile']))
{
$pic_name="".rand(9999,9999999)."-".$_FILES['profile_img']['name']."";
$pic_tmpname=$_FILES['profile_img']['tmp_name'];
$folder="users/profile_img/";
$success=move_uploaded_file($pic_tmpname,$folder.$pic_name);
if($success)
{
mysqli_query($conn,"UPDATE users SET pic='".$pic_name."' where user_id='".$_SESSION['user_id']."'");
} else {
echo 'image updation failed!';
}
}
if(isset($_POST['update_acc']))
{
$check_email=mysqli_num_rows(mysqli_query($conn,"SELECT * FROM users WHERE email='".$_POST['email']."' and user_id!='".$_SESSION['user_id']."'"));
if($check_email==1)
{
$alert='<div class="alert alert-danger">
<strong>'.$_POST['email'].'</strong> Already Used!
</div>';
} else {
mysqli_query($conn,"UPDATE users SET name='".$_POST['name']."', email='".$_POST['email']."', bio='".$_POST['bio']."' WHERE user_id='".$_SESSION['user_id']."'");
$alert='<div class="alert alert-success">
<strong>Your Account has been Updated!</strong>
</div>';
}
}
if(isset($_POST['change_password'])){
$pass=mysqli_fetch_array(mysqli_query($conn,"SELECT password FROM users WHERE user_id='".$_SESSION['user_id']."'"));
if($_POST['c_password']==$pass[0])
{
if($_POST['n_password']==$_POST['cn_password'])
{
mysqli_query($conn,"UPDATE users SET password='".$_POST['n_password']."' WHERE user_id='".$_SESSION['user_id']."'");
$alert='<div class="alert alert-success">
<strong>Password Changed!</strong>
</div>';
} else {
$alert='<div class="alert alert-danger">
<strong>Password not Match!</strong>
</div>';
}
} else {
$alert='<div class="alert alert-danger">
<strong>Wrong Current Password!</strong>
</div>';
}
}
?>
<html>
<head>
<title>Edit Profile</title>
<!-- meta tags-->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Digital Marketing provide service to Buy and Sell your project free online with good quality and price." />
<meta name="keywords" content="project, freelance, sell, buy, script, online, earn, script, templates" />
<meta name="author" content="Rohit Chauhan" />
<!--assets-->
<link rel="stylesheet" href="assets/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="icon" href="favicon.png" sizes="16x16" type="image/png">
</head>
<body>
<?php include 'header.php'; ?>
<div style="" class="container-fluid bg-light">
<div class="container">
<h2>Account Settings</h2>
<br>
<br>
</div>
</div>
<div style="background:#efefef;" class="container-fluid">
<div class="container">
<br>
<?php echo $alert;?>
<br>
<div class="card" style="width:100%;">
<div class="card-header">
Profile Image Change
</div>
<div class="card-body p-3">
<div class="row">
<div class="col-2">
<form action="" method="post" enctype="multipart/form-data">
<h6>Change Profile Pic</h6>
</div>
<div class="col"><input type="file" class="form-control" name="profile_img"></div>
</div>
<br>
<div class="row">
<div class="col-2">
</div>
<div class="col"><input type="submit" class="btn btn-success" name="change_profile" value="CHANGE PHOTO"></div>
</form>
</div>
<br>
</div>
</div>
<br>
<div class="card" style="width:100%;">
<div class="card-header">
Personal Details
</div>
<div class="card-body p-3">
<div class="row">
<div class="col-2">
<form action="" method="post" enctype="multipart/form-data">
<h6>Username</h6>
</div>
<div class="col"><input type="text" class="form-control" value="<?php echo $users['username'] ;?>" disabled></div>
</div>
<br>
<div class="row">
<div class="col-2">
<form action="" method="post" enctype="multipart/form-data">
<h6>Account Name</h6>
</div>
<div class="col"><input type="text" class="form-control" name="name" value="<?php echo $users['name'] ;?>"></div>
</div>
<br>
<div class="row">
<div class="col-2">
<h6>Short Bio</h6>
</div>
<div class="col"><input type="text" class="form-control" name="bio" value="<?php echo $users['bio'] ;?>"></div>
</div>
<br>
<div class="row">
<div class="col-2">
<h6>Account Email</h6>
</div>
<div class="col"><input type="text" class="form-control" name="email" value="<?php echo $users['email'] ;?>"></div>
</div>
<br>
<div class="row">
<div class="col-2">
</div>
<div class="col"><input type="submit" class="btn btn-success" name="update_acc" value="UPDATE ACCOUNT"></div>
</form>
</div>
<br>
</div>
</div>
<br>
<div class="card" style="width:100%;">
<div class="card-header">
Change Password
</div>
<div class="card-body p-3">
<div class="row">
<div class="col-2">
<form action="" method="post" enctype="multipart/form-data">
<h6>Current Password</h6>
</div>
<div class="col"><input type="password" class="form-control" name="c_password" placeholder="Current Password"></div>
</div>
<br>
<div class="row">
<div class="col-2">
<h6>New Password</h6>
</div>
<div class="col"><input type="password" class="form-control" name="n_password" placeholder="New Password"></div>
</div>
<br>
<div class="row">
<div class="col-2">
<h6>Confirm New Password</h6>
</div>
<div class="col"><input type="password" class="form-control" name="cn_password" placeholder="Confirm New Password"></div>
</div>
<div class="row">
<div class="col-2">
</div>
<div class="col"><input type="submit" class="btn btn-danger" name="change_password" value="CHANGE"></div>
</div>
</form>
<br>
</div>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</div>
</div>
<!-- javascript and jqurey -->
</div>
<!-- modal -->
<!--sider-->
</body>
<!-- javascript and jqurey -->
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/jquery-1.9.1.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/bootstrap.bundle.min.js"></script>
<?php include 'footer.php'; ?>
<script>
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
</html>