CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Upper to lower case letters

 



AlanBell
Deleted

Mar 7, 2000, 9:37 PM

Post #1 of 3 (943 views)
Upper to lower case letters Can't Post

I have a section in a CGI script that checks to see the referer is me.
I have just noticed that you can log on the site using upper or lower case letters without a problem ie www.foo.com = www.Foo.com
However when the script checks the referer is determines that foo does not equal Foo.
What needs to be added to make them equal?

The offending script follows.

if ($ENV{'HTTP_REFERER'} ne "" && $ENV{'HTTP_REFERER'} !~ /$domain/)
{
print "Content-type: text/html\n\n";
print "<html><head></head><body bgcolor=#FFFFFF>";
print "The form from $ENV{'HTTP_REFERER'} cannot be accepted.";
exit;
}


AlanBell
Deleted

Mar 8, 2000, 2:42 AM

Post #2 of 3 (943 views)
Re: Upper to lower case letters [In reply to] Can't Post

Thanks Darian.
Your solution works fine.
I can't imagine a simpler method as you have only used one additional key stroke.
Solved in less than an hour.
Thanks again.
Alan


darian
Deleted

Mar 8, 2000, 10:32 AM

Post #3 of 3 (943 views)
Re: Upper to lower case letters [In reply to] Can't Post

If you want foo = Foo = FOO then you need to write it like so:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

if ($ENV{'HTTP_REFERER'} ne "" && $ENV{'HTTP_REFERER'} !~ /$domain/i)</pre><HR></BLOCKQUOTE>

Adding the "i" at the end of the regex you tell it to not care about case. So now foo = Foo = FOO and so on.

[This message has been edited by darian (edited 03-08-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives