phpldapadmin/login_form.php

98 lines
3.0 KiB
PHP
Raw Permalink Normal View History

2009-06-30 08:12:47 +00:00
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/login_form.php,v 1.18 2004/03/19 20:13:08 i18phpldapadmin Exp $
2009-06-30 08:05:37 +00:00
/*
* login_form.php
* Displays the login form for a server for users who specify
2009-06-30 08:12:47 +00:00
* 'cookie' or 'session' for their auth_type.
2009-06-30 08:05:37 +00:00
*
* Variables that come in as GET vars:
* - server_id
*/
2009-06-30 08:07:14 +00:00
require 'common.php';
2009-06-30 08:05:37 +00:00
2009-06-30 08:10:17 +00:00
$server_id = isset( $_GET['server_id'] ) ? $_GET['server_id'] : null;
if( $server_id != null ) {
2009-06-30 08:12:47 +00:00
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
2009-06-30 08:10:17 +00:00
}
2009-06-30 08:05:37 +00:00
2009-06-30 08:10:17 +00:00
$server = $servers[$server_id];
2009-06-30 08:05:37 +00:00
2009-06-30 08:12:47 +00:00
isset( $servers[ $server_id ][ 'auth_type' ] ) or pla_error( $lang['error_auth_type_config'] );
$auth_type = $servers[ $server_id ][ 'auth_type' ];
if( $auth_type != 'cookie' && $auth_type != 'session' )
pla_error( sprintf( $lang['unknown_auth_type'], htmlspecialchars( $auth_type ) ) );
2009-06-30 08:09:20 +00:00
include 'header.php'; ?>
2009-06-30 08:05:37 +00:00
<body>
<script language="javascript">
<!--
function toggle_disable_login_fields( anon_checkbox )
{
2009-06-30 08:10:17 +00:00
if( anon_checkbox.checked ) {
anon_checkbox.form.<?php echo login_attr_enabled( $server_id ) ? 'uid' : 'login_dn'; ?>.disabled = true;
2009-06-30 08:05:37 +00:00
anon_checkbox.form.login_pass.disabled = true;
} else {
2009-06-30 08:10:17 +00:00
anon_checkbox.form.<?php echo login_attr_enabled( $server_id ) ? 'uid' : 'login_dn'; ?>.disabled = false;
2009-06-30 08:05:37 +00:00
anon_checkbox.form.login_pass.disabled = false;
}
}
-->
</script>
<center>
2009-06-30 08:12:47 +00:00
<h3 class="title"><?php echo sprintf( $lang['authenticate_to_server'], $servers[$server_id]['name'] ); ?></b></h3>
2009-06-30 08:05:37 +00:00
<br />
2009-06-30 08:12:47 +00:00
<?php if( ! isset( $_SERVER['HTTPS'] ) || $_SERVER['HTTPS'] != 'on' ) { ?>
2009-06-30 08:05:37 +00:00
2009-06-30 08:07:14 +00:00
<center>
2009-06-30 08:12:47 +00:00
<span style="color:red">
<acronym title="<?php echo $lang['not_using_https']; ?>">
<?php echo $lang['warning_this_web_connection_is_unencrypted']; ?>
</acronym>
2009-06-30 08:07:14 +00:00
</span>
2009-06-30 08:12:47 +00:00
<br />
</center>
2009-06-30 08:05:37 +00:00
<?php } ?>
<br />
<form action="login.php" method="post" name="login_form">
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
2009-06-30 08:09:20 +00:00
<?php if( isset( $_GET['redirect'] ) ) { ?>
2009-06-30 08:05:37 +00:00
<input type="hidden" name="redirect" value="<?php echo rawurlencode( $_GET['redirect'] ) ?>" />
<?php } ?>
<center>
<table class="login">
<tr>
</tr>
<tr>
2009-06-30 08:12:47 +00:00
<td colspan="2"><small><label for="anonymous_bind_checkbox"><?php echo $lang['anonymous_bind']; ?></label></small> <input type="checkbox" name="anonymous_bind" onclick="toggle_disable_login_fields(this)" id="anonymous_bind_checkbox"/></td>
2009-06-30 08:05:37 +00:00
</tr>
<tr>
2009-06-30 08:12:47 +00:00
<td><small><?php
if ( login_attr_enabled( $server_id ) )
echo $lang['user_name'];
else
echo $lang['login_dn'];
?></small></td>
<td><input type="text" name="<?php echo login_attr_enabled( $server_id ) ? 'uid' : 'login_dn'; ?>" size="40" value="<?php echo login_attr_enabled( $server_id ) ? '' : $servers[$server_id]['login_dn']; ?>" /></td>
2009-06-30 08:05:37 +00:00
</tr>
<tr>
2009-06-30 08:12:47 +00:00
<td><small><?php echo $lang['password']; ?></small></td>
2009-06-30 08:05:37 +00:00
<td><input type="password" name="login_pass" size="40" value="" name="login_pass" /></td>
</tr>
<tr>
2009-06-30 08:12:47 +00:00
<td colspan="2"><center><input type="submit" name="submit" value="<?php echo $lang['authenticate']; ?>" /></center></td>
2009-06-30 08:05:37 +00:00
</tr>
</table>
</form>
</center>