RE: cgi script that takes in data then runs script on different host

2002-05-28 Thread David Gray

First of all, don't cross-post please. One list is quite sufficient, and
many people are subscribed to more than one list, so duplicate messages
are quite often completely ignored.

 I've got a cgi form that takes in data.  Then, I want the 
 data to be passed to a script that's waiting on a DIFFERENT host.
 
 So, say I have this pseudo-code:
 
 cgi script on host 1pass $name to host 2  script on host 2
 # get $name ---  print 
 hi there $name!\n;

Could you pass $name in the query string? Like this:

 --script 1--
 #!/usr/bin/perl -w
 use strict;
 use CGI;
 my $cgi = new CGI;

 my %F = ();
 # get all values passed to this script
 # assuming no multi-valued form elements
 $F{$_} = $cgi-param($_) for $cgi-param();

 # rebuild the query string to stick on the
 # end of whatever script you want to send
 # these values to
 my $query_string = '?';
 $query_string .= $_=$F{$_}\ for keys %F;

 my $host2 = 'http://www.host2.com/script.cgi';
 print Location:$host2$query_string\n\n;
 --end script 1--


 --script 2--
 #!/usr/bin/perl -w
 use strict;
 use CGI;
 my $cgi = new CGI;

 my %F = ();
 # get all values passed to this script
 # assuming no multi-valued form elements
 $F{$_} = $cgi-param($_) for $cgi-param();

 # print them to make sure they're there
 print 'pre';
 print \$F{$_} == $F{$_}\n for keys %F;
 print '/pre';

 # do stuff with the values passed to the first script
 --end script 2--

HTH,

 -dave



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




calculate dates

2002-05-28 Thread Sven Bentlage

Hi !
I'm trying to get all the date values for the week (7days) ahead of a 
specified date.
To get the current date I use : 
my ($d, $m, $y) = (localtime)[3,4,5];
my $date = sprintf(%02d-%02d-%02d, 
$d, $m+1, $y-100);
To get the date of the date 7 days ahead I use:
my ($da, $ma, $ya) = (localtime (time+ 
(7*24*60*60)))[3,4,5];
my $next_date = 
sprintf(%02d-%02d-%02d, $da, $ma+1, $ya-100);

Now I would like to get all the dates between $date and $next_date to 
print out information for each day.
Does anyone know a simpler way than calculating each day individually?

Thanks for your tips in advance.

Sven


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




[OT] Web Hosting

2002-05-28 Thread Glenn Cannon

Hi All,

I know this is kind of topic, but I figured with all the CGI experience
I have seen on this list, someone must have already been through this
situation.

I am a website developer who builds sites for local
business/groups/individuals.  Many of the people I build for are then
looking for a company to host the site for them.

I know I have seen companies that sell webspace, and for a nominal fee
allow you to add extra domains within that same HD space.

Does anyone know of such a company, and if so, would you recommend using
them?

As this is OT, it is probably best if all emails are aimed at me
directly at [EMAIL PROTECTED] rather than back to the list.

Many thanks for the time you spent reading this, and many more thanks in
advance for your replies.

Glenn Cannon


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




Re: calculate dates

2002-05-28 Thread fliptop

Sven Bentlage wrote:

 I'm trying to get all the date values for the week (7days) ahead of a 
 specified date.


try date::calc

http://search.cpan.org/search?dist=Date-Calc


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




Using strict and configuration files

2002-05-28 Thread Octavian Rasnita

Hi all,

I want to use:

use strict;

And I want to use a configuration file in a Perl script.
The configuration file uses:
%page1=(

);

%page2=(

);

This way I get errors if I run the script because the variables are not
defined with my.

I've tried putting in the configuration file:

my %page1=(

);

But this method doesn't work.

I use a configuration file and I would like to put the settings only in this
file without modifying the script.

Is it possible?

Thanks.

Teddy,
[EMAIL PROTECTED]



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




What type of end of line is this?

2002-05-28 Thread Octavian Rasnita

Hi all,

I've made a little experiment.
I made a simple form with a textarea field.
I've typed a single digit in that field and I have submitted the form.
It was a single digit, with no enter after it.

I've saved the field to a file.
The file has 3 bytes instead of 1 (for a LF) or 2 for CRLF.

I am using Internet Explorer.

Can you tell me what kind of end of line is this?

The code was:

$text = $q - param ('text');
print FILE $text;

I've opened the file in binary mode to see what are the codes of these
characters, and they are:
0D 0D 0A

This means 013 013 010

It is a kind of CR/CR/Lf?

Thank you!

Teddy,
[EMAIL PROTECTED]




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




Verifying the CONTENT_LENGTH

2002-05-28 Thread Octavian Rasnita

Hi all,

I've made a script for uploading files.

I want to verify the CONTENT_LENGTH. I know how to do it and it works.

The problem is that for verifying the CONTENT_LENGTH, the page visitor
should wait a long time if the file is bigger, like the time for uploading
the file.

The visitor may not like to hear that the file is too big after they wait a
lot to upload it.

The main code I use for this is:
$file = $q - param ('file'};
$dir_max_size = ...;
$buffer = $ENV{CONTENT_LENGTH};

if ((dir_size + $buffer)  $dir_max_size) {

}

dir_size is a function that gets the size of all files from the output
folder.

Do I have a faster option for telling the visitor if a file is too big?

I have also tried to use:

$buffer = -s $file;
This is more precise, but it works  very slow also.

Note: I've tried using the functions for uploading from CGI module, but with
no good results in Windows 2000, and that's why I want to write my code.

Thank you for any idea.

Teddy,
[EMAIL PROTECTED]




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




Re: cgi script that takes in data then runs script on different host

2002-05-28 Thread Todd Wade


Simon K. Chan [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 cgi script on host 1pass $name to host 2  script on host 2
 # get $name ---  print hi there
$name!\n;

Somewhere at the top of scriptOnHost1.cgi say:

use CGI;
my($q) = CGI-new();

and then when you are ready, say:

print $q-redirect( http://www.host2.com/scriptOnHost2.pl?name=$name; );

and your all set.

Todd W.



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