global $being_included; $being_included = true; // this page can be INCLUDE'd into another page, so, for example // when a user wants to access /Scores but isn't logged in, they // are shown a login form *without* being redirected. if (!defined('FUNCTIONSPHP')) { require_once '../.lib/functions.php'; $being_included = false; } else { DB::useDB('lhsmath'); } restrict_access('X'); // Will restrict to non-logged-in: redirects logged in users back home. page_title('Log In'); if (isset($_POST['do_login'])) { process_login_form(); } else { show_login_form(''); } global $DB_DATABASE; //I don't know why we need this when in the global scope, but we do DB::useDB($DB_DATABASE); //Because it can be included from lmt pages, which uses db $LMT_DATABASE. /* * show_login_form($email) * * Shows the login page, keeping the email from the previous login attempt if specified. */ function show_login_form($email) { // Assemble the page, and send.
function process_login_form_success() { $_POST['email'] = "email"; $_POST['password'] = "******"; process_login_form(); assert($_POST['login_details']); }
* Below is your typical setup for a php page that uses the Smarty template * engine. Notice that when a php file is run by the server, it should run * all php code before any html code is run. Otherwise you end up with * header errors. Which is a pain when developing on different environment * setups. */ // Page requirements define('LOGIN_REQUIRED', false); define('PAGE_ACCESS_LEVEL', 0); define('PAGE_TYPE', 'SECURITY'); // Set for every page require 'engine/common.php'; if (isset($_POST['action']) && $_POST['action'] == "Login") { $username = $_POST['email']; $password = $_POST['password']; process_login_form($smarty); } $smarty->assign('page_name', 'Login'); // Build the page require 'global_begin.php'; $smarty->display('security/login.tpl'); require 'global_end.php'; /* * ******************************************************************************** * ******************************************************************************** * **************************L O C A L F U N C T I O N S************************** * ******************************************************************************** * ******************************************************************************** */ /* * Handle Repost