-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
77 lines (70 loc) · 2.45 KB
/
Copy pathprofile.php
File metadata and controls
77 lines (70 loc) · 2.45 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
<?php include 'header.php';?>
<?php
include 'connect.php';
if ($_GET["usr"]) {
$sql = "SELECT * FROM `User` WHERE `userName` = '" . $_GET["usr"]. "'";
$result = mysqli_query($mysqli, $sql);
if ($result->num_rows > 0) {
$user = $result->fetch_assoc();
}
}
?>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default"> <!--User info panel-->
<div class="panel-heading">
<h2>
<?php echo htmlspecialchars($user['userName']); ?>
<small style="float:right;" class="rating">
<?php echo "Skill: " . $user['Skill']; ?>
</small>
</h2>
</div>
<div class="panel-body">
<table>
<tr>
<td id="imageslot" style="padding:15px;"></td>
<td>
<p>
<?php echo htmlspecialchars($user['bio']); ?>
</p>
</td>
</tr>
</table>
<div class="well" style="margin-bottom:0;">
<button id="edbutton" onclick="editProfile()" style="display:block">Edit</button>
<div id="edit" style="display:none">
<form action='profile_update.php' method='post'enctype='multipart/form-data'>
Skill:<br>
<input type='text' name='skill' value='<?php echo htmlspecialchars($user['Skill']);?>'>
<br>Bio:<br>
<input type='text' name='bio'value='<?php echo htmlspecialchars($user['bio']);?>'>
<br>Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<button type="submit" name="submit" value="Submit">Submit</button>
<input type="hidden" name="userName" value="<?php echo $_GET['usr']; ?>">
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$('document').ready(
function(){
if("<?php echo $user['avatar'];?>" != ""){
document.getElementById("imageslot").innerHTML = "<img style='border:1px solid black;' src='uploads/<?php echo $user['avatar']; ?>'>"
}
}
)
function editProfile(){
if('<?php echo $_SESSION['userName']?>' == '<?php echo $user['userName']?>'){
var myDiv = document.getElementById("edit");
var myButton = document.getElementById("edbutton");
myButton.style.display = 'none';
myDiv.style.display = 'block';
}
}
</script>
<?php include 'footer.php'?>