-
Notifications
You must be signed in to change notification settings - Fork 153
/
edit-profile.php
167 lines (121 loc) · 6.87 KB
/
edit-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
<?php
session_start();
require 'includes/dbh.inc.php';
define('TITLE',"Edit Profile | KLiK");
if(!isset($_SESSION['userId']))
{
header("Location: login.php");
exit();
}
include 'includes/HTML-head.php';
?>
</head>
<body>
<?php include 'includes/navbar.php'; ?>
<div class="container">
<div class="row">
<div class="col-sm-3">
<?php include 'includes/profile-card.php'; ?>
</div>
<div class="col-sm-8 text-center" id="user-section">
<img class="cover-img" id='blah-cover' src="img/user-cover.png">
<form action="includes/profileUpdate.inc.php" method='post' enctype="multipart/form-data"
style="padding: 0 30px 0 30px;">
<label class="btn btn-primary">
Change Avatar <input type="file" id="imgInp" name='dp' hidden>
</label>
<img class="profile-img" id="blah" src="#">
<?php
if ($_SESSION['userLevel'] === 1)
{
echo '<img id="admin-badge" src="img/admin-badge.png">';
}
?>
<h2><?php echo strtoupper($_SESSION['userUid']); ?></h2>
<br>
<div class="form-row">
<div class="col">
<input type="text" class="form-control" name="f-name" placeholder="First Name"
value="<?php echo $_SESSION['f_name'] ?>" >
<small id="emailHelp" class="form-text text-muted">First Name</small>
</div>
<div class="col">
<input type="text" class="form-control" name="l-name" placeholder="Last Name"
value="<?php echo $_SESSION['l_name'] ?>" >
<small id="emailHelp" class="form-text text-muted">Last Name</small>
</div>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" name="email" placeholder="email"
value="<?php echo $_SESSION['emailUsers'] ?>" >
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label >Gender</label><br>
<input id="toggle-on" class="toggle toggle-left" name="gender" value="m" type="radio"
<?php
if ($_SESSION['gender'] == 'm'){ ?>
checked="checked"
<?php } ?>>
<label for="toggle-on" class="btn-r">M</label>
<input id="toggle-off" class="toggle toggle-right" name="gender" value="f" type="radio"
<?php if ($_SESSION['gender'] == 'f'){ ?>
checked="checked"
<?php } ?>>
<label for="toggle-off" class="btn-r">F</label>
</div>
<hr>
<div class="form-group">
<label for="headline">Profile Headline</label>
<input class="form-control" type="text" id="headline" name="headline"
placeholder="Your Profile Headline" value='<?php echo $_SESSION['headline']; ?>'><br>
<label for="edit-bio">Profile Bio</label>
<textarea class="form-control" id="edit-bio" rows="10" name="bio" maxlength="5000"
placeholder="What you want to tell people about yourself"
><?php echo $_SESSION['bio']; ?></textarea>
</div>
<hr>
<div class="form-group">
<label for="old-pwd">Change Password</label>
<input type="password" class="form-control" id="old-pwd" name="old-pwd"
placeholder="Current Password">
</div>
<div class="form-row">
<div class="col">
<input type="password" class="form-control" id="exampleInputPassword1" name="pwd"
placeholder="New Password">
</div>
<div class="col">
<input type="password" class="form-control" id="exampleInputPassword1" name="pwd-repeat"
placeholder="Repeat New Password">
</div>
</div>
<br><input type="submit" class="btn btn-primary" name="update-profile" value="Update Profile">
</form>
</div>
<div class="col-sm-1">
</div>
</div>
</div> <!-- /container -->
<?php include 'includes/footer.php'; ?>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
var dp = '<?php echo $_SESSION["userImg"]; ?>';
$('#blah').attr('src', 'uploads/'+ dp);
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#blah').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imgInp").change(function() {
readURL(this);
});
</script>
</body>
</html>