-
Notifications
You must be signed in to change notification settings - Fork 1
/
profile.php
104 lines (81 loc) · 3.66 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
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
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.rtl.min.css"
integrity="sha384-T5m5WERuXcjgzF8DAb7tRkByEZQGcpraRTinjpywg37AO96WoYN9+hrhDVoM6CaT" crossorigin="anonymous">
<title>Code Talk</title>
<style>
.container .details {
border: 2px solid #dee2e6 !important;
height: 100%;
padding: 15px;
background-color: var(--body-tertiary);
border-radius: 8px;
border-width: 8px;
}
#ques {
min-height: 433px;
}
</style>
</head>
<body>
<?php
include 'Partials/_dbconnect.php';
include 'Partials/_headers.php';
?>
<div class="container" id="ques">
<?php
echo '<h2 class="mt-4 mb-2"> Threads</h2>';
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
$user_id = $_SESSION['user_id'];
$sql = "SELECT * FROM `threads` WHERE thread_user_id = $user_id";
$result = mysqli_query($conn, $sql);
$noresult = true;
while ($row = mysqli_fetch_assoc($result)) {
$noresult = false;
$title = $row['thread_title'];
$desc = $row['thread_description'];
$thread_id = $row['thread_id'];
echo '<div class="details mt-2"><a class = "link-dark text-weight-bold" href="http://localhost/Code-Talk/thread.php?threadid=' . $thread_id . '">' . $title . '</a><br>' . $desc . '</div>';
}
if ($noresult) {
echo '<div class = "details mt-2"><h5>No threads found</h5></div>';
}
echo '<h2 class="mt-4 mb-2"> Comments</h2>';
$user_id = $_SESSION['user_id'];
$sql = "SELECT * FROM `comments` WHERE comment_by = $user_id";
$result = mysqli_query($conn, $sql);
$noresult = true;
while ($row = mysqli_fetch_assoc($result)) {
$noresult = false;
$content = $row['comment_content'];
$thread_id = $row['thread_id'];
echo '<div class="details "><a class = "link-dark text-weight-bold" href="http://localhost/Code-Talk/thread.php?threadid=' . $thread_id . '">See other Comments</a><br>' . $content . '</div>';
}
if ($noresult) {
echo '<div class = "details mt-2"><h5>No comments found</h5></div>';
}
}
else
{
echo '<div class = "details mt-2"><h5>Please login first.</h5></div>';
}
?>
</div>
<?php include 'Partials/_footer.php'; ?>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe"
crossorigin="anonymous"></script>
<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-zYPOMqeu1DAVkHiLqWBUTcbYfZ8osu1Nd6Z89ify25QV9guujx43ITvfi12/QExE" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-Y4oOpwW3duJdCWv5ly8SCFYWqFDsfob/3GkgExXKV4idmbt98QcxXYs9UoXAB7BZ" crossorigin="anonymous"></script>
-->
</body>
</html>