<?php
# ---------------------------------------------------------------------
# rth is a requirement, test, and bugtracking system
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ------------------------------------
# Validate Login Information
#
# $RCSfile: login_validate.php,v $ $Revision: 1.1.1.1 $
# ------------------------------------

include"./api/include_api.php";

$switch_project 	= $_POST['login']['switch_project'];
$redirect_page		= $_POST['login']['page'];
$redirect_page_get	= $_POST['login']['get'];

if( isset( $_POST['uname'] ) ) {
    $username = $_POST['uname'];
} else {
    $username = '';
}

if( isset( $_POST['pword'] ) ) {
    $password = $_POST['pword'];
} else {
    $password = '';
}

auth_attempt_login($username, $password);

# save login
if( isset( $_POST['save_login'] ) ) {
	auth_set_login_cookies($username, $password);
}

# check for javascript
if( isset( $_POST['non_javascript_browser'] ) ) {
	session_set_javascript_enabled(false);
} else {
	session_set_javascript_enabled(true);
}

# if switch_project is not empty then switch project
if( !empty( $switch_project ) ) {

	include"login_switch_proj.php";

# else redirect to the appropriate page
} else {

	if( empty( $redirect_page ) ) {

		html_redirect("home_page.php");
	} else {

		html_redirect( $redirect_page."?".$redirect_page_get );
	}
}

# ------------------------------
# $Log: login_validate.php,v $
# Revision 1.1.1.1  2005/11/30 23:00:57  gth2
# importing initial version - gth
#
# ------------------------------
?>
