RE: form user interface issue

2003-04-02 Thread Hughes, Andrew
Okay, I think that I'm getting closer.  I've condensed my code so that it is
a little clearer.  

form method=post action=2003springcontest.pl onSubmit=return
submitIt(this)
input type=text name=check_email maxlength=60
input type=submit name=choice value=Check
/form

perl decision making code:

if ($choice eq ) {
checkemailform(); # displays form
}
elsif ($choice eq check) {
checkemail(); # inserts the data
}

Are you suggesting this for the form?:

form method=post action=2003springcontest.pl onSubmit=return
submitIt(this)
input type=text name=check_email maxlength=60
input type=hidden name=choice value=Check
input type=submit value=Check
/form

I took the name value out of the submit input tag and included a hidden
field that includes a the name choice and the value check, which is what I
logic code is looking for.  Do you think this is the correct path?

Thanks in advance.  I appreciate your input.

Thanks,
Andrew  


-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 11:01 AM
To: Hughes, Andrew; [EMAIL PROTECTED]
Subject: Re: form user interface issue


That form probably has a submit button that has a parameter name=
The script might be checking for that param('...').

If the form is submitted by pressing the button, that parameter from the
submit button is sent to the server while if the form is submitted by
pressing enter from another form field, it is not, so the script will fail
when checking for it.

The solution is to put another hidden field like input type=hidden
name=... value=... and remove the name=... parameter from the submit
tag.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: Hughes, Andrew [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 6:31 PM
Subject: form user interface issue


I have a form that I am using to add data to a mysql database table.  I am
using a .pl scrtipt to generate the html.  I am using cgi.pm and param() to
insert the form data.  And, I am using to the printHTML;  function to
display my forms within the .pl script.  The problem is that when the user
completes the form and hits the enter key (as opposed to the mouse to submit
the form), the form goes blank and nothing happens.  However, if a user uses
the mouse, everything works fine.

Please let me know what you think the problem is.  Any assistance would be
greatly appreciated.

Thanks,
Andrew

Here's the code:

..snip1..

my $choice = lc(param(choice));
my $check_email = WebDB::trim_and_collapse_whitespace
(lc(param(check_email)));

..snip1..

..snip2..
if ($choice eq ) {
checkemailform(); # displays form
}
elsif ($choice eq check) {
checkemail(); # inserts the data
}

..snip2..

..snip3..

sub checkemailform {

print Content-type:text/html\n\n;
print checkemailform;
html
head
titleInsider's Advantage/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
style type=text/css
!--
.main {font-family: Arial, Helvetica, sans-serif; font-size: 12px;
font-style: normal; font-weight: normal; color: #00;}
.mainsmall {font-family: Arial, Helvetica, sans-serif; font-size: 10px;
color: #00;}
.head {font-family: Arial, Helvetica, sans-serif; font-size: 14px;
font-weight: bold; color: #00;}

--
/style

SCRIPT LANGUAGE=JAVASCRIPT TYPE=TEXT/JAVASCRIPT
function submitIt(form) {
if (!validEmail(form.check_email.value)) {
alert(Invalid AOLTW Business E-Mail Address.)
form.check_email.focus()
form.check_email.select
return false
}
}

function validEmail(check_email) {
invalidChars =  /:,;

if (check_email ==) {
return false
}
for (i=0; iinvalidChars.length;
i++) {
badChar = invalidChars.charAt(i)
if (check_email.indexOf(badChar,0) 
-1) {
return false
}
}
atPos = check_email.indexOf(@,1)
if (atPos == -1) {
return false
}
if (check_email.indexOf(@,atPos+1) 
-1) {
return false
}
periodPos = check_email.indexOf(.,atPos)
if (periodPos == -1) {
return false
}
if (periodPos+3  check_email.length)  {
return false
}
return true

} //end validEmail
/SCRIPT

/head

body bgcolor=#FF text=#00 leftmargin=0 topmargin=0
marginwidth=0 marginheight=0
form method=post action=2003springcontest.pl onSubmit=return
submitIt(this)
  table width=500 border=0 align=center cellpadding=2
cellspacing=0
tr
  td colspan=2 class=main align=centerimg
src=http://insidersadvantage.com/images/promotions/2003brochure/signup_head
.jpg border=0/td
/tr
tr
  td colspan=2 class=mainPlease enter your work email address
below so that we may determine whether or not you are an E-Club member.
/td
/tr
tr
  td colspan=2 class=main* i bIndicates a required
field./b/i/td
/tr
tr
  td width=175 align=right class=mainWork Email Address:/td
  td width=325 class=main input type=text name=check_email
maxlength=60
*/td
/tr
tr
  td colspan=2 align=centerinput type=submit name=choice
value=Check
  /td
/tr
tr
  td colspan=2 

self refreshing web page question

2003-04-02 Thread Luinrandir Hernsen
I want to create a web page that calls on another web page and automatically
refresh the other webpage every minute. can I do this in JS alone? Perl
alone? or do I have to use both?

Thanks for the help, I just need to be pointed in a direction...

Lou


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Forcing a refresh from within a CGI script

2003-04-02 Thread Bob Showalter
Rob Dixon wrote:
 Hi all.
 
 I'm in the process of modifying an existing CGI script. There is a
 page of HTML which has an anchor to the script which, when run,
 modifies the HTML file which linked to it and redisplays it. At
 present this is done by returning just the header line
 
 Location: http://www.domain.com/referrer.htm
 
 to the client after modifying the file.
 
 Firstly, I'm not at all sure if this is the preferred way to force a
 refresh, and secondly it doesn't always work as the client browser
 believes it has a valid cached copy of the page and refuses to reload
 it. 
 
 Can someone help me towards a better solution?

To prevent the client from using its cached copy, you'll need to have the
server send an Expires header with the .html page. This can be accomplished
by adding

   meta http-equiv=Expires content=0

in the head section of the .html file. (RFC 2616 specifies that clients
must treat an expires value of 0 as already expired.)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: self refreshing web page question

2003-04-02 Thread Bob Showalter
Luinrandir Hernsen wrote:
 I want to create a web page that calls on another web page and
 automatically refresh the other webpage every minute. can I do this
 in JS alone? Perl alone? or do I have to use both?
 
 Thanks for the help, I just need to be pointed in a direction...

You can have a page refresh itself by emitting a Refresh response header.

To have one page refreshing another you'll need to have the pages in
separate frames or windows and use JavaScript to trigger the refreshing.

I find the following site helpful for little JavaScript snippets for this
kind of thing:

http://developer.irt.org/script/script.htm

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Removing all \n in a text file.

2003-04-02 Thread Scot Robnett
By writing it this way:

open(OUTPUTFILE, . $outputFile);

the script thinks that you are trying to open a file called

Out_input2.txt

with the greater than sign actually being part of the file name. But what
you want to do is open

Out_input2.txt

for writing, in which case the greater than sign, which means open this
file for writing, needs to be contained inside the quotes.

open(OUTPUTFILE, $outputFile);


Scot R.
inSite



-Original Message-
From: Daniel Gross [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 1:07 PM
To: 'Scot Robnett'
Subject: RE: Removing all \n in a text file.


Hi Scot,

Thanks for your help. I am not sure in what way this code differs from
my previous one. Is the change in the open statement significant wrt to
how \n are read and written.


Thanks

Dani




-Original Message-
From: Scot Robnett [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 1:42 PM
To: Daniel Gross; [EMAIL PROTECTED]
Subject: RE: Removing all \n in a text file.


What if you made just this small change to your code?


my $INPUTFILEHANDLE;
my $OUTPUTFILEHANDLE;
my $outputFile = Out_input2.txt; # If this is not in the
   # same directory as your
   # script, make sure that
   # you use the full path

open (INPUTFILEHANDLE, input.txt); # When in doubt, full path

# This is what you had:
# open (OUTPUTFILEHANDLE, . $outputFile);
# Instead, I think you want

open (OUTPUTFILEHANDLE, $outputFile); # overwrites file
# open (OUTPUTFILEHANDLE, $outputFile); # would append instead

while(INPUTFILEHANDLE) {

  chomp $_; # just added $_ to make it
# explicit what we're chomping

  print OUTPUTFILEHANDLE $_;
}

close OUTPUTFILEHANDLE;
close INPUTFILEHANDLE;



# Scot R.
# inSite


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: The very un-useful 'premature end of script headers' error message

2003-04-02 Thread Scot Robnett
Not really. If your form allows uploads, your form allows uploads. That's
where DoS comes into play. Disguising the location of your code is a start,
but you still have to figure out what you're going to do if someone tries to
paste rogue code into your form or hit you with an obnoxiously large upload.
CGI.pm does have some provisions for this built in, and I highly recommend
its use for web forms as opposed to home-grown CGI. I believe many others on
the list recommend the same

Scot R.



Well, does it help that this code snippet we have been looking at is not in
a file with a .cgi or .pl extension, but in a .pm file being used by the
actual .cgi file that people would be posting to.  Jes' curious..
Thanks 4 All
Luke




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



warning message

2003-04-02 Thread Christopher G Tantalo
Hello,
In a recent perl script I wrote, I have a procedure, read_config(),
which reads a
config file I have set up and sets a hash to what is in the file.  Now,
before you
mention it, I have stricts on and use the -w on the 1st line, and the
following
message appears.

main::read_config() called too early to check prototype at
./eleadtest.pl line 19.

What does this mean?  Code snippets of the procedure call, and the
procedure itself
are below.

#!/home/ctantalo/perl5/bin/perl -w
#
# Programmer: Chris Tantalo
#
# This program will call eleadsht.sqt and email the eleadsht.lis file
# based on the data in the dmg.eleadsht_parameters table
#
# $Version_id = @(#) elead.pl [@@/main/dec02_corp_sup/1] ;

use strict;
use Mail::Sender;
use DBI;

# check to see if test machine(cad2) or production(sam)
my $node = `hostname`;
chomp $node;

our %hash;
read_config($node);
snip

# the read_config procedure
sub read_config()
{
my $node = shift @_;
my $cfg_file = ;
my $key;
my $value;

$cfg_file = /opt/appl/hrstmk/bin/elead.cfg if($node eq sam);

$cfg_file = /usr/appl/cad/prod/hrstmk/bin/elead.cfg if($node
eq cad2);
open(CFG_FILE,$cfg_file) ||die cannot open $cfg_file for
reading:$!;

while(CFG_FILE)
{
next if($_ =~ /^#/);
($key,$value) = split(/=/,$_);
$hash{$key}=$value;
}

close(CFG_FILE);
}

TIA,
Chris

--
---
Just Your Friendly Neighborhood
_SPIDEY_
--
Anything added after this was added by my mail server and not me.
--


-
The information contained in this message may be privileged, confidential, and 
protected from disclosure. If the reader of this message is not the intended 
recipient, or any employee or agent responsible for delivering this message to the 
intended recipient, you are hereby notified that any dissemination, distribution, or 
copying of this communication is strictly prohibited. If you have received this 
communication in error, please notify us immediately by replying to the message and 
deleting it from your computer. 

Thank you. Paychex, Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: warning message

2003-04-02 Thread Ken Lehman
looks like you tried to call the sub before you defined it, try putting a
definition just below all the use statements or just move the whole sub up
there
-Ken

-Original Message-
From: Christopher G Tantalo [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 3:43 PM
To: [EMAIL PROTECTED]
Subject: warning message


Hello,
In a recent perl script I wrote, I have a procedure, read_config(),
which reads a
config file I have set up and sets a hash to what is in the file.  Now,
before you
mention it, I have stricts on and use the -w on the 1st line, and the
following
message appears.

main::read_config() called too early to check prototype at
./eleadtest.pl line 19.

What does this mean?  Code snippets of the procedure call, and the
procedure itself
are below.

#!/home/ctantalo/perl5/bin/perl -w
#
# Programmer: Chris Tantalo
#
# This program will call eleadsht.sqt and email the eleadsht.lis file
# based on the data in the dmg.eleadsht_parameters table
#
# $Version_id = @(#) elead.pl [@@/main/dec02_corp_sup/1] ;

use strict;
use Mail::Sender;
use DBI;

# check to see if test machine(cad2) or production(sam)
my $node = `hostname`;
chomp $node;

our %hash;
read_config($node);
snip

# the read_config procedure
sub read_config()
{
my $node = shift @_;
my $cfg_file = ;
my $key;
my $value;

$cfg_file = /opt/appl/hrstmk/bin/elead.cfg if($node eq sam);

$cfg_file = /usr/appl/cad/prod/hrstmk/bin/elead.cfg if($node
eq cad2);
open(CFG_FILE,$cfg_file) ||die cannot open $cfg_file for
reading:$!;

while(CFG_FILE)
{
next if($_ =~ /^#/);
($key,$value) = split(/=/,$_);
$hash{$key}=$value;
}

close(CFG_FILE);
}

TIA,
Chris

--
---
Just Your Friendly Neighborhood
_SPIDEY_
--
Anything added after this was added by my mail server and not me.
--


-
The information contained in this message may be privileged, confidential,
and protected from disclosure. If the reader of this message is not the
intended recipient, or any employee or agent responsible for delivering this
message to the intended recipient, you are hereby notified that any
dissemination, distribution, or copying of this communication is strictly
prohibited. If you have received this communication in error, please notify
us immediately by replying to the message and deleting it from your
computer. 

Thank you. Paychex, Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Why this perl error?

2003-04-02 Thread Octavian Rasnita
I guess it is a Perl 5.8 bug because this didn't happen in Perl 5.6.1.
Or, ... it might be a DBI module error, but I don't think so.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

- Original Message -
From: Peter Kappus [EMAIL PROTECTED]
To: 'Octavian Rasnita' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 9:20 PM
Subject: RE: Why this perl error?


Hi teddy,

I ran into this exact same problem (on win2k using DBI and fork()) and
eventually gave up.  Alas.   Someone more knowledgable will have to give us
a definative answer but my primitive understanding is that fork() typically
uses the system's implementation of the fork() command and that Windows
doesn't have one :(

So, efforts have been made to implement it at the interpreter level with
limited success.  You might look into Win32::Process but I hear it's slow.
I do know that perl6 is supposed to have robust thread support natively, but
I don't know much about it.  (again...any gurus that can help us?)

check out:
http://aspn.activestate.com/ASPN/Mail/Message/perl-win32-porters/1178773
and
http://perlmonks.thepen.com/181655.html

There seems to be a lively discussion on threadding and forking, etc. right
here at perl.org on the perl-ithreads list.

here's the archive:
http://archive.develooper.com/[EMAIL PROTECTED]/msg88946.html

Please let me (and all of us) know if you get to the bottom of this...


Thanks and Good luck (we're all counting on you ;-)

-Peter

-Original Message-
From: Octavian Rasnita [mailto:[EMAIL PROTECTED]
Subject: Why this perl error?

The error is:
perl.exe - Application Error The instruction at 0x28068533 referenced
memory at 0x0004. The memory could not be read. Click on OK to
terminate the program Click on CANCEL to debug the program OK Cancel

I am running Windows 2000, Apache 2.4 web server, and Perl 5.8.

I've discovered that each time I use the fork() function in a program where
I also use use DBI, it gives me that error.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: portability question...IIS Vs. Apache

2003-04-02 Thread Gunther Birznieks
IIS thinks the CWD is the root directory of the script alias. Just set 
up a script alias that points to the directory where the cgi actually is 
and you'll be fine.

Peter Kappus wrote:

Hey all,

Anyone move scripts between IIS and Apache or need to write scripts that
work on both?  The problem I'm facing is that IIS reports the current
working directory (CWD) as the root dir of the application as defined in
the IIS control panel while apache reports the CWD as the actual directory
of the script file itself.
This is a problem when including other files/modules...

For example, to include /myApp/func.pl from /myApp/index.pl:

require func.pl;#works fine in Apache but not IIS
require /myApp/func.pl; #works for IIS
ditto for modules:

require myMods::myModule.pm;#works in Apache
require myApp::myMods::myModule.pm; #works in IIS
aarrggh.  I'd rather not add a big block like:

if(-e func.pl){
require func.pl;
}else{
require /myApp/func.pl;
}
at the top of every file and I don't even know if that would work...

Anybody got a more elegant solution? (other than dump IIS ;-)

Thanks!
-Peter
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]