-
Notifications
You must be signed in to change notification settings - Fork 12
/
fetch.php
80 lines (79 loc) · 2.6 KB
/
fetch.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
<html>
<?php
include ('connection.php');
include ('function.php');
$output = '';
if(isset($_POST["query"]))
{
$search = mysqli_real_escape_string($con, $_POST["query"]);
$query = "
SELECT DISTINCT * FROM posts
WHERE title LIKE '%".$search."%'";
}
$result = mysqli_query($con, $query);
$count=1;
if(mysqli_num_rows($result) > 0){
$remote =mysqli_fetch_array($result);
while($post = mysqli_fetch_array($result)){
$inform = AuthorInformation($con, $post['username']);
foreach($inform as $info){
$output = '
<article class="m-article-card post">
<div class="m-article-card__picture">
<a
href="post.php?post_link='.$post['id'].'"
class="m-article-card__picture-link"
aria-hidden="true"
tabindex="-1"
></a>
<img
class="m-article-card__picture-background"
src="'.$post['header'].'"
loading="lazy"
alt=""
onerror=this.src="../account/img/default.png"
/>
<a
href="author/profile.php?encryption_id='.$info['username'].'"
class="m-article-card__author js-tooltip"
aria-label="'.$info['author'].'"
data-tippy-content="Posted by '.$info['author'].'"
>
<div
style="background-image: url('.$info['photo'].');"
></div>
</a>
</div>
<div class="m-article-card__info">
<a href="tag/posts.php?category_id='.$post['category_id'].'" class="m-article-card__tag"
>'.getCategory($con,$post['category_id']).'</a
>
<a
href="post.php?post_link='.$post['id'].'"
class="m-article-card__info-link"
aria-label="'.$post['title'].'"
>
<div>
<h2
class="m-article-card__title js-article-card-title"
title="'.$post['title'].'"
>
'.$post['title'].'
</h2>
</div>
<div class="m-article-card__timestamp">
<span>'.TimePost($post['created_at']).'</span>
<span>•</span>
<span>'.ReadTime($post['content']).'</span>
</div>
</a>
</div>
</article>
';
$count++;
}
echo $output;
}
}
?>
</html>