本文整理汇总了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') {