Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cookie_set($key, $value)
- {
- setcookie(
- $key,
- base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($config['salt']), $value, MCRYPT_MODE_CBC, md5(md5($config['salt'])))),
- time()+$config['expire']
- );
- }
- function cookie_get($key)
- {
- return rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($config['salt']), base64_decode($_COOKIE[$key]), MCRYPT_MODE_CBC, md5(md5($config['salt']))), "\0");
- }
- $config = array(
- // Database
- 'db_host' => 'localhost',
- 'db_user' => 'root',
- 'db_pass' => '',
- 'db_name' => '',
- // Cookies
- 'salt' => 'xxx',
- 'expire' => 1209600, // 14 days
- );
Add Comment
Please, Sign In to add comment