function PutCookie($key,$value,$kptime=0,$pa="/")
{
global $cfg_cookie_encode;
setcookie($key,$value,time()+$kptime,$pa);
setcookie($key.'__ckMd5',substr(md5($cfg_cookie_encode.$value),0,16),time()+$kptime,$pa);
}
function DropCookie($key)
{
setcookie($key,'',time()-360000,"/");
setcookie($key.'__ckMd5','',time()-360000,"/");
}
function GetCookie($key)
{
global $cfg_cookie_encode;
if( !isset($_COOKIE[$key]) || !isset($_COOKIE[$key.'__ckMd5']) )
{
return '';
}
else
{
if($_COOKIE[$key.'__ckMd5']!=substr(md5($cfg_cookie_encode.$_COOKIE[$key]),0,16))
{
return '';
}
else
{
return $_COOKIE[$key];
}
}
}