本文整理汇总了PHP中auth::auth_pw方法的典型用法代码示例。如果您正苦于以下问题:PHP auth::auth_pw方法的具体用法?PHP auth::auth_pw怎么用?PHP auth::auth_pw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth
的用法示例。
在下文中一共展示了auth::auth_pw方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_dump_action
function plugin_dump_action()
{
global $vars, $auth_users, $realm;
// if (PKWK_READONLY) die_message('PKWK_READONLY prohibits this');
if (auth::check_role('readonly')) {
die_message(_("PKWK_READONLY prohibits this"));
}
$msg = PLUGIN_DUMP_ALLOW_RESTORE ? _("dump & restore") : _("dump");
$body = '';
while (auth::check_role('role_adm')) {
unset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
if (!auth::auth_pw($auth_users)) {
header('WWW-Authenticate: Basic realm="' . $realm . '"');
header('HTTP/1.0 401 Unauthorized');
$body = "<p><strong>" . _("The password is different.") . "</strong></p>\n";
return array('msg' => $msg, 'body' => $body);
}
}
// メニューを表示する必要があるか?
if (!isset($vars['menu'])) {
// 入力フォームを表示
$body = plugin_dump_disp_form();
return array('msg' => $msg, 'body' => $body);
}
$act = isset($vars['act']) ? $vars['act'] : NULL;
set_time_limit(0);
switch ($act) {
case PLUGIN_DUMP_DUMP:
$body = plugin_dump_download();
break;
case PLUGIN_DUMP_RESTORE:
$retcode = plugin_dump_upload();
$msg = $retcode['code'] == TRUE ? _("Up-loading was completed.") : _("It failed in up-loading.");
$body = $retcode['msg'];
break;
default:
// 無効な命令です。
$body = _("It is an invalid instruction.");
}
return array('msg' => $msg, 'body' => $body);
}
示例2: plugin_login_action
function plugin_login_action()
{
global $vars, $auth_type, $auth_users, $realm;
$api = empty($vars['api']) ? 'plus' : $vars['api'];
if ($api != 'plus') {
if (!exist_plugin($vars['api'])) {
return;
}
$call_api = 'plugin_' . $vars['api'] . '_jump_url';
header('Location: ' . $call_api());
die;
}
// NTLM, Negotiate 認証 (IIS 4.0/5.0)
$srv_soft = defined('SERVER_SOFTWARE') ? SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE'];
if (substr($srv_soft, 0, 9) == 'Microsoft') {
auth::auth_ntlm();
login_return_page();
}
switch ($auth_type) {
case 1:
if (!auth::auth_pw($auth_users)) {
unset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
header('HTTP/1.0 401 Unauthorized');
header('WWW-Authenticate: Basic realm="' . $realm . '"');
} else {
// FIXME
// 認証成功時は、もともとのページに戻れる
// 下に記述すると認証すら行えないなぁ
login_return_page();
}
break;
case 2:
if (!auth::auth_digest($auth_users)) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Digest realm="' . $realm . '", qop="auth", nonce="' . uniqid() . '", opaque="' . md5($realm) . '"');
} else {
login_return_page();
}
break;
}
}
示例3: plugin_table_edit2_action
//.........这里部分代码省略.........
// . join("\n", $csv_data)
}
}
}
}
}
}
if (isset($vars['table_mod'])) {
$chg = new TableEdit2TableMod($vars['table_mod']);
}
if ($td_edit || $tr_edit) {
$edit = new TableEdit2Edit($vars);
}
if ($edit_show) {
$show = new TableEdit2Show($vars, $page);
}
$args = get_source($page);
static $count = 0;
$source_s = '';
$body = '';
$row_title = 0;
$td_title_count = 0;
if ($td_edit || $tr_edit || $setting || $import) {
$notimestamp = isset($vars['notimestamp']) ? TRUE : FALSE;
}
foreach ($wiki->get() as $args_key => $args_line) {
if (preg_match('/^#([^\\(\\{]+)(?:\\(([^\\r]*)\\))?(\\{*)/', $args_line, $matches) !== FALSE) {
if (isset($matches[1]) && ($matches[1] == 'table_edit2' || $matches[1] == "table_edit2\n")) {
$table_find = 1;
$count++;
if ($line_count === 1 && $count == $table_num) {
if (preg_match('/auth_check[=_](on|off)/i', $matches[2], $auth_check)) {
if ($auth_check[1] == 'on') {
if (!auth::auth_pw($auth_users)) {
$user = TableEdit2Auth::basic_auth();
if (empty($user)) {
return;
}
}
}
} else {
check_editable($page, true, true);
}
if ($setting) {
$args_line = $set->plugin_set_opt($matches[3]);
}
if ($import) {
$args_line = $csv->import_data_set($matches[2], $matches[3]);
}
if (isset($vars['ex_cancel'])) {
$args_line = $csv->cancel($matches[2], $matches[3], 'export');
}
if (isset($vars['im_cancel'])) {
$args_line = $csv->cancel($matches[2], $matches[3], 'import');
}
if (isset($set_csv)) {
$args_line = $csv->set_csv_opt($matches[2], $matches[3], $vars['set_csv']);
}
if ($edit_mod == 'tdshow') {
//tdshow - td_title - 06.11.11
if (preg_match('/title_c=(\\d+)/i', $matches[2], $match_title)) {
$td_title_count = $match_title[1] - 1;
}
}
if ($edit_mod == 'show') {
//show header
示例4: check_role
function check_role($func = '')
{
global $adminpass;
switch ($func) {
case 'readonly':
$chk_role = defined('PKWK_READONLY') ? PKWK_READONLY : ROLE_GUEST;
break;
case 'safemode':
$chk_role = defined('PKWK_SAFE_MODE') ? PKWK_SAFE_MODE : ROLE_GUEST;
break;
case 'su':
$now_role = auth::get_role_level();
if ($now_role == 2 || (int) $now_role == ROLE_ADM_CONTENTS) {
return FALSE;
}
// 既に権限有
$chk_role = ROLE_ADM_CONTENTS;
switch ($now_role) {
case ROLE_AUTH_TEMP:
// FIXME:
return TRUE;
case ROLE_GUEST:
// 未認証者は、単に管理者パスワードを要求
$user = UNAME_ADM_CONTENTS_TEMP;
break;
case ROLE_AUTH:
// 認証済ユーザは、ユーザ名を維持しつつ管理者パスワードを要求
$user = auth::check_auth();
break;
}
$auth_temp = array($user => array($adminpass));
while (1) {
if (!auth::auth_pw($auth_temp)) {
unset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
header('WWW-Authenticate: Basic realm="USER NAME is ' . $user . '"');
header('HTTP/1.0 401 Unauthorized');
break;
}
// ESC : 認証失敗
return TRUE;
}
break;
case 'role_adm':
$chk_role = ROLE_ADM;
break;
case 'role_adm_contents':
$chk_role = ROLE_ADM_CONTENTS;
break;
case 'role_auth':
$chk_role = ROLE_AUTH;
break;
default:
$chk_role = ROLE_GUEST;
}
return auth::is_check_role($chk_role);
}