File: login_form.php

package info (click to toggle)
phpldapadmin 1.1.0.5-6%2Blenny2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,008 kB
  • ctags: 3,949
  • sloc: php: 17,735; xml: 1,532; sh: 388; makefile: 46
file content (86 lines) | stat: -rw-r--r-- 3,195 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.29.2.4 2008/01/13 05:37:01 wurley Exp $

/**
 * Displays the login form for a server for users who specify 'cookie' or 'session' for their auth_type.
 *
 * @package phpLDAPadmin
 * @author The phpLDAPadmin development team
 * @see login.php
 */
/**
 */

require './common.php';

if (! in_array($ldapserver->auth_type, array('cookie','session')))
	pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)));

printf('<h3 class="title">%s %s</h3>',_('Authenticate to server'),$ldapserver->name);

# Check for a secure connection
if (! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
	echo '<br />';
	echo '<center>';
	echo '<span style="color:red">';
	printf('<acronym title="%s"><b>%s: %s.</b></acronym>',
		_('You are not using \'https\'. Web browser will transmit login information in clear text.'),
		_('Warning'),_('This web connection is unencrypted'));
	echo '</span>';
	echo '</center>';
	echo '<br />';
}

# Login form.
echo '<form action="cmd.php" method="post" name="login_form">';
echo '<input type="hidden" name="cmd" value="login" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);

if (isset($_GET['redirect']))
	printf('<input type="hidden" name="redirect" value="%s" />',rawurlencode($_GET['redirect']));

echo '<center>';
echo '<table class="forminput">';

printf('<tr><td><b>%s:</b></td></tr>',
	$ldapserver->login_attr == 'dn' ? _('Login DN') : $_SESSION[APPCONFIG]->getFriendlyName($ldapserver->login_attr));

printf('<tr><td><input type="text" id="login" name="%s" size="40" value="%s" /></td></tr>',
	$ldapserver->login_attr,
	$ldapserver->login_attr == 'dn' ? $ldapserver->login_dn : '');

echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td><b>%s:</b></td></tr>',_('Password'));
echo '<tr><td><input type="password" id="password" size="40" value="" name="login_pass" /></td></tr>';
echo '<tr><td colspan=2>&nbsp;</td></tr>';

# If Anon bind allowed, then disable the form if the user choose to bind anonymously.
if ($ldapserver->isAnonBindAllowed())
	printf('<tr><td colspan="2"><small><b>%s</b></small> <input type="checkbox" name="anonymous_bind" onclick="toggle_disable_login_fields(this)" id="anonymous_bind_checkbox" /></td></tr>',
		_('Anonymous'));

printf('<tr><td colspan="2"><center><input type="submit" name="submit" value="%s" /></center></td></tr>',
	_('Authenticate'));

echo '</table>';
echo '</center>';
echo '</form>';

echo '<script type="text/javascript" language="javascript">document.getElementById(\'login\').focus()</script>';

if( $ldapserver->isAnonBindAllowed() ) { ?>
<script type="text/javascript" language="javascript">
<!--
	function toggle_disable_login_fields(anon_checkbox) {
		if (anon_checkbox.checked) {
			anon_checkbox.form.<?php echo $ldapserver->login_attr; ?>.disabled = true;
			anon_checkbox.form.login_pass.disabled = true;
		} else {
			anon_checkbox.form.<?php echo $ldapserver->login_attr; ?>.disabled = false;
			anon_checkbox.form.<?php echo $ldapserver->login_attr; ?>.focus();
			anon_checkbox.form.login_pass.disabled = false;
		}
	}
-->
</script>
<?php }