当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthUser::validatePassword方法代码示例

本文整理汇总了PHP中AuthUser::validatePassword方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthUser::validatePassword方法的具体用法?PHP AuthUser::validatePassword怎么用?PHP AuthUser::validatePassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AuthUser的用法示例。


在下文中一共展示了AuthUser::validatePassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

echo '<li>Administrative user found.</li>';
// Get the user's permissions from the DB
$perms = array();
$sql = 'SELECT name FROM ' . TABLE_PREFIX . 'permission AS p, ' . TABLE_PREFIX . 'user_role AS ur, ' . TABLE_PREFIX . 'role_permission AS rp' . ' WHERE p.id=rp.permission_id AND rp.role_id=ur.role_id AND ur.user_id=' . $user->id;
$PDO = Record::getConnection();
$stmt = $PDO->prepare($sql);
$stmt->execute();
while ($perm = $stmt->fetchObject()) {
    $perms[] = $perm->name;
}
if (!in_array('admin_edit', $perms)) {
    die('<strong>Upgrade failed!</strong> Administrative permissions not correct.');
}
echo '<li>Administrative user has appropriate permissions...</li>';
// Check administrative user's password
if (!AuthUser::validatePassword($user, $data['pwd'])) {
    die('<strong>Upgrade failed!</strong> Administrative password not correct.');
}
echo '<li>Administrative password correct...</li>';
/***** SAFETY CHECKS DONE, CONTINUE WITH ACTUAL UPGRADE ******/
echo '<li>Starting database upgrade...<ul>';
// MYSQL
if ($driver == 'mysql') {
    singleUpgradeStatement($PDO, "ALTER TABLE " . TABLE_PREFIX . "user ADD CONSTRAINT uc_email UNIQUE (email)", 'Added constraints to user table...');
}
// SQLITE
if ($driver == 'sqlite') {
    singleUpgradeStatement($PDO, "CREATE UNIQUE INDEX uc_email ON " . TABLE_PREFIX . "user (email)", 'Added constraints to user table...');
}
// POSTGRESQL
if ($driver == 'pgsql') {
开发者ID:crick-ru,项目名称:wolfcms,代码行数:31,代码来源:do-upgrade.php


注:本文中的AuthUser::validatePassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。