project completed (feel free to contribute)

This commit is contained in:
Underemployed 2024-03-29 13:21:14 +05:30
parent a834ee565c
commit 20c4cf3efe
3 changed files with 8 additions and 10 deletions

View file

@ -24,11 +24,9 @@ if(isset($_GET['id'])){
<input type="hidden" value="<?=$id?>" name='id'> <input type="hidden" value="<?=$id?>" name='id'>
<input type="text" name ="firstname" value="<?= $user['firstname'] ?>" placeholder="First Name"> <input type="text" name ="firstname" value="<?= $user['firstname'] ?>" placeholder="First Name">
<input type="text" name ="lastname" value="<?= $user['lastname'] ?>" placeholder="Last Name"> <input type="text" name ="lastname" value="<?= $user['lastname'] ?>" placeholder="Last Name">
<select name ="userrole" value = "<?= $user['is_admin'] ?>"> <select name="userrole">
<option value="0">Author</option>
<option value="0" >Author</option> <option <?= $user['is_admin'] ? 'selected' : '' ?> value="1">Admin</option>
<option value="1">Admin</option>
</select> </select>
<button type="submit" name="submit" class="btn">Update User</button> <button type="submit" name="submit" class="btn">Update User</button>
</form> </form>

View file

@ -39,7 +39,7 @@ $posts=mysqli_query($connection,$query);
<a href="category-posts.php?id=<?= $category_id ?>" class="category__button"><?=$category['title']?></a> <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> <h2 class="post__title"><a href="post.php?id=<?=$featured['id']?>"><?=$featured['title']?></a></h2>
<p class="post__body"> <p class="post__body">
<?= substr(html_entity_decode($post['body']), 0, 120) ?>... <?= substr(html_entity_decode($featured['body']), 0, 300) ?>...
</p> </p>
<div class="post__author-avatar"> <div class="post__author-avatar">
<img src="./images/<?= $author['avatar'] ?>"> <img src="./images/<?= $author['avatar'] ?>">

View file

@ -1,6 +1,5 @@
<?php <?php
require 'config/database.php'; require 'config/database.php';
if(isset($_SESSION['user-id'])) { if(isset($_SESSION['user-id'])) {
$id = filter_var($_SESSION['user-id'], FILTER_SANITIZE_NUMBER_INT); $id = filter_var($_SESSION['user-id'], FILTER_SANITIZE_NUMBER_INT);
$query = "SELECT avatar FROM users WHERE id='$id'"; $query = "SELECT avatar FROM users WHERE id='$id'";
@ -14,14 +13,15 @@ if(isset($_SESSION['user-id'])) {
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="Cache-Control" content="max-age=3600">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <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"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blog Website</title> <title>Blog Website</title>
<!-- CUSTOM STYLESHEET --> <!-- CUSTOM STYLESHEET -->
<link rel="stylesheet" href="<?= ROOT_URL ?>css/style.css"> <link rel="stylesheet" href="<?= ROOT_URL ?>css/style.css">
<!-- ICONSCOUT CDN --> <!-- ICONSCOUT CDN -->
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css"> <link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.8/css/line.css">
<!-- GOOGLE FONT(MONTSERATE) --> <!-- GOOGLE FONT(MONTSERATE) -->
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,800;1,700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,800;1,700&display=swap" rel="stylesheet">
</head> </head>