/*
*
* This file is part of TWCOoR.
*
* TWCOoR is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* TWCOoR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with TWCOoR.
* If not, see http://www.gnu.org/licenses/.
*
*/
require "inc.php";
$errorMsg = "";
if ($_POST)
{
$loggedIn = $_SESSION['userId'] = doLogin($_POST['email'], $_POST['password']);
if (!$loggedIn)
$errorMsg = 'Invalid email or password';
else if (array_key_exists('thence', $_SESSION))
{
header('Location: ' . $_SESSION['thence']);
unset($_SESSION['thence']);
exit;
}
}
$user = null;
if ($loggedIn) {
$user = getUserDetails($loggedIn);
htmlHeader("Status for " . $_SESSION['alias'], 'new');
setLeftBlock($navigationTabs);
outputUserDetails($loggedIn);
} else { /* logged in */
htmlHeader("Login page", 'newLogin');
?>



