-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathprofile.php
More file actions
156 lines (133 loc) · 4.36 KB
/
profile.php
File metadata and controls
156 lines (133 loc) · 4.36 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
<?php
session_start();
require "./Controller/func.php";
if (!isset($_SESSION['login'])) {
session_unset();
session_destroy();
header("Location: ./login.php");
exit();
}
else{
sesschk();
}
csrfgen();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="Assets/mainstyle.css">
<title>Profile</title>
<style>
.profile_config {
display: flex;
align-items: center;
height: 800px;
justify-content: center;
}
.profile {
display: flex;
background-color: lightgray;
width: 600px;
height: 600px;
border-radius: 15px;
}
.status {
display: flex;
flex-direction: row;
}
.status_text {
margin-right: 30px;
}
.profile_text {
margin-left: 30px;
}
.username {
display: flex;
flex-direction: row;
font-size: 15px;
font-weight: bold;
margin-left: 20px;
margin-bottom: 10px;
}
.message{
display: flex;
flex-direction: row;
font-size: 12px;
margin-left: 10px;
margin-bottom: 10px;
}
.user_profile_text {
font-size: 50px;
color: aqua;
}
</style>
<script>
function main() {
var targetURL = 'main.php';
window.location.href = targetURL;
}
// function statusValidation(){
// var input = document.getElementById("status").value.trim();
// var length = input.length;
// if(length > 100){
// alert("Message can't be more than 100 characters");
// }else{
// return true;
// }
// return false;
// }
</script>
</head>
<body>
<div class="top-bar" >
<a class="bcc-txt">Binus Curcol</a>
<div class="buttons">
<button class="exit-btn" onclick="main()"> Main Page</button>
</div>
</div>
<div class="container">
<div class="box">
<div class="user_profile_text">USER PROFILE</div>
<?php
// session_start();
require "./Controller/conn.php";
$iduser = $_SESSION['user_id'];
$stmt = $conn->prepare("SELECT * FROM users WHERE id=$iduser");
$stmt->execute();
$result = $stmt->get_result();
while($row = $result->fetch_assoc()){
?>
<div class="status">
<div class="username">Full Name :</div>
<div class="username"><?php echo $row["Name"];?></div>
</div>
<div class="status">
<div class="username">Username :</div>
<div class="username"><?php echo $row["Username"];?></div>
</div>
<div class="status">
<div class="username">Email :</div>
<div class="username"><?php echo $row["Email"];?></div>
</div>
<div class="status">
<div class="username">Age :</div>
<div class="username"><?php echo $row["Age"];?></div>
</div>
<div class="status">
<div class="username">Bio :</div>
<div class="username"><?php echo $row["Bio"];?></div>
</div>
<?php
}
?>
<form action="./Controller/profile_auth.php" method="POST">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
<textarea id="status" name="status" rows="5" class="form-control" ></textarea>
<button class="btn nunito" id="button_submit" onclick="return statusValidate()">Change Status</button>
</form>
</div>
</div>
</body>
</html>