-
Notifications
You must be signed in to change notification settings - Fork 0
/
random.php
122 lines (112 loc) · 5.02 KB
/
random.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
<?php
if(isset($_SESSION["USERID"])){
$UserID=$_SESSION["USERID"];
$Admin=$_SESSION["ADMIN"];
}
else
{
$UserID='';
$Admin='No';
}
?>
<html>
<head>
<meta charset="UTF-8">
<link href="phpProject9.css" rel="stylesheet" type="text/css"/>
<link href="bootstrap-3.2.0-dist/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<script src="Javascript-project.js" type="text/javascript"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link href="css/ViewArticlecss.css" rel="stylesheet" type="text/css"/>
<link href="http://fonts.googleapis.com/css?family=Corben:bold" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<title>Hobby Union - Anything Under The Sun</title>
</head>
<body>
<header>
<?php include 'header.inc.php' ?>
</header>
<main>
<nav class="md-col-3" id="mainnavbar">
<?php include 'sidenav.inc.php' ?>
</nav>
<div class='container md-col-6'><p><font size="6" face="Georgia, Arial" color="maroon">Anything Under The Sun</font></p>
<?php
require_once('/protected/config.php');
$connection = mysqli_connect(DBHOST, DBUSER, DBPASS, DBNAME);
$error = mysqli_connect_error();
if ($error != null) {
$output = "<p>Unable to connect to database</p" . $error;
exit($output);
}
require_once('/protected/config.php');
$sql="SELECT * FROM article a ,user u WHERE a.UserID=u.UserID AND Interest='Others' ORDER BY DatePosted DESC LIMIT 5;";
$result = mysqli_query($connection, $sql);
while($row= mysqli_fetch_assoc($result)){
$ArticleID=$row['ArticleID'];
$EditerUserID=$row['UserID'];
$ArticleTitle=$row['ArticleTitle'];
$ArticleContent=$row['ArticleContent'];
$Interest=$row['Interest'];
$Flag=$row['Flag'];
$DatePosted=$row['DatePosted'];
$Interes=$row['Interest'];
$ImageLocation=$row['ImgLocation'];
$ViewCount=$row['ViewCount'];
$UserName=$row['UserName'];
?>
<div class="container1">
<div id="titleArticle">
<h1 id="button">
Title:<?php echo $ArticleTitle ?>
</h1>
</div>
<div id="button">
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#<?php echo $ArticleID?>">View whole article</button>
</div>
<br>
<div id="<?php echo $ArticleID?>" class="collapse out">
<div class="container">
<div><p><button type="button" class="btn btn-primary">
<?php echo $Interest;?>
</button></p></div>
<?php if($UserID==$EditerUserID||$Admin=='Yes'){?>
<form action = "EditArticle.php" method = "post">
<input type="hidden" name="ArticleID" value="<?php echo $ArticleID?>">
<input type="submit" name="Edit" value="Edit" />
</form>
<?php }
else{
echo "";
}?>
<div>
<div class="timestamp">
<?php echo $DatePosted?>
<?php echo $UserName?>
Total View: <?php echo $ViewCount ?>
</div>
</div>
<div>
<img src=" <?php echo $ImageLocation;?>
" class="img-responsive center-block" alt="" class="thumbnail"/>
</div>
<div>
<p>
<?php echo $ArticleContent;?>
</p>
</div>
</div>
</div>
</div>
<br>
<?php
}
?>
</div>
</main>
<footer>
<?php include 'footer.inc.php' ?>
</footer>
</body>
</html>