Article View: comp.lang.perl.misc
Article #228Re: And...
From: Hiro Asari
Date: Sat, 29 Mar 2003 05:52
Date: Sat, 29 Mar 2003 05:52
28 lines
1766 bytes
1766 bytes
"Ami" <amiba128@sd6.so-net.ne.jp> wrote in message
news:3e85034f$0$55953$45beb828@newscene.com...
> If the people, access a Web page, has the cookie,
> the page is displayed.
> But the man, access a Web page, doesn't have the cookie,
> the page isn't displayed and jump to another page.
> I want to know a script for the purpose as prohibition direct link.
>
> #!/usr/bin/perl
> if ( index ( $ENV{'HTTP_COOKIE'} , 'hello' ) < 0 ) {
> print "Location: http://www.usa.com/\n\r";
> }
>
> Am I right ?
> Is the script right ?
>
>
Since you're not doing anything with the position of the substring, index is
probably uncalled for.
if ($ENV{'HTTP_COOKIE'} !~ m/hello/) {
# do stuff
}
You should try fj.comp.lang.perl. If you aren't too comfortable with
English.
Technical Details
Message-ID:
<v8ad4gp2hvvk47@corp.supernews.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news-feed.riddles.org.uk!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mailReferences:
<3e85034f$0$55953$45beb828@newscene.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f9898,d665bc63d5f5269f,start X-Google-Attributes: gidf9898,public X-Google-Thread: fa0ae,e633c10bef9c13b3 X-Google-Attributes: gidfa0ae,public X-Google-ArrivalTime: 2003-03-28 21:52:20 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news-feed.riddles.org.uk!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Hiro Asari" <hiro@asari.net> Newsgroups: comp.lang.perl.misc,fj.comp.lang.perl Subject: Re: And... Date: Fri, 28 Mar 2003 23:52:17 -0600 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <v8ad4gp2hvvk47@corp.supernews.com> References: <3e85034f$0$55953$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 X-Complaints-To: abuse@supernews.com Lines: 30