error fix
This commit is contained in:
parent
8e0baf709b
commit
78f117e7d7
6 changed files with 9 additions and 11 deletions
|
@ -8,7 +8,7 @@ if(!isset($_SESSION['user_is_admin'])){
|
|||
|
||||
if(isset($_GET['id'])){
|
||||
$id = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
|
||||
$query = "SELECT firstname,lastname FROM users WHERE id='$id'";
|
||||
$query = "SELECT firstname,lastname,is_admin FROM users WHERE id='$id'";
|
||||
$result = mysqli_query($connection, $query);
|
||||
$user = mysqli_fetch_assoc($result);
|
||||
}else{
|
||||
|
@ -24,7 +24,7 @@ if(isset($_GET['id'])){
|
|||
<input type="hidden" value="<?=$id?>" name='id'>
|
||||
<input type="text" name ="firstname" value="<?= $user['firstname'] ?>" placeholder="First Name">
|
||||
<input type="text" name ="lastname" value="<?= $user['lastname'] ?>" placeholder="Last Name">
|
||||
<select name ="userrole" >
|
||||
<select name ="userrole" value = "<?= $user['is_admin'] ?>">
|
||||
|
||||
<option value="0" >Author</option>
|
||||
<option value="1">Admin</option>
|
||||
|
|
3
blog.php
3
blog.php
|
@ -51,7 +51,7 @@ $posts=mysqli_query($connection,$query);
|
|||
<a href="<?= ROOT_URL ?>post.php?id=<?= $post['id'] ?>">
|
||||
|
||||
<p class="post__body" style="min-height: 100px;">
|
||||
<?= substr($post['body'], 0, 120) ?>...
|
||||
<?= substr(html_entity_decode($post['body']), 0, 120) ?>...
|
||||
</p>
|
||||
</a>
|
||||
|
||||
|
@ -73,7 +73,6 @@ $posts=mysqli_query($connection,$query);
|
|||
<small><?= date("M d, Y - H:i", strtotime($post['date_time'])) ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
|
|
|
@ -46,7 +46,7 @@ if(isset($_GET['id'])){
|
|||
<a href="<?= ROOT_URL ?>post.php?id=<?= $post['id'] ?>">
|
||||
|
||||
<p class="post__body" style="min-height: 100px;">
|
||||
<?= substr($post['body'], 0, 120) ?>...
|
||||
<?= substr(html_entity_decode($post['body']), 0, 120) ?>...
|
||||
</p>
|
||||
</a>
|
||||
|
||||
|
@ -68,7 +68,6 @@ if(isset($_GET['id'])){
|
|||
<small><?= date("M d, Y - H:i", strtotime($post['date_time'])) ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile ?>
|
||||
|
|
|
@ -39,7 +39,7 @@ $posts=mysqli_query($connection,$query);
|
|||
<a href="category-posts.php?id=<?= $category_id ?>" class="category__button"><?=$category['title']?></a>
|
||||
<h2 class="post__title"><a href="post.php?id=<?=$featured['id']?>"><?=$featured['title']?></a></h2>
|
||||
<p class="post__body">
|
||||
<?= substr($featured['body'],0,300) ?>...
|
||||
<?= substr(html_entity_decode($post['body']), 0, 120) ?>...
|
||||
</p>
|
||||
<div class="post__author-avatar">
|
||||
<img src="./images/<?= $author['avatar'] ?>">
|
||||
|
@ -100,7 +100,6 @@ $posts=mysqli_query($connection,$query);
|
|||
<small><?= date("M d, Y - H:i", strtotime($post['date_time'])) ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
|
|
|
@ -64,6 +64,6 @@
|
|||
|
||||
<script src="<?= ROOT_URL ?>js/main.js"></script>
|
||||
</body>
|
||||
</php>
|
||||
</html>
|
||||
|
||||
|
||||
|
|
|
@ -11,12 +11,13 @@ if(isset($_SESSION['user-id'])) {
|
|||
?>
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<php lang="en">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="Cache-Control" content="max-age=600">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>php & mysql blog app with admin panel</title>
|
||||
<title>Blog Website</title>
|
||||
<!-- CUSTOM STYLESHEET -->
|
||||
<link rel="stylesheet" href="<?= ROOT_URL ?>css/style.css">
|
||||
<!-- ICONSCOUT CDN -->
|
||||
|
|
Loading…
Reference in a new issue