File: password_checker.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 (76 lines) | stat: -rw-r--r-- 2,125 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
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/password_checker.php,v 1.10.2.1 2008/01/13 05:37:01 wurley Exp $

/**
 * @package phpLDAPadmin
 */
/**
 */

require './common.php';
include HTDOCDIR.'header.php';

echo '<body>';
$entry['hash'] = get_request('hash','REQUEST');
$entry['password'] = get_request('check_password','REQUEST');
$entry['action'] = get_request('action','REQUEST');
$entry['componentid'] = get_request('componentid','REQUEST');

if (get_request('base64','REQUEST')) {
    $entry['hash'] = base64_decode($entry['hash']);
    $entry['password'] = base64_decode($entry['password']);
}

$entry['enc_type'] = get_enc_type($entry['hash']);

echo '<div class="popup">';
printf('<h3 class="subtitle">%s</h3>',_('Password Checker Tool'));

echo '<form action="password_checker.php" method="post">';
echo '<input type="hidden" name="action" value="compare" />';

echo '<table class="forminput" width=100% border=0>';

echo '<tr>';
printf('<td class="heading">%s</td>',_('Compare'));
printf('<td><input type="%s" name="hash" id="hash" value="%s" /></td>',
	$entry['enc_type'] ? 'text' : 'password',htmlspecialchars($entry['hash']));
echo '</tr>';

echo '<tr>';
printf('<td class="heading">%s</td>',_('To'));
printf('<td><input type="password" name="check_password" value="%s" /></td>',
	htmlspecialchars($entry['password']));
echo '</tr>';

echo '<tr>';
echo '<td>&nbsp;</td>';

echo '<td><input type="submit" value="Compare" />';

if ($entry['action'] == 'compare') {
	echo '&nbsp;&nbsp;&nbsp;&nbsp;<b>';

	if (password_check($entry['hash'],$entry['password']))
		printf('<span class="good">%s</span>',_('Passwords match!'));
	else
		printf('<span class="bad">%s</span>',_('Passwords do not match!'));

	echo '</b>';
}

echo '</td>';
echo '</tr>';
echo '</table>';
echo '</form>';
echo '</div>';
echo '</body>';

if ($entry['componentid']) {
	echo '<script language="javascript">';
	printf('var c = window.opener.document.getElementById(\'%s\');',$entry['componentid']);
	printf('var h = document.getElementById(\'%s\');', 'hash');
	echo 'if (c && h) { h.value = c.value; }';
	echo '</script>';
}
?>