phpldapadmin/htdocs/password_checker.php

78 lines
2.1 KiB
PHP
Raw Normal View History

2009-06-30 09:22:30 +00:00
<?php
2009-06-30 11:52:55 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/password_checker.php,v 1.10.2.3 2008/12/12 12:20:22 wurley Exp $
2009-06-30 09:29:51 +00:00
/**
* @package phpLDAPadmin
*/
/**
*/
2009-06-30 09:22:30 +00:00
require './common.php';
2009-06-30 11:51:50 +00:00
include HTDOCDIR.'header.php';
2009-06-30 09:22:30 +00:00
2009-06-30 11:51:50 +00:00
echo '<body>';
2009-06-30 11:52:55 +00:00
$entry = array();
2009-06-30 10:46:00 +00:00
$entry['hash'] = get_request('hash','REQUEST');
$entry['password'] = get_request('check_password','REQUEST');
$entry['action'] = get_request('action','REQUEST');
2009-06-30 11:51:50 +00:00
$entry['componentid'] = get_request('componentid','REQUEST');
2009-06-30 09:22:30 +00:00
2009-06-30 10:46:00 +00:00
if (get_request('base64','REQUEST')) {
$entry['hash'] = base64_decode($entry['hash']);
$entry['password'] = base64_decode($entry['password']);
2009-06-30 09:22:30 +00:00
}
2009-06-30 10:46:00 +00:00
$entry['enc_type'] = get_enc_type($entry['hash']);
2009-06-30 11:51:50 +00:00
echo '<div class="popup">';
2009-06-30 10:46:00 +00:00
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" />';
2009-06-30 11:51:50 +00:00
echo '<table class="forminput" width=100% border=0>';
2009-06-30 10:46:00 +00:00
echo '<tr>';
2009-06-30 11:51:50 +00:00
printf('<td class="heading">%s</td>',_('Compare'));
printf('<td><input type="%s" name="hash" id="hash" value="%s" /></td>',
2009-06-30 11:52:55 +00:00
(obfuscate_password_display($entry['enc_type']) ? 'password' : 'text'),htmlspecialchars($entry['hash']));
2009-06-30 10:46:00 +00:00
echo '</tr>';
echo '<tr>';
2009-06-30 11:51:50 +00:00
printf('<td class="heading">%s</td>',_('To'));
printf('<td><input type="password" name="check_password" value="%s" /></td>',
2009-06-30 10:46:00 +00:00
htmlspecialchars($entry['password']));
echo '</tr>';
echo '<tr>';
echo '<td>&nbsp;</td>';
echo '<td><input type="submit" value="Compare" />';
2009-06-30 09:22:30 +00:00
2009-06-30 10:46:00 +00:00
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>';
2009-06-30 11:51:50 +00:00
echo '</body>';
2009-06-30 10:46:00 +00:00
2009-06-30 11:51:50 +00:00
if ($entry['componentid']) {
2009-06-30 10:46:00 +00:00
echo '<script language="javascript">';
2009-06-30 11:51:50 +00:00
printf('var c = window.opener.document.getElementById(\'%s\');',$entry['componentid']);
2009-06-30 10:46:00 +00:00
printf('var h = document.getElementById(\'%s\');', 'hash');
echo 'if (c && h) { h.value = c.value; }';
echo '</script>';
}
?>