/
index.php
45 lines (37 loc) · 1.21 KB
/
index.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
<?php $root = realpath($_SERVER["DOCUMENT_ROOT"]) ?>
<!doctype html>
<html>
<head>
<?php require $root . "/includes/head.html" ?>
<link rel="stylesheet" type="text/css" href="/css/blog.css">
<title>Home - Sam Ireland</title>
</head>
<body>
<?php require $root . "/includes/header.html" ?>
<?php require $root . "/includes/nav.html" ?>
<main>
<h1>Hello.</h1>
<p>Welcome to my home on the internet.</p>
<p>I'm Sam, a developer living in Edinburgh, and this is my personal website.
It contains my blog, and anything interesting I might make or do.
</p>
<p>Have a look around!</p>
<h2>Latest News</h2>
<?php
require $root . "/params.php";
require $root . "/functions.php";
$connection = mysql_connect($hostname, $username, $password);
mysql_select_db($database);
$result = mysql_query("SELECT * FROM blogposts ORDER BY date DESC;");
display_blogpost(
mysql_result($result, 0, "title"),
mysql_result($result, 0, "date"),
mysql_result($result, 0, "body"),
4
);
mysql_close();
?>
</main>
<?php require "includes/footer.html" ?>
</body>
</html>