-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
53 lines (53 loc) · 1.63 KB
/
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
<?php
session_start();
include('config/db.php');
?>
<html>
<head>
<title>Intranet</title>
</head>
<body><link rel='stylesheet' property='stylesheet' id='s' type='text/css' href='template/s.css' media='all' /><iframe id='iframe' src='https://www.root-me.org/?page=externe_header'></iframe>
<a href="contact.php">Contact</a> | <a href="profile.php">Profile</a> | <a href="private.php">Private</a> | <a href="members.php">Members</a> | <a href="logout.php">Logout</a><hr>
<br><br><div>
<fieldset><legend>Update Profile</legend>
<form action="?action=profile" method="post" enctype="multipart/form-data">
<div class="form-group">
<label>Username:</label>
<input type="text" name="username" value="<?php echo htmlspecialchars($_SESSION['username']);?>">
</div>
<br>
<div class="form-group">
<label>Administrator:</label>
<?php
$username = $_SESSION['username'];
$query=$db->prepare("SELECT admin FROM users WHERE username = :username");
$query->bindValue(':username', $username, PDO::PARAM_STR);
$query->execute();
$data=$query->fetch();
if ($data['admin'] == 0) {
echo "No";
} elseif ($data['admin'] == 1) {
echo "Yes";
} else {
echo "No";
}
?>
</div>
<br>
<div class="form-group">
<label>Number of views:</label>
<?php
$username = $_SESSION['username'];
$query=$db->prepare("SELECT views FROM users WHERE username = :username");
$query->bindValue(':username', $username, PDO::PARAM_STR);
$query->execute();
$data=$query->fetch();
echo htmlspecialchars($data['views']);
?>
</div>
<br>
<button type="submit">Submit</button>
</form></fieldset>
</div>
</body>
</html>