if(password_verify($curr_password, $user['password']))含义
时间: 2023-09-30 11:04:33 浏览: 32
这段代码是用于验证用户输入的密码是否正确。其中,$curr_password 是用户当前输入的密码,$user['password'] 是数据库中存储的该用户的加密后的密码。
函数 password_verify() 会将用户输入的密码进行加密处理,然后与数据库中存储的密码进行比较。如果两者匹配,则返回 true,表示密码验证成功;否则返回 false,表示密码验证失败。
相关问题
php password_php password_verify函数怎么用
`password_hash()` 函数可以用于将密码加密,`password_verify()` 函数可以用于验证密码是否匹配。
以下是用法示例:
1. 加密密码
```php
$password = '123456';
$hash = password_hash($password, PASSWORD_DEFAULT);
echo $hash;
```
2. 验证密码
```php
$password = '123456';
$hash = '$2y$10$1DyM9RlP5FjHzBLb5z0F3uL4KQa3rJcCZj3Qz7gJyjN0YzKtZP1vK';
if (password_verify($password, $hash)) {
echo '密码匹配';
} else {
echo '密码不匹配';
}
```
注意,`password_hash()` 函数和 `password_verify()` 函数需要 PHP 版本在 5.5.0 及以上。
oracle PASSWORD_VERIFY FUNCTION
In Oracle, the PASSWORD_VERIFY_FUNCTION is a built-in function that allows you to enforce password complexity rules and policies when creating or altering user passwords. It helps to ensure that passwords meet certain requirements and enhances the security of the Oracle database.
By default, Oracle provides a default password verification function called "ORA12C_STRONG_VERIFY_FUNCTION". This function enforces the following password complexity rules:
1. The password must be at least 8 characters long.
2. It must contain at least one uppercase letter.
3. It must contain at least one lowercase letter.
4. It must contain at least one numeric digit.
5. It must contain at least one special character (e.g., !@#$%^&*).
You can view the details of this default password verification function by querying the DBA_USERS view:
```sql
SELECT * FROM DBA_USERS;
```
To alter the password complexity rules or create a custom password verification function, you can use the DBMS_AUTHENTICATION package. Here's an example of how to create a custom password verification function in Oracle:
```sql
CREATE OR REPLACE FUNCTION my_password_verify_function (
username IN VARCHAR2,
password IN VARCHAR2,
old_password IN VARCHAR2
) RETURN BOOLEAN IS
-- Custom password verification logic goes here
BEGIN
-- Return TRUE if the password meets the desired criteria, otherwise FALSE
END;
/
```
Once you have created your custom password verification function, you can set it as the current password verification function using the ALTER PROFILE statement:
```sql
ALTER PROFILE my_profile LIMIT PASSWORD_VERIFY_FUNCTION my_password_verify_function;
```
This will enforce your custom password complexity rules for new passwords or when altering existing passwords for users associated with the specified profile.
Remember to adjust the logic inside your custom password_verify_function to fit your specific requirements for password complexity and security.