Location: PHPKode > projects > ConPortal > conportal/login.php
<?php
/*
 *  ConPortal - Pomona College ITS scheduling appplication
 *  Copyright (C) 2005-2008  Pomona College, Bucknell University, University at Albany SUNY
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of version 2 of the GNU General Public License
 *  as published by the Free Software Foundation.
 *
 *  This program 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 this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
require_once('standard.php');
require_once "HTTP/Request.php";

if (!isset($_POST['user']) || !$_POST['user'] || !isset($_POST['pass'])) 
{
    // We weren't passed the necessary stuff
    header("Location: " . BASE_URL . "index.php");
    exit;
}

$info = getUserDetailsByUsername($_POST['user']);
if (!$info) {
    // User acct doesn't exist
    header("Location: " . BASE_URL . "index.php?loginfailed=1");
    exit;
}

if (!ldapAuth($_POST['user'], $_POST['pass'], DOMAIN)) {
    // Auth failed
    header("Location: " . BASE_URL . "index.php?loginfailed=2");	
    exit;
}

if (!$info['active']) {
    // User acct is disabled
    header("Location: " . BASE_URL . "index.php?acctdisabled=1");
    exit;
}

// store all the information about the user into session variables
foreach ($info as $key => $value)
     $_SESSION[$key] = $value;

// set-up the error variables
$_SESSION['error'] = false;
$_SESSION['errorArray'] = array();

// set the initial shift_shiftgroup and shift_timestamp using the current date
setShiftgroupByDate(mktime());

// At this point, we should have authenticated the user, gotten user data, and set up error variables
// If ever it's going to be safe to punch the user, it's now.  

if(isset($_POST['quickpunch']))
{
	$_SESSION['doQuickPunch'] = TRUE;
	header("Location: " . BASE_URL . "redirects/punch_in_out.php");	
}
else if (isset($_POST['page']))
    header("Location: " . BASE_URL . $_POST['page']);
else
    header("Location: " . BASE_URL . "index.php");
?> 
Return current item: ConPortal