-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharticle.php
148 lines (120 loc) · 5.42 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
144
145
146
147
148
<!DOCTYPE html>
<?php
// This is the only time in which embedded PHP is necessary, and functions.php
// alone will not suffice. This is because the database needs to be queried
// inside the document, and before anything else, so that the
// page title can be set dynamically.
require_once 'functions.php';
$articleID = isset($_REQUEST['articleID']) ? ($_REQUEST['articleID']) : null;
$pageTitle = isset($_REQUEST['articleTitle']) ? ($_REQUEST['articleTitle']) : null;
$hostname='localhost';
$username='unn_w15002812';
$password='RYNUZTYA';
$dbh = new PDO("mysql:host=$hostname;dbname=unn_w15002812",$username,$password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sqlQuery = "SELECT *
FROM articles
WHERE articleID = $articleID";
$queryResult = $dbh->prepare($sqlQuery);
$queryResult->execute();
while ($rowObj = $queryResult->fetch(PDO::FETCH_OBJ)) {
$eID = $rowObj->articleID;
$eTitle = $rowObj->articleTitle;
$eSubtitle = $rowObj->articleSub;
$eCat = $rowObj->articleCat;
$eDate = $rowObj->articleDate;
$eAuthor = $rowObj->articleAuth;
$eFlavourText = $rowObj->articleFlavourText;
$eFullText = $rowObj->articleFullText;
}
?>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title> <?php echo $eTitle ?> </title>
<meta name="Charlie Biddiscombe" content="name">
<meta name="description" content="description here">
<meta name="keywords" content="keywords,here">
<meta name="theme-color" content="#cfdfd78a">
<link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="script.js" type="text/javascript"></script>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<header>
<div id="sideNav">
<form method="get" action="search.php">
<a href="javascript:void(0)" class="closebtn" onclick="hideNav()">×</a>
<input type="text" id="sideNavSearchBar" name="sideNavSearchBar" placeholder="Search..">
</form>
<a href="/soft-eng/politics"><i class="material-icons"></i> Politics</a>
<a href="/soft-eng/society"><i class="material-icons"></i> Society</a>
<a href="/soft-eng/technology"><i class="material-icons"></i> Technology</a>
<a href="/soft-eng/fashion"><i class="material-icons"></i> Fashion</a>
<a href="/soft-eng/entertainment"><i class="material-icons"></i> Entertainment</a>
<a href="/soft-eng/sport"><i class="material-icons"></i> Sport</a>
</div>
<svg onclick="showNav()" width="24px" height="24px" viewBox="0 0 48 48" style="padding-left:1.5rem;cursor:pointer;"><path d="M6 36h36v-4H6v4zm0-10h36v-4H6v4zm0-14v4h36v-4H6z"></path></svg>
<a href="index.php"<p id="title-text"><strong>Halibut</strong> News & Articles</p></a>
<form method="get" action="search.php">
<input type="text" id="headerSearchBar" name="headerSearchBar" placeholder="Search..">
<button id="headerSearchBtn" onclick="location.href = 'search.php'">button</button>
</form>
<li>
<a href="/soft-eng/politics"><ul>Politics</ul></a>
<a href="/soft-eng/society"><ul>Society</ul></a>
<a href="/soft-eng/technology"><ul>Technology</ul></a>
<a href="/soft-eng/fashion"><ul>Fashion</ul></a>
<a href="/soft-eng/entertainment"><ul>Entertainment</ul></a>
<a href="/soft-eng/sport"><ul>Sport</ul></a>
</li>
</header>
<div id="retArticleArea">
<?php
retrieveArticleSQL(); // call to the retrieve article function, place inside this div
?>
</div>
<div id="subscribe-area">
<form>
<input type="email" id="sub-email" placeholder="Email address..">
<input type="submit" id="sub-submit">
</form>
<p id="sub-text">Enter your email address to subscribe to our weekly newsletter.</p>
</div>
<footer>
<div id="footer-nav">
<li>
<ul><strong>Site Navigation</strong></ul>
<ul>Politics</ul>
<ul>Society</ul>
<ul>Technology</ul>
<ul>Fashion</ul>
<ul>Entertainment</ul>
<ul>Sport</ul>
</li>
<li>
<ul><strong>Terms of Use</strong></ul>
<ul>Terms of Service</ul>
<ul>Privacy Policy</ul>
<ul>Discussion Policy</ul>
<ul>Ad choices</ul>
</li>
<li>
<ul><strong>Get in touch</strong></ul>
<ul>Help</ul>
<ul>Contact information</ul>
<ul>Advertise with us</ul>
<ul>News syndication</ul>
</li>
<li>
<ul><strong>Careers</strong></ul>
<ul>Join Heroic Halibuts</ul>
</li>
</div>
</footer>
</body>
</html>