-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththreads.php
More file actions
145 lines (141 loc) Β· 5.04 KB
/
threads.php
File metadata and controls
145 lines (141 loc) Β· 5.04 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
<!-- start header -->
<?php
require "./database/database.php";
if (isset($_GET['id'])) {
$id = $_GET['id'];
$list = "SELECT * FROM `category` WHERE id = '$id'; ";
$items = mysqli_query($conn, $list);
foreach ($items as $item) {
$pageTitle = $item['heading'];
}
}
include "./components/header.php";
?>
<!-- end header -->
<!-- start main-section -->
<section class="freelance_section mt-5 mb-5">
<div id="accordion">
<div class="container-fluid">
<div class="row">
<?php
require "./database/database.php";
if (isset($_GET['id'])) {
$id = $_GET['id'];
$list = "SELECT * FROM `category` WHERE id = '$id'; ";
$items = mysqli_query($conn, $list);
foreach ($items as $item) {
echo '<div class="col-md-5 offset-md-1">
<div class="detail-box">
<div class="heading_container mb-3 mt-3">
<h2>
' . $item['heading'] . '
</h2>
</div>
<div>
<p>
' . $item['description'] . '
</p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="collapse show" id="collapseOne" aria-labelledby="headingOne" data-parent="#accordion">
<div class="img-box ml-5">
<img src="./static/images/' . $item['image'] . '" alt="" style="height: 350px;width: 350px;">
</div>
</div>
</div>';
}
}
?>
</div>
</div>
</div>
</section>
<section class="layout_padding">
<div class="container">
<div class="heading_container mb-3">
<h2>
create a thread
</h2>
</div>
<div class="container">
<?php
echo '<form method="post" action="./controller/threads.php?id=' . $_GET['id'] . '">';
?>
<div class="form-group">
<label for="text">Heading</label>
<input type="text" class="form-control" id="text" aria-describedby="emailHelp" placeholder="Enter heading" name="thread_name" required>
</div>
<div class="form-group">
<label for="exampleFormControlTextarea1">Description</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3" placeholder="Enter description" name="thread_description" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</section>
<div class="container">
<div class="heading_container mb-3">
<h2>
user threads
</h2>
</div>
<?php
if (isset($_GET['id'])) {
$id = $_GET['id'];
require "./database/database.php";
$threadList = "SELECT * FROM `thread` INNER JOIN registration on thread.register_id = registration.id Where thread.category_id = '$id'";
$threadItems = $conn->query($threadList);
if ($threadItems->num_rows > 0) {
foreach ($threadItems as $item) {
echo '<div class="container mb-3 pt-2 pb-2" style="background-color: #1cbbb4;border-radius:5px;">
<div class="row no-gutters align-items-center">
<div class="col-auto">
<img src="./static/images/user.png" alt="" height="50" width="50">
</div>
<div class="col ml-2">
<div>
' . $item['username'] . '
</div>
<div class="d-flex justify-content-between align-items-center">
<div>
' . $item['email'] . '
</div>
<div>
' . substr($item['created_at'], 0, 10) . '
</div>
</div>
</div>
</div>
<div class="container mt-2">
<a style="color:black;font-size:1.5rem;" href=" comments.php?id=' . $item['thread_id'] . '&cat=' . $item['category_id'] . ' " >
' . $item['thread_name'] . '
</a>
<div>';
if (strlen($item['thread_description']) <= 20) {
echo $item['thread_description'];
} else {
echo substr($item['thread_description'], 0, 20) . '...';
}
echo '</div></div>
</div>';
}
} else {
echo '
<div class="alert alert-dark" role="alert">
There is No Threads !!!
</div>
';
}
}
?>
</div>
</div>
<!-- end main-section -->
<!-- start Footer -->
<?php
include "./components/footer.php";
?>
<!-- end footer -->