9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
const DROIT_ECRITURE = 2;
const DROIT_ADMIN = 9;
const ITEMS_PER_PAGE = 50;
protected function _getSalt($length)
{
$str = str_split('./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
shuffle($str);
return implode('',
array_rand(
$str,
$length)
);
}
protected function _hashPassword($password)
{
$salt = '$2a$08$' . $this->_getSalt(22);
return crypt($password, $salt);
}
|
|
<
|
|
|
<
|
>
>
>
>
|
>
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
const DROIT_ECRITURE = 2;
const DROIT_ADMIN = 9;
const ITEMS_PER_PAGE = 50;
protected function _getSalt($length)
{
static $str = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$out = '';
for ($i = 0; $i < $length; $i++)
{
$random = \KD2\Security::random_int(0, strlen($str) - 1);
$out .= $str[$random];
}
return $out;
}
protected function _hashPassword($password)
{
$salt = '$2a$08$' . $this->_getSalt(22);
return crypt($password, $salt);
}
|