发信人: tanwscb(▇▇▇)
整理人: workingnow(2002-09-30 11:46:09), 站内信件
|
超简单方法!
sub cookie{
if($ENV{'HTTP_COOKIE'}) {
@cookies = split(/; /,$ENV{'HTTP_COOKIE'});
foreach(@cookies) {
($name,$value) = split(/=/,$_);
$COOKIE{$name} = $value;
}
}
print "Set-Cookie: $cook=$ENV{'REMOTE_ADDR'}$FORM{'number'};rn";
}
#########################
sub read_cookie{
if($ENV{'HTTP_COOKIE'}) {
@cookies = split(/; /,$ENV{'HTTP_COOKIE'});
foreach(@cookies) {
($name,$value) = split(/=/,$_);
$COOKIE{$name} = $value;
}
}
}
#######
调用时
&read_cookie;
$username=$COOKIE{'UN'};
$email=$COOKIE{'UM'};
.
.
######
生成时
print "Set-Cookie: UN=$username; expires=Sunday, 12-Dec-2002 12:12:12 GMT;rn";
print "Set-Cookie: UM=$email; expires=Sunday, 12-Dec-2002 12:12:12 GMT;rn";
print "Set-Cookie: UH=$homeurl; expires=Sunday, 12-Dec-2002 12:12:12 GMT;rn";
print "Set-Cookie: UP=$pass; expires=Sunday, 12-Dec-2002 12:12:12 GMT;rn";
---- -------- __@ __@ __@
----- _`\<,_ _`\<,_ _`\<,_
---- (*)/ (*) (*)/ (*) (*)/ (*)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
我的主页:fclove.126.com |
|