Re: [HELP] code modification
From: Tad McClellan (tadmc_at_augustmail.com)
Date: 12/20/03
- Next message: Tad McClellan: "Re: redirect without meta"
- Previous message: Paul Sellis: "Re: [HELP] code modification"
- In reply to: Paul Sellis: "Re: [HELP] code modification"
- Next in thread: Paul Sellis: "Re: [HELP] code modification"
- Reply: Paul Sellis: "Re: [HELP] code modification"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 20 Dec 2003 10:11:32 -0600
Paul Sellis <paul.sellis@alussinan.org> wrote:
> In article (Dans l'article)
><paul.sellis-B3911D.10560620122003@news3-1.free.fr>,
> Paul Sellis <paul.sellis@alussinan.org> wrote (écrivait) :
>> I don't know if you recommand it to me Š
The code is amateurish and buggy. I recommend deleting it and
looking for a replacement.
It is worth *less* than you paid for it!
> &check_url;
That is how subroutines were called 7 years ago.
Is this program 7 years old?
Or is the "programmer" just stuck in the Dark Ages?
check_url();
> sub check_url
> {
> if ($ENV{'HTTP_REFERER'})
> {
> foreach $AUTHURL (@AUTHURLS)
> {
> if ($ENV{'HTTP_REFERER'} =~ /$AUTHURL/i)
> {
> $check_url = '1';
> last;
> }
> }
> }
> else
> {
> $check_url = '1';
> }
That is some foolish logic.
It accepts _anything_ if HTTP_REFERER is not defined.
> if ($hour < 10)
> { $hour = "0$hour"; }
sprintf() should be used for padding instead.
> if ($year >= 100)
> { $year = $year - 100; }
This is a y2100 bug.
The docs for localtime() show the correct way to get a 2-digit year.
Looks like the "programmer" did not read the docs for the function
that he used...
> sub reformat_form_data
> {
> if ($ENV{'REQUEST_METHOD'} eq 'POST')
> {
> # Get the input
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> # Split the name-value pairs
> @pairs = split(/&/, $buffer);
Contains a host of classic bugs, repeated yet again!
> ## Test for valid email
> if ($value !~ /^[\w\.-]+@[\w\.-]+$/) {
This will reject some perfectly valid addresses...
> sub send_email
> {
> # Build the 'from' address of the form: "name <email address>"
>
> $from_name=($CONFIG{'Name'} . " <" . $CONFIG{'email'} . "> ");
$from_name = "$CONFIG{Name} <$CONFIG{email}> ";
> open(MAIL,"|$SENDMAIL -t") || die "Can't open $mailprog!\n";
That diagnostic message is misleading, and it does not include
the $! variable containing the reason for the failure.
This is an example of Script Kiddie code. Blech!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
- Next message: Tad McClellan: "Re: redirect without meta"
- Previous message: Paul Sellis: "Re: [HELP] code modification"
- In reply to: Paul Sellis: "Re: [HELP] code modification"
- Next in thread: Paul Sellis: "Re: [HELP] code modification"
- Reply: Paul Sellis: "Re: [HELP] code modification"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|