forked from hariharanrr01/H-COURSE
-
Notifications
You must be signed in to change notification settings - Fork 1
/
edit_profile.php
93 lines (80 loc) · 2.67 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
<?php
session_start();
if (isset($_SESSION['id']) && isset($_SESSION['fname'])) {
include "db_conn.php";
include 'User.php';
$user = getUserById($_SESSION['id'], $conn);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Edit Profile</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/style.css">
<style>
body{
background-image:url(../assets/img/bg2.gif);
background-size:cover;
width:100%;
color:#fff;
}
</style>
</head>
<body>
<?php if ($user) { ?>
<div class="d-flex justify-content-center align-items-center vh-100">
<form class="shadow w-450 p-3"
action="edit.php"
method="post"
enctype="multipart/form-data">
<h4 class="display-4 fs-1">Edit Profile</h4><br>
<!-- error -->
<!-- success -->
<?php if(isset($_GET['success'])){ ?>
<div class="alert alert-success" role="alert">
<?php echo $_GET['success']; ?>
</div>
<?php } ?>
<div class="mb-3">
<label class="form-label">Full Name</label>
<input type="text"
class="form-control"
name="fname"
value="<?php echo $user['fname']?>">
</div>
<div class="mb-3">
<label class="form-label">User name</label>
<input type="text"
class="form-control"
name="uname"
value="<?php echo $user['username']?>">
</div>
<div class="mb-3">
<label class="form-label">Profile Picture</label>
<input type="file"
class="form-control"
name="pp">
<img src="../assets/upload/<?=$user['pp']?>"
class="rounded-circle"
style="width: 70px">
<input type="text"
hidden="hidden"
name="old_pp"
value="<?=$user['pp']?>" >
</div>
<button type="submit" class="btn btn-primary">Update</button>
<a href="profile.php" class="link-secondary" style="color:#fff;">Home</a>
</form>
</div>
<?php }else{
header("Location: home.php");
exit;
} ?>
</body>
</html>
<?php }else {
header("Location: login.php");
exit;
} ?>