-
Notifications
You must be signed in to change notification settings - Fork 1
/
view_profile.php
120 lines (111 loc) · 4.73 KB
/
view_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
<?php
session_start();
require 'configuration/config.php';
require 'configuration/functions.php';
if(isset($_SESSION['user'])){
?>
<html>
<head>
<title>MarketPlace <?php sitename(); ?></title>
<link rel="stylesheet" href="assets/css/profileview.css">
</head>
<body>
<div class="header">
<p class="another-title-top header-title"><?php sitename(); ?></p>
<div class="header-buttons">
<a class="header-button" href="home">
<button>home</button>
</a>
<a class="header-button" href="posts">
<button>posts</button>
</a>
<a class="header-button" href="premium">
<button>premium posts</button>
</a>
<a class="header-button" href="create">
<button>Create Post</button>
</a>
<a class="header-button" href="shop">
<button>Store</button>
</a>
<a class="header-button" href="tos">
<button>ToS</button>
</a>
<?php
$sql = "SELECT role FROM users WHERE username = '".$_SESSION['user']."'";
$result = mysqli_query($conn, $sql);
if(mysqli_num_rows($result)){
$adminbtn = mysqli_fetch_assoc($result);
$admin_button = $adminbtn['role'];
if($admin_button == "admin"){
echo '<a class="header-button" href="admin/index"><button>Admin</button></a>';
}
}
?>
</div>
<div class="top-header">
<a href="profile">
<img src="assets/img/profile/undraw_pic_profile_re_7g2h.svg" alt="" class="profile-picture">
</a>
</div>
</div>
<div class="content">
<?php
if(isset($_GET['id']) && is_numeric($_GET['id'])){
$sql = "SELECT * FROM users WHERE id = ".$_GET['id']."";
$result = mysqli_query($conn, $sql);
if(isset($result) > 0){
while($userinfo = mysqli_fetch_assoc($result)){?>
<div class="profile">
<img src="assets/img/profile/undraw_male_avatar_re_nyu5.svg" alt="" class="post-profile">
<div class="post-profile-information">
<p class="post-profile-info"><?php echo $userinfo['username']; ?></p>
<p class="post-profile-info"><?php if($userinfo['premium'] = '1'){
echo "VIP User";
}else{
echo "Non VIP User";
} ?></p>
<p class="post-profile-info"><?php echo $userinfo['role']; ?></p>
<p class="post-profile-info"><?php echo $userinfo['discord']; ?></p>
<a href="https://<?php echo $userinfo['telegram']; ?>" class="post-profile-info "><?php echo $userinfo['telegram']; ?></a>
<a href="https://<?php echo $userinfo['site']; ?>" class="post-profile-info post-profile-site"><?php echo $userinfo['site']; ?></a>
</div>
</div>
<div class="post-title-div">
<p class="posts-info-title">Posts:</p>
<a class="post-view-title"><?php
$sql = "SELECT * FROM posts WHERE `posted-user` = '".$_SESSION['user']."'";
$result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0){
$result = mysqli_query($conn, $sql);
echo mysqli_num_rows($result);
}else{
echo "0";
}?></a>
</div>
<div class="post-title-div">
<p class="posts-info-title">Status:</p>
<p class="post-view-title"><?php $sql = "SELECT status FROM users WHERE username='".$_SESSION['user']."'";
$result = mysqli_query($conn, $sql);
if(isset($result) > 0){
while($userstatus = mysqli_fetch_assoc($result)){
echo $userstatus['status'];
}
}
?></p>
</div>
</div>
<?php
}
}
}else{
header("Location: posts");
}
?>
<script src="https://kit.fontawesome.com/ba23ae2d89.js" crossorigin="anonymous"></script>
</body>
</html>
<?php
}else{
header("Location:login");
}
?>