Example #1
0
//if the user is not logged in then redirect
if (!Session::userLoggedIn()) {
    header("Location: login.php");
    exit;
}
$token = Session::token();
$searchId = $_GET['id'];
$retrievedCourse = Database::getCoursebyID($searchId);
//if the id provided is not actually a valid course then redirect
if (!isset($retrievedCourse['id'])) {
    $message = urlencode("The course provided does not exist");
    header("Location: error.php?error={$message}");
    exit;
}
$retrievedCourse['name'];
$notes = Database::getNotesByCourse($searchId);
?>

<!doctype html>
<html>
	<head>
    	<meta charset="utf-8">
    	<title>Arizona Notes</title>
	  
	<link rel="stylesheet" type="text/css" href="css/main.css">
	<link rel="stylesheet" type="text/css" href="css/fonts.css">
	<script>
	<?php 
echo "var PHP_token = \"{$token}\";\n";
echo "var PHP_course = \"{$_GET['id']}\";\n";
?>