[15880] in Perl-Users-Digest
Perl-Users Digest, Issue: 3293 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 8 18:05:45 2000
Date: Thu, 8 Jun 2000 15:05:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <960501922-v9-i3293@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 8 Jun 2000 Volume: 9 Number: 3293
Today's topics:
Re: << Problems with Net::SMTP >> <nick@kvisr.demon.co.uk>
Re: << Problems with Net::SMTP >> <nick@kvisr.demon.co.uk>
Re: << Problems with Net::SMTP >> <tfm@sei.cmu.edu>
Re: Can't Write Binary File <nospam@nospam.com>
Re: Checking for Variable's value <raphaelp@nr1webresource.com>
Re: counter script in Perl (David H. Adler)
Re: Database program <Jonathan.L.Ericson@jpl.nasa.gov>
Date comparison ? euterpe21@yahoo.com
DBI & ODBC <david.mohorn@ncr.com>
Re: DBI & ODBC <graham.wood@iona.com>
Executable won't run in suid mode <block@cns.ucalgary.ca>
Re: file access <methos495@earthlink.net>
Re: file access (Brandon Metcalf)
flushing output in perl salvadorej@my-deja.com
Re: flushing output in perl <lauren_smith13@hotmail.com>
form to mail script.. <nospam@nospam.com>
Re: form to mail script.. <care227@attglobal.net>
How does Perl wipe out prvious data when you re-enter t lisashieh@my-deja.com
Re: How does Perl wipe out prvious data when you re-ent <tina@streetmail.com>
How to clean up previous data when you re-enter the sam <sshieh2@visteon.com>
Re: How to clean up previous data when you re-enter the <tina@streetmail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 08 Jun 2000 19:56:50 +0100
From: Nick Porter <nick@kvisr.demon.co.uk>
Subject: Re: << Problems with Net::SMTP >>
Message-Id: <nvqvjssbmibadc5l5mab0v23dgcdb7bkg2@4ax.com>
On 8 Jun 2000 10:07:42 GMT, ebohlman@netcom.com (Eric Bohlman) wrote:
>
>The first argument needs to be quoted.
Thanks for pointing that out. I believe this was the main problem and
it's now working, after a fashion.
--
NP
------------------------------
Date: Thu, 08 Jun 2000 20:14:29 +0100
From: Nick Porter <nick@kvisr.demon.co.uk>
Subject: Re: << Problems with Net::SMTP >>
Message-Id: <k3rvjsknrpcs82aa1oqh4jk3db4aej135k@4ax.com>
On Thu, 08 Jun 2000 08:21:38 -0400, Drew Simonis
<care227@attglobal.net> wrote:
>
>It kinda implies to me that %option is undefined. Why are you using
>it?
[NP] One of the books I have 'Perl In A Nutshell' says "Any options
are passed to 'new' as a hash where the option is the key." I took
this to mean that I should make a hash of the options I wanted and use
that in the constructor. I was unaware that 'Timeout => 60' was
another way of expressing a hash.
>I think you may be a bit confused.
[NP] Yep me too. as far as I can tell i've been pretty much confused
most of my life. ;o)
> From the Net::SMTP docs:
[NP] Hmm, I downloaded the module from CPAN but couldn't find any
manual docs, which surprised me, in the zip explaining how to use it.
Where did you get yours?
>
>SYNOPSIS
> use Net::SMTP;
>
> # Constructors
> $smtp = Net::SMTP->new('mailhost');
> $smtp = Net::SMTP->new('mailhost', Timeout => 60);
>
[NP] I added the option 'Debug=>1' to the constructor expecting to see
some information on the requests and responses made by the server but
Nada! How to I show the conversation? This is pretty academic now as I
have got the command to work but I would like to see what is going on
between it and the server.
Thanxz muchly for your help.
--
NP
------------------------------
Date: Thu, 08 Jun 2000 16:13:29 -0400
From: Ted Marz <tfm@sei.cmu.edu>
Subject: Re: << Problems with Net::SMTP >>
Message-Id: <393FFE69.6958D37D@sei.cmu.edu>
Net::SMTP::new appears to understand the following arguments
a host specifier .. the host name of the SMTP host, or the configured
Net:: smtp_host if omitted. This appears to be a list, which is
iterated across.
a Port specifier.. which is the SMTP port number to use, or 25 if
omitted. This appears to have to be the same of all hosts in the host
list.
A Timeout specifier.. in seconds, which defaults to 120 if omitted.
A Debug specifier
A Hello specifier.
There appears to be POD documentation at the end of the package, and the
documentation appears to match what is implemented
perldoc Net::SMTP
Ted
------------------------------
Date: 8 Jun 2000 18:41:47 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Can't Write Binary File
Message-Id: <8hopdb$fpj$1@216.155.33.31>
In article <8hj96b$nkt$1@news.service.uci.edu>, "Gabe"
<grichard@uci.edu> wrote:
| W Kemp <bill.kemp@wire2.com> wrote in message
| news:960279838.669.0.nnrp-07.c3ad6973@news.demon.co.uk...
| >
| > Gabe wrote in message ...
| > >No dice, file still has zero bytes. Ack! Help!
| > <SNIP>
| >
| > zero bytes on a file upload- check the HTML page that send the
| > data. Is the form multipart enctype ?
|
| Well, of course it isn't!!! If it were, then everything would've
| worked and I wouldn't have wasted so many hours trying to fix it!
|
| No, but seriously, thank you, I had totally forgotten about
| enctype...
I also thank y'all for stumbling over this one before *I* did. *taking
down copious notes* :-)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Thu, 8 Jun 2000 21:06:57 +0200
From: "Raphael Pirker" <raphaelp@nr1webresource.com>
Subject: Re: Checking for Variable's value
Message-Id: <8hoqtm$gj3$1@news.online.de>
thanks! worked!
Lauren Smith <lauren_smith13@hotmail.com> wrote in message
news:8hol7b$pft$1@brokaw.wa.com...
>
> Raphael Pirker <raphaelp@nr1webresource.com> wrote in message
> news:8hojtu$bc8$1@news.online.de...
> >
> > I have the following problem: I'm gathering input from a Form and I need
> to
> > check inside the script whether a value was entered. The code which
> assigns
> > the value of the form looks as follows:
> >
> > $results_cartoon = $FORM{results_cartoon};
> >
> > Now I need to see if $results_cartoon has a value, or if nothing was
> > entered. If it helps, $results_cartoon is supposed to have a number
> between
> > 0 and 20 as value...
>
> perldoc -f defined
>
> Lauren
>
>
>
------------------------------
Date: 8 Jun 2000 18:32:54 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: counter script in Perl
Message-Id: <slrn8jvpmm.l64.dha@panix2.panix.com>
On 6 Jun 2000 16:51:56 GMT, John Gehman <jdg28@pantheon.yale.edu>
wrote:
>Search for Matt's Script Archive. Download his counter. No sense in
>reinventing a perfectly round wheel
Um, actually, according to most of the leading lights of perl
development, Matt's wheels are *far* from perfect in shape or
function...
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
It's amazing what giant mutant ants that are the result of Man's
dabbling with the power of atomic energy can accomplish when they set
themselves to the task. - Mark Rogaski
------------------------------
Date: Thu, 08 Jun 2000 11:42:01 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Database program
Message-Id: <393FE8F9.6484F9F4@jpl.nasa.gov>
Jim Ray wrote:
> What is the easiest way to handle a simple database need? Here is what I
> have. A list of names and address, by regions and email.
>
> I want to be able to build a list sorted by last name or company. I also
> want to have control over what the output looks like. Also, I want to be to
> place an mailto around the email address.
>
> Now, my host will not support MySql, so that one is out. I currently have
> the information in a text file. What would be my next best thing to do?
Consider using DBI with DBD::CSV or DBD::RAM (all available at CPAN).
DBI is the standard Perl database interface. DBD::CSV is a driver for
DBI that treats a CVS (comma separated values) file as a database.
DBD::RAM provides DBI access to a variety of formats and sources
including Perl arrays in memory and formatted files.
I wouldn't recommend this approach if you have a small, static database
(it's easier to load to whole thing into a hash). If you do move to
MySQL, however, you'll find the transition to be much easier if
everything is already written using DBI.
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: Thu, 08 Jun 2000 23:40:40 +0200
From: euterpe21@yahoo.com
Subject: Date comparison ?
Message-Id: <gg40ks82kqdk1jaifkagpf7ikor63m0ala@4ax.com>
Hi,
I'm looking for a formula (or a ready-made script) to continuously
calculate the time left in days, hours and minutes between a past
given date and the present date.
TIA for any help.
------------------------------
Date: Thu, 8 Jun 2000 14:05:18 -0400
From: "David Mohorn" <david.mohorn@ncr.com>
Subject: DBI & ODBC
Message-Id: <393fe05f@rpc1284.daytonoh.ncr.com>
I seem to be having a problem:
How can I connect from an AIX UNIX server via a Perl script using DBI to an
external database, such as MS SQLServer 7.0? I know I can use the DBI:ODBC,
but I'm confused as to how UNIX is suppose to know where my database is.
I.E., on ntserver1.com.
Also, since UNIX doesn't use DSN (Data Source Names), how do I manage this
to tell UNIX where my server/database is?
Please advise.
david.mohorn@ncr.com
------------------------------
Date: Thu, 8 Jun 2000 22:30:54 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: DBI & ODBC
Message-Id: <8hp3uk$ld2$1@bvweb.iona.com>
There is an example of this scenario (Unix client connecting to NT Access
server but any ODBC data source works in a similar way) in Programming the
Perl DBI. You need to use DBI::Proxy on the Unix and NT ends as well as
DBD::ODBC. This allows you to specify a hostname and port number for the NT
machine in your script on Unix. I haven't done this yet but I'm just about
to attempt it and the book looks like it makes sense.
Graham Wood
David Mohorn <david.mohorn@ncr.com> wrote in message
news:393fe05f@rpc1284.daytonoh.ncr.com...
>
> I seem to be having a problem:
>
> How can I connect from an AIX UNIX server via a Perl script using DBI to
an
> external database, such as MS SQLServer 7.0? I know I can use the
DBI:ODBC,
> but I'm confused as to how UNIX is suppose to know where my database is.
> I.E., on ntserver1.com.
>
> Also, since UNIX doesn't use DSN (Data Source Names), how do I manage this
> to tell UNIX where my server/database is?
>
> Please advise.
>
> david.mohorn@ncr.com
>
>
>
------------------------------
Date: Thu, 08 Jun 2000 11:47:40 -0600
From: Edward Block <block@cns.ucalgary.ca>
Subject: Executable won't run in suid mode
Message-Id: <393FDC3C.3BF96BCF@cns.ucalgary.ca>
This should be simple...
I want to run a perl5 script with suid set. I followed the directions
and advise given at Perl's FAQ:
http://www.perl.com/pub/doc/FAQs/cgi/wwwsf5.html#Q49
This doens't seem to work. The Perl library
/usr/lib/perl5/5.00503/File/Copy.pm complains about insecure
dependancies while runing setuid. I thought if I write a C wrapper like
#include <unistd.h>
void main () {
execl("/usr/local/bin/perl","foo.pl","/local/web/cgi-bin/foo.pl",NULL);
}
it would work...
Is there something I've missed?
Any help would be greatly appreciated
Thanks
Ed Block
------------------------------
Date: Thu, 08 Jun 2000 20:48:04 GMT
From: methos <methos495@earthlink.net>
Subject: Re: file access
Message-Id: <3940076B.16F3680D@earthlink.net>
Try something like flock()
That should stop multiple write accesses to the same output file.
--
- Methos -
"Patience comes to those who wait"
- Anonymous -
Eric Mosley wrote:
> Hi,
>
> I will have a cgi perl program that will take names and emails from a form
> on a web page and save them to a file.
>
> What happens if two people submit at the same time?
>
> Each instance of the cgi perl program will try and open the file and write
> to it at the same time? Is there any way of stopping that?
>
> Its on my ISP's servers so I can't use modperl or anything that they don't
> have.
>
> Thanks.
>
> Eric
------------------------------
Date: 8 Jun 2000 21:40:07 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: file access
Message-Id: <8hp3rn$s40$1@spinner.corpeast.baynetworks.com>
methos495@earthlink.net writes:
> Try something like flock()
> That should stop multiple write accesses to the same output file.
No it won't. File locking only works if all processes cooperate.
Brandon
------------------------------
Date: Thu, 08 Jun 2000 21:11:37 GMT
From: salvadorej@my-deja.com
Subject: flushing output in perl
Message-Id: <8hp25p$jdm$1@nnrp1.deja.com>
How does one flush output in perl? I'm having some problems with
a few things mysteriously coming out before the "Content-type" line
in a CGI script, and I'm thinking this might help. I'd prefer trying
to do this w/o the standard modules...
--
============================================================
"The best laid plans of mice and men are about equal"
iowa_so8ng@hot8mail.com
Adress is spam-resistant; remove eight's to reach me.
Also, the header address (salvadoreh)is spam-bait.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 8 Jun 2000 14:48:01 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: flushing output in perl
Message-Id: <8hp49b$nje$1@brokaw.wa.com>
<salvadorej@my-deja.com> wrote in message
news:8hp25p$jdm$1@nnrp1.deja.com...
> How does one flush output in perl?
perlfaq5: How do I flush/unbuffer an output filehandle? Why must I do this?
> I'm having some problems with
> a few things mysteriously coming out before the "Content-type" line
> in a CGI script, and I'm thinking this might help. I'd prefer trying
> to do this w/o the standard modules...
But you will use standard modules in your production code, right?
Lauren
------------------------------
Date: 8 Jun 2000 20:55:23 GMT
From: The WebDragon <nospam@nospam.com>
Subject: form to mail script..
Message-Id: <8hp17r$6fm$2@216.155.33.31>
I've stumbled on a fairly short script that converts a form input to
mail.. and properly taking my grain of salt before even THINKING about
installing and testing this puppy, I thought I might post it here and
invite some commentary about any 'unsafe' or 'unwise' things it might be
doing, and ways to do them better.. (aside from the lack of use strict
;)
When the time comes for myself I'd probably use CGI.pm & CGI::Carp or
somesuch, but I'd still like to 'learn a bit' anyway, about the included
perlish constructs, and the methods regexes which are used in here, and
seem to be for the purpuse of 'untainting' the data.. but I'm not sure.
:)
-=-
#!perl -w
$mailprog = '/usr/sbin/sendmail';
######################
# A date for those with no /bin/date
#
@junk = localtime(time);
$date = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$junk[4]];
$date .= ' ' . $junk[3] . ', ' . ($junk[5] + 1900);
$date .= ' ' . $junk[2] . ':' . $junk[1];
######################
# Necessary Fields in HTML Form: (Read the README file for more info)
# recipient = specifies who mail is sent to
# username = specifies the remote users email address for replies
# realname = specifies the remote users real identity
# subject = specifies what you want the subject of your mail to be
########################
# A subroutine to die gracefully under html
########################
sub safe_die {
print "Content-type: text/plain\n\n";
print @_,"\n";
exit(0);
}
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
# clean up the recipient address, to avoid hackers
($whoto) = ($FORM{'recipient'} =~ /([\w\.\-\%]+\@[\w\.\-]+)/);
if ($whoto eq "") {
&safe_die("Invalid Recipient!\n");
}
if ($FORM{'username'} eq "") {
$FORM{'username'} = "No-Email-Given";
}
# Open The Mail
open (MAIL, "|$mailprog $whoto") || &safe_die("Can't open $mailprog!\n");
print MAIL "From: $FORM{'username'}\n";
print MAIL "Reply-To: $FORM{'username'}\n";
print MAIL "To: $whoto\n";
print MAIL "Subject: $FORM{'subject'}\n\n";
print MAIL "Below is the information submitted on $date\n";
print MAIL
"------------------------------------------------------------------------
----------------\n\n";
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
if (($name eq "recipient")||
($name eq "subject") ||
($name eq "Senden") ||
($name eq "Send") ||
($name eq "thankurl")) {
print MAIL "";
}
else {
# Print the MAIL for each name value pair
print MAIL "$name: $value\n";
}}
close (MAIL);
if ($FORM{thankurl} eq "no") {
print "Content-type: text/html\n\n";
print "<html><head><title>Thank You</title></head>\n";
print "<body><CENTER><h1>Thank You</h1><BR>Please press the back button
on your browser to go back.</CENTER>\n";
print "Below is what you submitted on $date<hr>\n";
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
if (($name eq "recipient")||
($name eq "subject") ||
($name eq "Senden") ||
($name eq "Send") ||
($name eq "thankurl")) {
print "";
}
else {
# Print the Return HTML for each name value pair.
print "$name = $value<p>\n";
}}
print "</body></html>";
}
else
{
print "Location: $FORM{'thankurl'}\n\n";
}
__END___
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Thu, 08 Jun 2000 17:30:48 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: form to mail script..
Message-Id: <39401088.2228AAF0@attglobal.net>
The WebDragon wrote:
>
> I've stumbled on a fairly short script that converts a form input to
> mail.. and properly taking my grain of salt before even THINKING about
> installing and testing this puppy, I thought I might post it here and
> invite some commentary about any 'unsafe' or 'unwise' things it might be
> doing, and ways to do them better.. (aside from the lack of use strict
> ;)
>
> When the time comes for myself I'd probably use CGI.pm & CGI::Carp or
> somesuch, but I'd still like to 'learn a bit' anyway, about the included
> perlish constructs, and the methods regexes which are used in here, and
> seem to be for the purpuse of 'untainting' the data.. but I'm not sure.
> :)
>
Not using CGI.pm or some similar CGI module is one of the
oddities of this script, one that I am sure many won't like.
(Now that I know what it means, I can use it... here I go)
This is Cargo Cult programming:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
(I feel much better now)
And this:
# clean up the recipient address, to avoid hackers
($whoto) = ($FORM{'recipient'} =~ /([\w\.\-\%]+\@[\w\.\-]+)/);
if ($whoto eq "") {
&safe_die("Invalid Recipient!\n");
}
is bad. Better would have been to use something like Email::Valid,
but even that has numerous pitfalls. But, since we only want to
check to make sure we aren't passing shell escapes to sendmail,
the usage of a validity check is warranted.
Im kinda unsure about why I see the author "Un-Webify plus signs
and %-encoding" 3 times. That just seems odd.
------------------------------
Date: Thu, 08 Jun 2000 20:38:05 GMT
From: lisashieh@my-deja.com
Subject: How does Perl wipe out prvious data when you re-enter the same form?
Message-Id: <8hp07a$hpf$1@nnrp1.deja.com>
Hi, everyone:
I have a html form for entering user name and password and a piece of
Perl code for checking the user name and password are in the database
table or not. If they are in the table, user can continue accessing. If
not, it will give user an error message.
Assumed, "xyz" and "0987" are the right user name and password. If I
typed user name "abcd" and password "1234" in html and hit submit. Perl
will give me an error message as it suppose to do. Then, I click "back"
go back to html and enter the right user name "xyz" and password "0987".
Perl will allow me to continue acceesing, but it will pass "abcd" and
"1234" to next Perl. How can I let Perl wipe out the previous data?
The Perl that I am using is Perl 5.004 in Unix environment. The
following is my html and Perl.
----html------------------------------
<html>
<head>
<title>Personnel Development Planning password page</title>
</head>
<body background="gif/homeback.gif" link="#AA0055" vlink="#BB0000">
<form method="post"
action="http://ac4297.scii.visteon.com:9400/perl/lia_hr/main.pl">
<table border=0>
<tr>
<td rowspan=11 valign=top>
<a href="http://hub.visteon.com">
<img src="gif/visteon.gif" width=104 height=66 border=0 alt="Visteon
Intranet Hub"></a>
</td>
<td><center><img src="gif/main_ttl.gif" width=462 height=81></td>
</tr>
<tr>
<td>
<center>
<table border=0>
<tr><td colspan=2><img src="gif/edit_psd.gif" width=380 height=29><br>
<center><FONT FACE="Helvetica" size=1>(Both CDS ID and password are case
sentitive.)</td></tr>
<tr><td></td></tr>
<tr><td><FONT FACE="Helvetica" size=2><b>CDS ID:</TD>
<td><input type=text name=profs size=20></td>
</tr>
<tr><td><FONT FACE="Helvetica" size=2><b>Password:</TD>
<td><input type=password name=password size=20></td>
</tr>
</table>
</form>
</body>
</html>
------Perl code------------------------------
#!/usr/local/bin/perl -w
#use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $query = new CGI;
my ($dbh, $stmt);
my $profs = $query->param("profs");
my $password = $query->param("password");
# check profs, password, and authorization
$dbh = DBI->connect("fsddv","permeation","testdb","Oracle");
$stmt = "select count(*) from security where cds='$profs' and
password='$password'";
my $sth = $dbh->prepare($stmt);
$sth->execute();
my $in = $sth->fetchrow();
$sth->finish();
$dbh->disconnect;
if ($in == 1){&print_result;}
else {&error;}
sub error{
print $query->header;
print $query->start_html(-title=>'Personnel Development
Planning',
-bgcolor=>'white');
print "<br><br><br>
<FONT FACE=Helvetica SIZE=4 color=red><center>
profs is $profs<br>password is $password<br>
Your access was denied.</font><br><br><br>\n";
print $query->end_html;
exit (0);
}
sub print_result{
print $query->header;
print $query->start_html(-title=>'Personnel Development Planning
Main Page');
print "<body background=\"/lia_hr/gif/homeback.gif\">";
print "profs is $profs<br>password is $password<br>";
print "<table border=0>";
print "<tr><td rowspan=11 valign=top><a
href=\"http://hub.visteon.com\">
<img src=\"/lia_hr/gif/visteon.gif\" width=104 height=66
HSPACE=10 alt=\"Visteon Intranet Hub\" border=0></a></td>";
print "<td><center><img src=\"/lia_hr/gif/main_ttl.gif\"
width=462
height=81></td></tr>";
print "<tr><td><br></td></tr>
<tr><td><br></td></tr>";
print "<tr><td><center>
<table border=0>
<tr><td><img src=\"/lia_hr/gif/select_op.gif\" width=393
height=29></td></tr>
<tr><td></td></tr>
<tr><td><center>
<table border=0>
<form method=post
action=\"http://ac4297.scii.visteon.com:9400/perl/lia_hr/search_input.pl
\">
<input type=hidden name=profs value=$profs>
<input type=hidden name=password value=$password>
<tr><td><img src=\"/lia_hr/gif/search_off.gif\"
width=175
height=25 border=0></td>
<td><input type=submit value=Select></td>
</form>
</table>
</td></tr>
<tr><td><center>
<table border=0>
<form method=post
action=\"http://ac4297.scii.visteon.com:9400/perl/lia_hr/edit_input.pl\"
>
<input type=hidden name=profs value=$profs>
<input type=hidden name=password value=$password>
<tr><td><img src=\"/lia_hr/gif/edit_off.gif\" width=175
height=25 border=0></td>
<td><input type=submit value=Select></td>
</form>
</table>
</td></tr>
<tr><td><center>
<table border=0>
<form method=post
action=\"http://ac4297.scii.visteon.com:9400/perl/lia_hr/delete_input.pl
\">
<input type=hidden name=profs value=$profs>
<input type=hidden name=password value=$password>
<tr><td><img src=\"/lia_hr/gif/delete_off.gif\"
width=175
height=25 border=0></td>
<td><input type=submit value=Select></td>
</form>
</table>
</td></tr>
<tr><td><center>
<table border=0>
<form method=post
action=\"http://ac4297.scii.visteon.com:9400/perl/lia_hr/dataentry.pl\">
<input type=hidden name=profs value=$profs>
<input type=hidden name=password value=$password>
<tr><td><img src=\"/lia_hr/gif/data_off.gif\" width=175
height=25 border=0></td>
<td><input type=submit value=Select></td>
</form>
</table>
</td></tr>
</table>
</td></tr>";
print "</table>";
print $query->end_html;
exit(0);
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 8 Jun 2000 21:18:57 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: How does Perl wipe out prvious data when you re-enter the same form?
Message-Id: <8hp2k1$3g9tu$5@fu-berlin.de>
hi,
lisashieh@my-deja.com wrote:
> I have a html form for entering user name and password and a piece of
> Perl code for checking the user name and password are in the database
> table or not. If they are in the table, user can continue accessing. If
> not, it will give user an error message.
> Assumed, "xyz" and "0987" are the right user name and password. If I
> typed user name "abcd" and password "1234" in html and hit submit. Perl
> will give me an error message as it suppose to do. Then, I click "back"
> go back to html and enter the right user name "xyz" and password "0987".
> Perl will allow me to continue acceesing, but it will pass "abcd" and
> "1234" to next Perl. How can I let Perl wipe out the previous data?
i just ansered the same (or nearly the same) posting.
please do not crosspost in so many groups and not
with so much code. and i saw the same posting of you in
de.comp.lang.perl.misc.
(IF X-Posting then do it all with one posting)
tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Thu, 08 Jun 2000 15:13:14 -0400
From: Lisa Shieh <sshieh2@visteon.com>
Subject: How to clean up previous data when you re-enter the same form
Message-Id: <393FF04A.ABEB4474@visteon.com>
Hi, everyone:
I have a html page for entering user name and password and a piece of
Perl code for checking the user name and password in the table or not.
If they are in the table, user can continue accessing. If not, give user
an error message.
The problem is that I type user name "abcd" and password "1234" in html
the first time and hit submit. Perl will give me an error message as it
suppose to do. Then, I click "back" go back to html and enter another
user name "xyz" and password "0987". The user name and password that
Perl get will still be "abcd" and "1234". How can I clean up the
previous data?
The Perl that I am using is Perl 5.004 in Unix environment. The
following is my html and Perl.
----html------------------------------
<html>
<head>
<title>Personnel Development Planning password page</title>
</head>
<body background="gif/homeback.gif" link="#AA0055" vlink="#BB0000">
<form method="post"
action="http://ac4297.scii.visteon.com:9400/perl/lia_hr/main.pl">
<table border=0>
<tr>
<td rowspan=11 valign=top>
<a href="http://hub.visteon.com">
<img src="gif/visteon.gif" width=104 height=66 border=0 alt="Visteon
Intranet Hub"></a>
</td>
<td><center><img src="gif/main_ttl.gif" width=462 height=81></td>
</tr>
<tr>
<td>
<center>
<table border=0>
<tr><td colspan=2><img src="gif/edit_psd.gif" width=380 height=29><br>
<center><FONT FACE="Helvetica" size=1>(Both CDS ID and password are case
sentitive.)</td></tr>
<tr><td></td></tr>
<tr><td><FONT FACE="Helvetica" size=2><b>CDS ID:</TD>
<td><input type=text name=profs size=20></td>
</tr>
<tr><td><FONT FACE="Helvetica" size=2><b>Password:</TD>
<td><input type=password name=password size=20></td>
</tr>
</table>
</form>
</body>
</html>
------Perl code------------------------------
#!/usr/local/bin/perl -w
#use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $query = new CGI;
my ($dbh, $stmt);
my $profs = $query->param("profs");
my $password = $query->param("password");
# check profs, password, and authorization
$dbh = DBI->connect("fsddv","permeation","testdb","Oracle");
$stmt = "select count(*) from security where cds='$profs' and
password='$password'";
my $sth = $dbh->prepare($stmt);
$sth->execute();
my $in = $sth->fetchrow();
$sth->finish();
$dbh->disconnect;
if ($in == 1){&print_result;}
else {&error;}
sub error{
print $query->header;
print $query->start_html(-title=>'Personnel Development
Planning',
-bgcolor=>'white');
print "<br><br><br>
<FONT FACE=Helvetica SIZE=4 color=red><center>
profs is $profs<br>password is $password<br>
Your access was denied.</font><br><br><br>\n";
print $query->end_html;
exit (0);
}
sub print_result{
print $query->header;
print $query->start_html(-title=>'Personnel Development Planning
Main Page');
print "<body background=\"/lia_hr/gif/homeback.gif\">";
print "profs is $profs<br>password is $password<br>";
print "<table border=0>";
print "<tr><td rowspan=11 valign=top><a
href=\"http://hub.visteon.com\">
<img src=\"/lia_hr/gif/visteon.gif\" width=104 height=66
HSPACE=10 alt=\"Visteon Intranet Hub\" border=0></a></td>";
print "<td><center><img src=\"/lia_hr/gif/main_ttl.gif\" width=462
height=81></td></tr>";
print "<tr><td><br></td></tr>
<tr><td><br></td></tr>";
print "<tr><td><center>
<table border=0>
<tr><td><img src=\"/lia_hr/gif/select_op.gif\" width=393
height=29></td></tr>
<tr><td></td></tr>
<tr><td><center>
<table border=0>
<form method=post
action=\"http://ac4297.scii.visteon.com:9400/perl/lia_hr/search_input.pl\">
<input type=hidden name=profs value=$profs>
<input type=hidden name=password value=$password>
<tr><td><img src=\"/lia_hr/gif/search_off.gif\" width=175
height=25 border=0></td>
<td><input type=submit value=Select></td>
</form>
</table>
</td></tr>
<tr><td><center>
<table border=0>
<form method=post
action=\"http://ac4297.scii.visteon.com:9400/perl/lia_hr/edit_input.pl\">
<input type=hidden name=profs value=$profs>
<input type=hidden name=password value=$password>
<tr><td><img src=\"/lia_hr/gif/edit_off.gif\" width=175
height=25 border=0></td>
<td><input type=submit value=Select></td>
</form>
</table>
</td></tr>
<tr><td><center>
<table border=0>
<form method=post
action=\"http://ac4297.scii.visteon.com:9400/perl/lia_hr/delete_input.pl\">
<input type=hidden name=profs value=$profs>
<input type=hidden name=password value=$password>
<tr><td><img src=\"/lia_hr/gif/delete_off.gif\" width=175
height=25 border=0></td>
<td><input type=submit value=Select></td>
</form>
</table>
</td></tr>
<tr><td><center>
<table border=0>
<form method=post
action=\"http://ac4297.scii.visteon.com:9400/perl/lia_hr/dataentry.pl\">
<input type=hidden name=profs value=$profs>
<input type=hidden name=password value=$password>
<tr><td><img src=\"/lia_hr/gif/data_off.gif\" width=175
height=25 border=0></td>
<td><input type=submit value=Select></td>
</form>
</table>
</td></tr>
</table>
</td></tr>";
print "</table>";
print $query->end_html;
exit(0);
}
------------------------------
Date: 8 Jun 2000 20:45:37 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: How to clean up previous data when you re-enter the same form
Message-Id: <8hp0lh$3g9tu$1@fu-berlin.de>
hi,
In comp.lang.perl.misc Lisa Shieh <sshieh2@visteon.com> wrote:
> The problem is that I type user name "abcd" and password "1234" in html
> the first time and hit submit. Perl will give me an error message as it
> suppose to do. Then, I click "back" go back to html and enter another
> user name "xyz" and password "0987". The user name and password that
> Perl get will still be "abcd" and "1234". How can I clean up the
> previous data?
are you using apache? then do not use mod_perl.
for further information check the server doku.
and don't post so much html-code. at least not
in a perl newsgroup
tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3293
**************************************