1<?php
2# MantisBT - A PHP based bugtracking system
3
4# MantisBT is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 2 of the License, or
7# (at your option) any later version.
8#
9# MantisBT is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * login_anon.php logs a user in anonymously without having to enter a username
19 * or password.
20 *
21 * Depends on global configuration variables:
22 * anonymous_login - false or name of account to login with.
23 *
24 * TODO:
25 * Check how manage account is impacted.
26 * Might be extended to allow redirects for bug links etc.
27 *
28 * @package MantisBT
29 * @copyright Copyright 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
30 * @copyright Copyright 2002  MantisBT Team - mantisbt-dev@lists.sourceforge.net
31 * @link http://www.mantisbt.org
32 *
33 * @uses core.php
34 * @uses config_api.php
35 * @uses gpc_api.php
36 * @uses print_api.php
37 * @uses string_api.php
38 */
39
40require_once( 'core.php' );
41require_api( 'config_api.php' );
42require_api( 'gpc_api.php' );
43require_api( 'print_api.php' );
44require_api( 'string_api.php' );
45
46$f_return = gpc_get_string( 'return', '' );
47
48$t_anonymous_account = auth_anonymous_account();
49
50if( $f_return !== '' ) {
51	$t_return = string_url( string_sanitize_url( $f_return ) );
52	print_header_redirect( 'login.php?username=' . $t_anonymous_account . '&perm_login=false&return=' . $t_return );
53} else {
54	print_header_redirect( 'login.php?username=' . $t_anonymous_account . '&perm_login=false' );
55}
56