
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 0.62 KB | hits: 33 | expires: Never
Custom 'secure' php and MySQL user login session system
$salt = to64(getRandomBytes(16));
if (CRYPT_BLOWFISH == 1)
$securePassword = crypt($password, '$2a$10$'.$salt);
session.use_trans_sid = 0
session.use_only_cookies = 1
session.hash_function = sha512
session.hash_bits_per_character = 5
session_set_cookie_params("86400", "/");
session_name("auth");
session_start();
$_SESSION['userId'] = $row[0];
$_SESSION['created'] = time();
if($_SESSION['created'] + 30 * 60 < time())
{
session_regenerate_id ();
$_SESSION['created'] = time();
}
session_set_cookie_params('86400', '/', '', true, true);