Article View: comp.lang.perl.misc
Article #230Re: And...
From: Ami
Date: Sat, 29 Mar 2003 08:43
Date: Sat, 29 Mar 2003 08:43
50 lines
3075 bytes
3075 bytes
$B?tF|A0M'?M$+$iD>%j%s%/$rKI$0%9%/%j%W%H$N0MMj$r<u$1$^$7$F(B
$B;d$H$7$^$7$F$b!"2?G/$V$j$+$N;v$J$N$G$9$C$+$j:$$C$F$7$^$C$?$N$G$9!#(B
$B0MMj$H8@$&$N$O$"$k%Z!<%8$G%/%C%-!<$r%;%C%H$7$FJL$N%Z!<%8$K%"%/%;%9$7$?;~$K(B
$B$=$NM-L5$rD4$Y$F!"$b$7$"$C$?$i$=$N$^$^I=<($7$F!"JL$N%/%C%-!<$r%;%C%H$G$-$k(B
$B$=$7$F!"$b$7%/%C%-!<$,$J$+$C$?$i;XDj$N%Z!<%8$KHt$P$;$k$h$&$J%9%/%j%W%H$r!D(B
$B$H$$$&0MMj$r<u$1$^$7$?!#(B
$BM'?M$b?'!9$J7G<(HD$GD4$Y$F$$$k$1$I!"$b$C$?$$$V$C$??M4V$,B?$/$F65$($FLc$($J$$(B
$B$J$I$H$3$\$7$F$$$^$9$,!"AG?M$@$+$i<ALd$N;EJ}$,0-$$$N$@$1$J$N$@$H;W$C$F$$$^$9!#(B
#!/usr/bin/perl
use strict;&main;exit;
sub main{
my $id = "hello";
my $value = "";
print "Set-Cookie: ".setcookie($id,\$value);
print "Content-Type: text/plain\n\n";
print "SetCookie!!";
}
sub setcookie{
my ($id,$cookie) = @_;
my $expires = "";
my $day = 1;
$$cookie =~ s/([^\w ])/'%'.unpack('H2',$1)/eg;
$$cookie =~ tr/ /+/;
if ($day > 0){
my ($mday,$month,$year,$youbi) = (gmtime(time +($day * 86400)))[3..6];
$day=('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')[$d
ay];
$month=('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
[$month];
$year += 1900;
$mday = sprintf("%02d",$mday);
$expires = " expires=$youbi, $mday-$month-$year 00:00:00 GMT";
}
return "$id=$$cookie;$expires\n";
}
$B$G@_Dj$O$G$-$k$O$:$@$H$$$&;v$G$9!#(B
$B$?$@%V%i%&%6$rJD$8$F$b>C$($J$$$N$G!"%V%i%&%6$rJD$8$?$i>C$($k$h$&$K$7$F$[$7$$(B
$B$H$N;v$J$N$G$r(Bmy $day = 1;0$B$K$9$l$PNI$$$N$G$O!D$HJV$7$?$N$G$9$,(B
$B$I$&$b$=$&$G$b$J$$$_$?$$$J$N$G!":$$C$?;d$,$"$A$i$K=P$7$?<ALd$,:G=i$N<ALd$G$9!#(B
$B$=$7$F%/%C%-!<$NM-L5$rD4$Y$F$J$+$C$?>l9g!";XDj$N%Z!<%8$KHt$P$9$N$,(B
$B0J2<$K=q$$$?$b$N$@$C$?$N$G$9!#(B
$B5-21$,Dj$+$G$O$J$$$G$9$,!"0J2<$N$h$&$K=q$$$F@5$7$+$C$?H&$J$N$G$9$,(B
$BA4$/K:$l$F$7$^$C$F$$$^$7$?!#(B
#!/usr/bin/perl
if ( index ( $ENV{'HTTP_COOKIE'} , 'hello' ) < 0 ) {
print "Location: http://www.hoge.com/\n";
}
$B$I$&$b$$$&;v$rJ9$$$F$/$l$^$;$s%M!#(B(^^$B!6(B
$B!D$H$$$&Lu$G$H$F$b:$$C$F$$$^$9!#(B
Technical Details
Message-ID:
<3e855c05$0$41594$45beb828@newscene.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!teleglobe.net!novia!newscene.com!newscene!novia!novia!sequencer.newscene.com!not-for-mailReferences:
<3e85034f$0$55953$45beb828@newscene.com> <v8ad4gp2hvvk47@corp.supernews.com> <3e855291$0$9608$45beb828@newscene.com>Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: f9898,d665bc63d5f5269f X-Google-Attributes: gidf9898,public X-Google-Thread: fa0ae,e633c10bef9c13b3 X-Google-Attributes: gidfa0ae,public X-Google-ArrivalTime: 2003-03-29 00:43:46 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!teleglobe.net!novia!newscene.com!newscene!novia!novia!sequencer.newscene.com!not-for-mail From: "Ami" <amiba128@sd6.so-net.ne.jp> Newsgroups: comp.lang.perl.misc,fj.comp.lang.perl Subject: Re: And... Date: 29 Mar 2003 02:43:08 -0600 Lines: 52 Message-ID: <3e855c05$0$41594$45beb828@newscene.com> References: <3e85034f$0$55953$45beb828@newscene.com> <v8ad4gp2hvvk47@corp.supernews.com> <3e855291$0$9608$45beb828@newscene.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106