-
Notifications
You must be signed in to change notification settings - Fork 1
/
help.php
136 lines (114 loc) · 5.27 KB
/
help.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
session_start();
include './partials/db.php';
$table="post";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CovidPort-Forum</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<!-- Custom style sheet -->
<link rel="stylesheet" href="css/forum.css?v=<?php echo time();?>">
</head>
<body>
<?php include './partials/header.php';?>
<div class="d-flex justify-content-between">
<div class="cont-1">
<div class="container main">
<p style="text-align:center;margin-bottom:20px;color:#2C2E43;">Latest In Disucssions</p>
<?php
$query="SELECT * FROM `post` WHERE `category`='discussion'";
$result=$mysqli->query($query);
while($data=$result->fetch_assoc()){
echo '<div class="container"><p style="margin-bottom:0;color:orangered;font-size:15px;">'.$data['author'].' shared </p>';
echo '<p style="margin-bottom:2px;" ><a class="link" href="post.php?id='.$data['post_id'].'">'.stripslashes($data['title']).' </a></p></div><br>';
}
?>
</div>
</div>
<div class="cont-2">
<div class="container search-bar">
<form style="margin-top:30px; " method="POST" class="d-flex">
<input type="search" name="search" class="form-control" placeholder="Search by Place" aria-label="Search">
<button class="btn btn-success search " type="submit" name="submit" >Search</button>
</form>
</div>
<div class="container in-h d-flex justify-content-center">
<a href="forum.php" class="inline-nav ">Discussion</a>
<a href="recovery-stories.php" class="inline-nav ">Recovery Stories</a>
<a href="help.php"class="inline-nav in-active">Help</a>
</div>
<div class="container">
<div class="container thread-list">
<div class="search-results">
<?php if(isset($_POST['submit']) && !empty($_POST['search'])){
$str=mysqli_real_escape_string($mysqli,$_POST['search']);
$result=$mysqli->query(" SELECT * FROM $table where (`title` like ('%$str%') OR `short-desc` like ('%$str%')) AND `category`='help'") ;
if(mysqli_num_rows($result)==0){
echo "<h5 class='container' style='padding:0px; margin:30px 0px;'>Looks Like there's not a lot of discussions , <a href='start-post.php'>start your own!</a></h5>";
$result=$mysqli -> query("SELECT * FROM $table WHERE `category`='help' ORDER BY `post_id` DESC ") or die($mysqli->error);
}
else{
echo "<h5 class='container' style='padding:0px; margin:30px 0px;'>Search Results </h5>";
}
}
else{
echo "<h5 class='container'style='padding:0px; margin:30px 0px;'>Recently added </h5>";
$result=$mysqli -> query("SELECT * FROM $table WHERE `category`='help' ORDER BY `post_id` DESC ") or die($mysqli->error);
}
if(mysqli_num_rows($result)>0){
while($data=$result->fetch_assoc()){
$queries[]=$data;
}
foreach($queries as $searchresults) : ?>
<div class="card">
<div class="card-header d-flex justify-content-between">
<div><?php echo $searchresults['author']." ". "needs help"; ?></div> <div><?php echo $searchresults['date_published'];?></div>
</div>
<div class="card-body">
<h5 class="card-title"><?php echo stripslashes($searchresults['title']);?></h5>
<p class="card-text"><?php echo stripslashes($searchresults['short-desc']);?> </p>
<div class="left">
<a href="post.php?id=<?php echo stripslashes($searchresults['post_id']);?>" class="btn btn-success click">Help Out</a>
</div>
</div>
</div>
<?php endforeach;}
else{
echo "<h5 class='container' style='padding:0px; margin:30px 0px;'>Looks Like there's not a lot of discussions , <a href='start-post.php'>start your own!</a></h5>";
}
?>
</div>
</div>
</div>
</div>
<div class="cont-3">
<div class="container main">
<p style="text-align:center;margin-bottom:20px;color:#2C2E43;">Latest In Recovery Stories</p>
<?php
$query="SELECT * FROM `post` WHERE `category`='recovery-stories'";
$result=$mysqli->query($query);
while($data=$result->fetch_assoc()){
echo '<div class="container"><p style="margin-bottom:0;color:orangered;font-size:15px;">'.$data['author'].' shared </p>';
echo '<p style="margin-bottom:2px;" ><a class="link" href="post.php?id='.$data['post_id'].'">'.stripslashes($data['title']).' </a></p></div><br>';
}
?>
</div>
</div>
</div>
<?php include './partials/footer.php'?>
</script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>