forked from stanikeva/SciPortal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
article.php
143 lines (104 loc) · 4.06 KB
/
article.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<?php session_start(); ?>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>SciPortal - Article Name</title>
<link rel="icon" type="image/x-icon" href="images/logo.png" />
<!-- Bootstrap icons-->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" rel="stylesheet" type="text/css" />
<!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css" />
<!-- Core theme CSS (includes Bootstrap)-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Latest compiled JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="js/scripts.js"></script>
<link href="css/styles.css" rel="stylesheet" />
<?php include('modals.php') ?>
</head>
<body>
<?php
include('navbarsimple.php');
$url = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
$_SESSION['url']=$url;
if (!isset($_GET['art_id']))
{?>
<div class="space100"></div>
<center><h1> 404 <br> Article is unavailable (sorry) ... :( </h1></center>
<?php }
else
{
$art_id=$_GET['art_id'];
$sql = "SELECT * FROM Articles WHERE id='$art_id'";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_assoc($result);
$user_id=$row['Users_id'];
$sql2 = " SELECT first_name, last_name FROM Users, Articles WHERE Users.id='$user_id'";
$result2 = mysqli_query($conn, $sql2);
$row2 = mysqli_fetch_assoc($result2);
$subject = $row['subject'];
$sql3 = "SELECT * FROM Users INNER JOIN Articles ON Users_id=Users.id WHERE subject='$subject' AND Articles.id!='$art_id'";
$result3 = mysqli_query($conn,$sql3);
?>
<div class="space100"></div>
<div class="container" id="layout1">
<div class="row" >
<div class="col-10" >
<div class="row">
<div class="col-md-8">
<h1><?php echo $row['title']?> </h1>
<h5><?php echo $row2['last_name']." ".$row2['first_name']?></h5>
</div>
<div class="col-md-4">
<img class="img-fluid float-right" src="images/<?php echo $row['subject']?>.jpg" width="300" height="100">
</div>
</div>
<a class="badge rounded-pill bg-dark a2" href="articles.php?subject=<?php echo $subject ?>"><?php echo $subject ?></a>
<br><br>
<p>
<?php echo $row['context'] ?>
</p>
</div>
<div class="col-2 border-start border-5 border-dark">
<center>
<main>
<h1><u>Read Next</u></h1>
</main>
<?php
$noOfRows = mysqli_num_rows($result3);
if ($noOfRows<3)
$i=$noOfRows;
else
$i=3;
for ($x = 0; $x < $i; $x++)
{
$row3 = mysqli_fetch_assoc($result3) ?>
<a href="article.php?art_id=<?php echo $row3['id'] ?>" class="alert-secondary" style="text-decoration: none">
<div class="card">
<div class="card-image">
<img src="images/card2.png" width="100" height="100" class="responsive-img img-fluid">
</div>
<div class="card-content">
<br>
<p><?php echo $row3['title']; ?></p>
<p><?php echo "Author: ".$row3['last_name']." ".$row3['first_name']; ?></p>
</div>
</div>
</a>
<?php } ?>
</center>
</div>
</div>
</div>
<?php } ?>
<br><br><br>
<?php include('footer.php') ?>
</body>
</html>