<?php //Declares variables and set their values $home='<a style="color:white; text-decoration: none;" href="index.php">Home</a> | '; $search='<a style="color:white; text-decoration: none;" href="search.php">Search</a> | '; $display_all = '<a style="color:white; text-decoration: none;" href="http://localhost:8080/x-p03291201/xsql/tvguide/search_all_channels.xsql">Display All</a> | '; $now_and_next= '<a style="color:white; text-decoration: none;" href="search_now_and_next.php">Now & Next</a> | '; $admin_login='<a style="color:white; text-decoration: none;" href="admin_login.php">Admin Login</a> | '; $logout='<a style="color:white; text-decoration: none;" href="logout.php">Logout</a> | '; $adminArea='<a style="color:white; text-decoration: none;" href="admin_area.php">Admin Area</a> | '; //Start a session and then check if session variable access is set to granted, if yes then set variable menu to 1 else set it to 0 function sessionCheck() { global $menu; session_start(); if ($_SESSION["access"] == "granted") { $menu=1; } else { $menu=0; } } //Function for displaying the menu links. If $menu equals 0 then display a link to the login page else display admin links function menuType() { global $menu, $home, $search, $display_all, $admin_login, $logout, $adminArea, $now_and_next; echo $home; echo $now_and_next; echo $search; if($menu==0) { echo $admin_login; } else { echo $adminArea; echo $logout; } }?>