<?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
#----------------------------------------------------------------------
# --------------------------------------------------
# Login Page
#
# $RCSfile: login_inc.php,v $ $Revision: 1.2 $
# --------------------------------------------------

$redirect_page 	= basename( $_SERVER['PHP_SELF'] );
$project_name	= "";
$get 			= "";

# get the query string and remove the invalid login error message
# if it is part of the query string
if( !empty($_SERVER['QUERY_STRING']) ) {

	$get = $_SERVER['QUERY_STRING'];
	$get = preg_replace("/&failed=true&error=10/", "", $get);
}

# if project_id set in the url get the project name for switching to the project
if( !empty($_GET['project_id']) ) {

	$project_name = project_get_name($_GET['project_id']);
}

if( !empty($_GET['page']) ) {

	$redirect_page = $_GET['page'];
}

# prevent getting redirected to a login_ page
if( strpos($redirect_page, 'login', 0)===0 ) {

	$redirect_page = "";
}

html_window_title();
html_print_body("login", "uname");
html_page_title(lang_get('login_page') . PAGE_TITLE);

error_report_check( $_GET );

print"<div align=center>\n";
print"<table class=width40>\n";
print"<tr>\n";
print"<td>\n";
print"<form name=login action='login_validate.php' method=post>\n";

# login variables taken from the query string
print"<input type=hidden name='login[switch_project]' value='$project_name'>\n";
print"<input type=hidden name='login[page]' value='$redirect_page'>\n";
print"<input type=hidden name='login[get]' value='$get'>\n";

# Check for Javascript
print"<noscript>\n";
print"<input type=hidden name=non_javascript_browser value=true>\n";
print"</noscript>\n";

print"<table class=inner>\n";

# Form Title
print"<tr>\n";
print"<td colspan=3 class=form-header-l>" . lang_get('login') ."</td>";
print"</tr>\n";

# User Name Text Box
print"<tr>\n";
print"<td class=form-lbl-r>". lang_get('username') ."</td>\n";
print"<td>&nbsp;</td>\n";
print"<td class=left>\n";
print"<input type=text name=uname size=15></td>\n";
print"</tr>\n";

# Password Text Box
print"<tr>\n";
print"<td class=form-lbl-r>". lang_get('password') ."</td>\n";
print"<td>&nbsp;</td>\n";
print"<td class=left>\n";
print"<input type=password name=pword size=15></td>\n";
print"</tr>\n";

# Save Login Checkbox
print"<tr>\n";
print"<td class=form-lbl-r>". lang_get('save_login') ."</td>\n";
print"<td>&nbsp;</td>\n";
print"<td class=left><input type=checkbox name=save_login></td>\n";
print"</tr>\n";

# Login Button
print"<tr>\n";
print"<td colspan=3 class=center><input type='submit' value=". lang_get('submit_btn') ."></td>\n";
print"</tr>\n";

print"</table>\n";
print"</form>\n";
print"</td>\n";
print"</tr>\n";
print"</table>\n";

# RESET PASSWORD
print"<br>\n";
print"<a href='login_reset_password_page.php'>".lang_get('forgot_password')."</a>\n";

print"</div>\n";

html_print_footer();

# ------------------------------
# $Log: login_inc.php,v $
# Revision 1.2  2006/02/24 11:38:20  gth2
# update to div - class=div-c not working in firefox - gth
#
# Revision 1.1.1.1  2005/11/30 23:00:57  gth2
# importing initial version - gth
#
# ------------------------------
?>