/**
* 异位或加密
* @param $value 传入的值
* @param int $type 参数类型,1为加密,0或空 为解密
* @by kilvn <content@kilvn.com>
*/
function encrytion($value, $type=0){
$key = md5('www.wine9.com');
if($type){
return str_replace('=', '', base64_encode($value ^ $key));
}
$value = base64_decode($value);
return $value ^ $key;
}
//加密(拼接)示例
$data = $user['id'].'|'.get_client_ip().'|'.$user['account'];
$data = encrytion($data, 1);
//解密
$data = explode('|', encrytion($_COOKIE['auto_login']));
$data[0]