index.php 1.04 KB
Newer Older
Sorrel Harriet's avatar
Sorrel Harriet committed
1
2
3
4
5
6
7
8
9
10
11
<?php

// include the HTML for the page header
include "templates/header.html";

// include the HTML for the navigation bar
include "templates/nav.html";

// open a new MySQL database connection
require "includes/db_connect.php";

Sorrel Harriet's avatar
Sorrel Harriet committed
12
13
14
// require the helper functions script
require "includes/functions.php";

Sorrel Harriet's avatar
Sorrel Harriet committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// check if 'page' parameter is set in query string
if (isset($_GET['page'])) {
	$page = $_GET['page']; // if so, set page variable to value of 'page' parameter
} else {
	$page = 'home'; // if not, set page variable to home
}

// define a variable to store content HTML
$content = "";

// determine which view to serve based on value of $page
switch ($page) {
case 'home' :
	include 'views/home.php';
	break;
case 'albums' :
	include 'views/albums.php';
	break;
case 'album' :
	include 'views/album.php';
	break;
case 'add-track' :
Sorrel Harriet's avatar
Sorrel Harriet committed
37
	include 'views/add-track-insecure.php';
Sorrel Harriet's avatar
Sorrel Harriet committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
	break;
default :
	include 'views/404.php';
}

// close the connection to the database */
mysqli_close($link);

// output the HTML
echo $content;

//
include "templates/footer.html";

?>