<?php session_start(); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- using sessions and Oracle in a little PHP application by: Sharon Tuttle last modified: 2016-03-25 --> <head> <title> dept fun </title> <meta charset="utf-8" /> <?php require_once("hsu_conn_sess.php"); require_once("create_login_form.php"); require_once("create_dept_dropdown.php"); require_once("create_dept_info.php"); ?> <link href="http://users.humboldt.edu/smtuttle/styles/normalize.css" type="text/css" rel="stylesheet" /> <link href="dept-fun.css" type="text/css" rel="stylesheet" /> </head> <body> <h1> Dept Fun by [your name] </h1> <?php // when this is 1st reached -- make a login form if ((! array_key_exists("username", $_POST)) and (! array_key_exists("next_screen", $_SESSION))) { create_login_form(); $_SESSION['next_screen'] = 'choose_dept'; } // next step: dynamically create a drop-down // of departments elseif ( (array_key_exists("username", $_POST)) and ($_SESSION['next_screen'] == 'choose_dept')) { $username = strip_tags($_POST["username"]); $password = $_POST['password']; $_SESSION["username"] = $username; $_SESSION["password"] = $password; create_dept_dropdown($username, $password); $_SESSION["next_screen"] = "dept_chosen"; } // once department is chosen, show some info // about that department elseif ( (array_key_exists("dept_choice", $_POST)) and ($_SESSION["next_screen"] == "dept_chosen") ) { $dept_choice = strip_tags($_POST["dept_choice"]); $username = strip_tags($_SESSION['username']); $password = $_SESSION['password']; create_dept_info($username, $password, $dept_choice); // this happens to be the logical end of // this session session_destroy(); } // if NONE of the above were true -- make 'em log in // again else { create_login_form(); // since should not get here "normally", // we'll destroy and restart session in // this case session_destroy(); session_regenerate_id(TRUE); session_start(); $_SESSION['next_screen'] = 'choose_dept'; } require_once("328footer-better.html"); ?> </body> </html>