forked from stanikeva/SciPortal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharticles.php
132 lines (107 loc) · 4.21 KB
/
articles.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
<!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 - Search Results</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['subject']))
{
$subject = $_GET['subject'];
$sql = "SELECT * FROM Articles WHERE subject='$subject'";
}
else if(isset($_GET['search']))
{
$sql = "SELECT * FROM Articles_search";
}
else if(isset($_GET['error']))
{
$sql = "SELECT * FROM Articles_search WHERE 1=0";
}
$result = mysqli_query($conn, $sql);
?>
<div class="space50"></div>
<center>
<?php if (mysqli_num_rows($result))
{ ?>
<h3>Results:</h3>
<?php }
else {?> <h3>No results found</h3><?php } ?>
</center>
<div class="space50"></div>
<?php
$i=0;
while($rows = mysqli_fetch_assoc($result))
{
if ($i%3==0)
{?>
<div class="valign-wrapper">
<div class="container">
<div class="row">
<?php } ?>
<div class="col-4 s12 m3">
<a href="article.php?art_id=<?php echo $rows['id']?>" class="alert-secondary">
<center>
<div class="card">
<div class="card-image ">
<img src="images/card2.png" width="100" height="100" class="responsive-img">
</div>
<br>
<div class="card-content">
<p><?php echo $rows['title']; ?></p>
<p>
<?php
$user_id=$rows['Users_id'];
$sql2 = " SELECT first_name, last_name FROM Users, Articles WHERE Users.id='$user_id'";
$result2 = mysqli_query($conn, $sql2);
$row = mysqli_fetch_assoc($result2);
echo "Author: ".$row['first_name']." ".$row['last_name'];
?>
</p>
</div>
</div>
</center>
</a>
</div>
<?php
if ($i%3==2)
{?>
</div>
</div>
</div>
<br>
<?php
}
$i++;
?>
<?php
}
?>
<div class="space"></div>
<br><br><br>
<?php include('footer.php') ?>
</body>
</html>