-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticleView.php
More file actions
66 lines (47 loc) · 2.48 KB
/
articleView.php
File metadata and controls
66 lines (47 loc) · 2.48 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<?php
session_start();
if(!isset($_SESSION['currentUser'])){
header("Location:register.php");
}
?>
<?php
include("header.php");
?>
<?php
if(isset($_GET['id'])){
$connection = mysqli_connect("localhost","root","","phpprojekcik");
if(!$connection){
echo "Panoramix ma wywar z magicznym napojem";
exit();
}
$query = "SELECT articleID,title,content,createdAt,userID,first_name,last_name,email FROM `articles` JOIN users ON articles.creatorID = users.userID WHERE articleID = {$_GET['id']}";
$res = mysqli_query($connection,$query);
if(mysqli_num_rows($res) == 1){
$row = mysqli_fetch_assoc($res);
echo "<div class='p-5 mb-4 bg-body-tertiary rounded-3'>
<div class='container-fluid py-5'>
<h1 class='display-5 fw-bold' style='text-align: center;'>| {$row['title']} |</h1><hr>
<p class='col-md-8 fs-4 content'>{$row['content']}</p>
<small class='text-muted'>Author: {$row['first_name']} {$row['last_name']}</small><br>
<small class='text-muted'>Created At: {$row['createdAt']}</small>
</div>
</div>";
}
}
?>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>