-
Notifications
You must be signed in to change notification settings - Fork 154
/
blog-page.php
103 lines (69 loc) · 2.77 KB
/
blog-page.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
<?php
session_start();
require 'includes/dbh.inc.php';
define('TITLE',"Blog | KLiK");
if(!isset($_SESSION['userId']))
{
header("Location: login.php");
exit();
}
if(isset($_GET['id']))
{
$blogId = $_GET['id'];
}
else
{
header("Location: index.php");
exit();
}
include 'includes/HTML-head.php';
?>
</head>
<body>
<?php include 'includes/navbar.php'; ?>
<div class="container">
<div class="row">
<div class="col-sm-3">
<?php include 'includes/profile-card.php'; ?>
</div>
<div class="col-sm-9" id="user-section">
<?php
$sql = "select * from blogs, users
where blog_id = ?
and blogs.blog_by = users.idUsers";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql))
{
die('SQL error');
}
else
{
mysqli_stmt_bind_param($stmt, "s", $blogId);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_assoc($result);
}
?>
<img class="blog-cover" src="uploads/<?php echo $row['blog_img']; ?>">
<img class="blog-author" src="uploads/<?php echo $row['userImg']; ?>">
<div class="px-5">
<br><br><br>
<h1><?php echo ucwords($row['blog_title']) ?></h1>
<br><br><br>
<p class="text-justify"><?php echo $row['blog_content'] ?></p>
<div class="blog-likes pr-1 pt-5">
<h3>
<a href="includes/blog-vote.inc.php?blog=<?php echo $row['blog_id']; ?>" >
<i class="fa fa-thumbs-up fa-2x" aria-hidden="true"></i>
</a>
<?php echo $row['blog_votes']; ?>
</h3>
<br>
<p class="text-muted">Author: <?php echo ucwords($row['uidUsers']); ?></p>
</div>
</div>
</div>
</div>
</div> <!-- /container -->
<?php include 'includes/footer.php'; ?>
<?php include 'includes/HTML-footer.php'; ?>