<?php // defined('DS') ? null : define("DS", DIRECTORY_SEPARATOR); require_once '../../includes/initialize.php'; include '../layouts/admin_header.php'; if ($session->is_logged_in()) { redirect_to("index.php"); } //Give form's submit tag name = "submit" if (isset($_POST['submit'])) { // echo "Form submitted."; $username = trim($_POST['username']); $password = trim($_POST['password']); // Check database if username and password found in DB $found_user = User::authenicate($username, $password); // We can do some more checking here -- like subscription time and // then log them in... if ($found_user) { $session->login($found_user); log_action("Login", "{$found_user->full_name()} Logged in."); $_SESSION['username'] = $username; $_SESSION['password'] = $password; redirect_to("index.php"); } else { $error_message = "<br><br>username / password was not found in the database."; } } else { // Form has not been submitted $username = ""; $password = ""; }