why oh why?

2002-09-18 Thread Jimmy George

Hello again World

I am trying - half heartily right now - to get a DDMM or similar date
back from a users server to write to a file when they fill in an order
form. My first attempt of :-

!--#config timefmt=%d%b%y--
input type=hidden name=submit_date value=lt;--#echo
var=quot;LOCAL_TIMEquot; --gt;

inside the forms shtml page gives an error from the server I check it
on. The rest of the form is OK with this cut out.

This shtml page calls a cgi script that simply writes the form content
to a secure file on the users website and sends a thank you message. I
have not yet been able to get the server I am hosted from to give me a date!!

It did take me a week to realise that despite what some books say you DO
have to have shtml on some machines when SSI is being used. I need some
sites to look at for more information I think - or some stupidly simple
piece of cgi that writes today's date to a file when it closes.

GOOD beginners work.

TIA

JimmyG

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




Hotmail.com vs. MIME:Lite

2002-09-18 Thread Sven Bentlage

Hi everyone,

(thanks for your tips, Scot).

I managed to get my script working.
It sends a HTML mail via MIME::Lite, with a.txt attachment. All mail 
clients I tested worked just fine.
The only problem is Hotmail.com!!
Hotmail.com neither displays the HTML mail, nor am I able to download 
the txt attachment. Hotmail.com tells me, there is a virus in the txt 
attachment.. ???
Hotmail.com does display plain text messages.

I got no idea what to do or how to solve it.
(RIght now I`m using a little sub checking whether it's a hotmail 
address and sending only plain text to hotmail, while sending  html to 
all others)

Does anyone have an idea how to solve that problem?


Thanks for your help,

Sven
On Montag, September 16, 2002, at 06:48  Uhr, Scot Robnett wrote:

 Yes, you can send text attachments. It's all documented at the link I 
 included in the last message...

 Scot R.




 -Original Message-
 From: Sven Bentlage [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 15, 2002 7:42 AM
 To: [EMAIL PROTECTED]
 Subject: SMTP/HTML/TEXT


 Hi everyone,
 I encountered another problem with my mailscript.
 Hotmail.com users and some people who use strange mail clients don't
 get anything displayed at all.
 is there anyway to send a html mail via MIME::Lite with an attached
 text part of it?

 Thanks for your help.

 Sven
 On Donnerstag, September 12, 2002, at 01:46  Uhr, Scot Robnett wrote:

 #!/usr/bin/perl -w

 # Link for Sven:
 # http://search.cpan.org/author/ERYQ/MIME-Lite-2.117/lib/MIME/Lite.pm


 # Send HTML document with inline images

 # MIME::Lite a purely perly sorta thing, so
 # if it's not installed in @INC we can put
 # it there without problems

 BEGIN {
  unshift(@INC,/path/to/our/own/modules);
 }

 use strict;
 use MIME::Lite;

 # Create a new MIME Lite object
 my $msg = MIME::Lite-new(
From='[EMAIL PROTECTED]',
To  ='[EMAIL PROTECTED]',
Subject ='Hi',
Type='multipart/related');

 # Add the body to your HTML message
 $msg-attach(Type = 'text/html',
  Data = qq{ BODY BGCOLOR=#FF
  H2Hi/H2
   P ALIGN=left
This is an HTML message.
   /P
   P ALIGN=left
A HREF=http://foo123.com/;Here's a link/A.
   /P
   P ALIGN=middle
IMG SRC=cid:img.jpg;
   /P
   /BODY });

 # Attach the image
 $msg-attach(Type = 'image/gif',
  Id   = 'img.gif',
  Path = '/path/to/img.gif');

 # Send it
 $msg-send();


 -
 Scot Robnett
 inSite Internet Solutions
 [EMAIL PROTECTED]
 http://www.insiteful.tv



 -- 
 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: why oh why?

2002-09-18 Thread William McKee

On 18 Sep 2002 at 18:09, Jimmy George wrote:
 I am trying - half heartily right now - to get a DDMM or similar date
 back from a users server to write to a file when they fill in an order
 form. My first attempt of :-

I'm not sure what you're doing with the SSI but here's some code to help 
munge a date into the format you're after:

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = 
localtime(time);
my $fulldate = sprintf %4d/%02d/%02d\n, 1900+$year, $mon+1, $mday;
my $daymon = sprintf %02d/%02d, $mon+1, $mday;

See sprintf (perldoc -f sprintf) for details about the formatting options 
of the input string.


Hope that helps,
William

-- 
 Lead Developer
 Knowmad Services Inc. || Internet Applications  Database Integration
 http://www.knowmad.com
 


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




Creating thumbnails (Newbie Question)...

2002-09-18 Thread Yuen, Alex

Hi,

Very newbie.

I was wondering if it is possible to write a CGI (Perl) program to make a
thumbnail page for my website.

If so, how would I start and use for doing this?

Thanks.

Alex


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




Re: Creating thumbnails (Newbie Question)...

2002-09-18 Thread fliptop

On Wed, 18 Sep 2002 at 09:56, Yuen, Alex opined:

YA:I was wondering if it is possible to write a CGI (Perl) program to make a
YA:thumbnail page for my website.
YA:
YA:If so, how would I start and use for doing this?

if you question is how to create a thumbnail from a regular image, then 
you could use ImageMagick.

http://www.imagemagick.org
http://search.cpan.org/author/LGODDARD/Image-Magick-Thumbnail-0.01/




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




RE: Creating thumbnails (Newbie Question)...

2002-09-18 Thread Yuen, Alex

One part is to create a thumbnail image from a regular image.

Second part is to create a web page or thumbnail page for viewing. Maybe 10
to 20 images per page.

Thanks.

Alex


 --
 From: fliptop[SMTP:[EMAIL PROTECTED]]
 Sent: Wednesday, September 18, 2002 10:52 AM
 To:   Yuen, Alex
 Cc:   'Perl Beginners - CGI'
 Subject:  Re: Creating thumbnails (Newbie Question)...
 
 On Wed, 18 Sep 2002 at 09:56, Yuen, Alex opined:
 
 YA:I was wondering if it is possible to write a CGI (Perl) program to make
 a
 YA:thumbnail page for my website.
 YA:
 YA:If so, how would I start and use for doing this?
 
 if you question is how to create a thumbnail from a regular image, then 
 you could use ImageMagick.
 
 http://www.imagemagick.org
 http://search.cpan.org/author/LGODDARD/Image-Magick-Thumbnail-0.01/
 
 
 

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




Re: Creating thumbnails (Newbie Question)...

2002-09-18 Thread Gary Stainburn

On Wednesday 18 Sep 2002 2:56 pm, Yuen, Alex wrote:
 Hi,

 Very newbie.

 I was wondering if it is possible to write a CGI (Perl) program to make a
 thumbnail page for my website.

 If so, how would I start and use for doing this?

 Thanks.

 Alex

Hi Alex,

Here's a script based on one I was given a while back.  This is a command-line 
one but should easily be convertable to a CGI.

#!/usr/bin/perl
use strict;

use Image::Magick;

my $im = Image::Magick-new;

umask 0022;

# if passed filenames use them, otherwise do all
my @names = @ARGV ? @ARGV : grep { -f and -B } *;

for (@names) {# foreach name
  if (/ /) {  # if name contains a space
my $old = $_;
tr, ,_,s; # change spaces to _
$_ .= .jpg unless /\.jpg$/; # append .jpg if missing
! -e and rename $old, $_ or next; # skip file if rename fails
warn renaming $old to $_\n;
  }
  next if /\.thumb\.jpg$/;# skip if this is thumbnail
  my $thumb = $_.thumb.jpg;
  next if -e $thumb;  # skip if thumbnail exists
  undef @$im; # reset (part of) $im
  my $ret;
  $ret = $im-Read($_)# read file 
and warn($ret), next; # or fail and skip
  $ret = $im-Scale(geometry = '100x100')
and warn($ret), next;
  $ret = $im-Write($thumb)
and warn($ret), next;
  warn thumbnail made for $_\n;
}


-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 


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




Date Question(s)

2002-09-18 Thread [EMAIL PROTECTED]

Hello everyone.

I have a situation involving the DATE and DATE COMPARISON functions which I 
need some guidance on.

The situation is this:

1. The end-users who visit my Site are allowed to ask a participating 
medical expert, one medical question per month.  However, some are abusing 
this situation requiring me to build a 1 per month filter in the CGI Perl 
program.

2. I envision that when a person asks a question, his email address and 
date are first checked against the names listed within a text log file, and 
if it isn't listed, append that information to the file.

3. If, however, that person did ask a question within the one month time 
period, a comparison would take place between between the current date, and 
the date listed in the text log file ... and the newest question would be 
rejected.

My problem with this scenario involves my lack of knowledge in --

A. ... first converting a current system date to a string date (which can 
be appended to a text log file).
B. ... or comparing the logged initial-question date with the current 
system date to determine if 30 days have gone by since the initial question.

Any ideas on how to do this?

Thanks in advance for any clues, Al

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




Re: why oh why?

2002-09-18 Thread Michael Kelly

On Wed, Sep 18, 2002 at 06:09:29PM +1000, Jimmy George wrote:
 Hello again World

Hi Jimmy,

 I am trying - half heartily right now - to get a DDMM or similar date
 back from a users server to write to a file when they fill in an order
 form. My first attempt of :-
 
 !--#config timefmt=%d%b%y--
 input type=hidden name=submit_date value=lt;--#echo
 var=quot;LOCAL_TIMEquot; --gt;

First: SSI is _Server_-Side Includes. That means it's parsed on the server,
before it ever gets to the user. Therefore, you can't HTML-escape your SSI
directives, because, as far as the server's concerned, gt; has nothing
whatsoever to do with . And anyway, even though the SSI directive is
inside a quoted string, that directive will never reach the user, so it
needs no escaping.

Second: HTML comments (and therefore SSI directives as well) start with !--.

Third: I believe the variable you're looking for is DATE_LOCAL.

This version of the above code works OMM (and on my server):

!--#config timefmt=%d%b%y--
input type=hidden name=submit_date value=!--#echo var=DATE_LOCAL --

Ugly, yes, but it works.

If you want a purely

 inside the forms shtml page gives an error from the server I check it
 on. The rest of the form is OK with this cut out.
 
 This shtml page calls a cgi script that simply writes the form content
 to a secure file on the users website and sends a thank you message. I
 have not yet been able to get the server I am hosted from to give me a date!!
 
 It did take me a week to realise that despite what some books say you DO
 have to have shtml on some machines when SSI is being used. I need some
 sites to look at for more information I think - or some stupidly simple
 piece of cgi that writes today's date to a file when it closes.

Try this: http://httpd.apache.org/docs/howto/ssi.html

 GOOD beginners work.
 
 TIA
 
 JimmyG

Hope that helps,
-- 
Michael

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




RE: Hotmail.com vs. MIME:Lite

2002-09-18 Thread Scot Robnett

It sounds like you solved the problem already by sending text/plain messages
to Hotmail accounts. For some reason I've never had an issue with that,
though - maybe it's because I don't actually attach the image that is placed
inline; I import it from a location on my website. You could also try
forcing base64 or quoted-printable encoding. For example:

#!/usr/bin/perl -w

use strict;
use MIME::Lite;

my $msg = MIME::Lite-new(
  From ='[EMAIL PROTECTED]',
  To   ='[EMAIL PROTECTED]',
  Subject  ='Hello again',
  Type ='multipart/related',
  Encoding ='base64'
 # or
 #Encoding ='quoted-printable'
);
$msg-attach(Type = 'text/html',
  Data = qq{ BODY BGCOLOR=#FF
H2This is a header./H2
PThis is another test./P
BR
IMG SRC=http://path/to/the/image.gif; # not attached
/BODY }# but imported
);   # from website

$msg-send();


# -
# Scot R.
# inSite

# P.S. You're going to try to wrestle Microsoft?
# (they own Hotmail)
# See where it got the Justice Department? grin



-Original Message-
From: Sven Bentlage [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 5:02 AM
To: [EMAIL PROTECTED]
Subject: Hotmail.com vs. MIME:Lite


Hi everyone,

(thanks for your tips, Scot).

I managed to get my script working.
It sends a HTML mail via MIME::Lite, with a.txt attachment. All mail
clients I tested worked just fine.
The only problem is Hotmail.com!!
Hotmail.com neither displays the HTML mail, nor am I able to download
the txt attachment. Hotmail.com tells me, there is a virus in the txt
attachment.. ???
Hotmail.com does display plain text messages.

I got no idea what to do or how to solve it.
(RIght now I`m using a little sub checking whether it's a hotmail
address and sending only plain text to hotmail, while sending  html to
all others)

Does anyone have an idea how to solve that problem?


Thanks for your help,

Sven
On Montag, September 16, 2002, at 06:48  Uhr, Scot Robnett wrote:

 Yes, you can send text attachments. It's all documented at the link I
 included in the last message...

 Scot R.




 -Original Message-
 From: Sven Bentlage [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 15, 2002 7:42 AM
 To: [EMAIL PROTECTED]
 Subject: SMTP/HTML/TEXT


 Hi everyone,
 I encountered another problem with my mailscript.
 Hotmail.com users and some people who use strange mail clients don't
 get anything displayed at all.
 is there anyway to send a html mail via MIME::Lite with an attached
 text part of it?

 Thanks for your help.

 Sven
 On Donnerstag, September 12, 2002, at 01:46  Uhr, Scot Robnett wrote:

 #!/usr/bin/perl -w

 # Link for Sven:
 # http://search.cpan.org/author/ERYQ/MIME-Lite-2.117/lib/MIME/Lite.pm


 # Send HTML document with inline images

 # MIME::Lite a purely perly sorta thing, so
 # if it's not installed in @INC we can put
 # it there without problems

 BEGIN {
  unshift(@INC,/path/to/our/own/modules);
 }

 use strict;
 use MIME::Lite;

 # Create a new MIME Lite object
 my $msg = MIME::Lite-new(
From='[EMAIL PROTECTED]',
To  ='[EMAIL PROTECTED]',
Subject ='Hi',
Type='multipart/related');

 # Add the body to your HTML message
 $msg-attach(Type = 'text/html',
  Data = qq{ BODY BGCOLOR=#FF
  H2Hi/H2
   P ALIGN=left
This is an HTML message.
   /P
   P ALIGN=left
A HREF=http://foo123.com/;Here's a link/A.
   /P
   P ALIGN=middle
IMG SRC=cid:img.jpg;
   /P
   /BODY });

 # Attach the image
 $msg-attach(Type = 'image/gif',
  Id   = 'img.gif',
  Path = '/path/to/img.gif');

 # Send it
 $msg-send();


 -
 Scot Robnett
 inSite Internet Solutions
 [EMAIL PROTECTED]
 http://www.insiteful.tv



 --
 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]


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




Re: Date Question(s)

2002-09-18 Thread William McKee

I'd suggest checking out Date::Manip from CPAN. I use it to do date 
comparisons in some of my scripts. Why do you need to convert the date 
when writing it to the file. Just save the epoch time and use Date::Manip 
to eval the epoch time in the file to the current epoch time.

William

-- 
 Lead Developer
 Knowmad Services Inc. || Internet Applications  Database Integration
 http://www.knowmad.com
 


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




Re: Date Question(s)

2002-09-18 Thread Wiggins d'Anconia

Date::Calc is a wonderful thing. If that doesn't work however I would 
suggest just storing the number of seconds from epoch (aka time) in the 
log file. Then you simply subtract 30 days worth of seconds aka,

60*60*24*30 seconds - which you can just use the constant for whatever 
that comes out to be (yeh I know I am on a computer but I am sure you 
can handle the simple math ;-))

from the current time in seconds from the epoch and if the time in the 
log is greater then it hasn't been 30 days.  Or you could do the 
reverse, tack on 30 days worth of seconds to the time in the log and if 
that is greater than the current time then it hasn't been 30 days, etc.

If you then need readable date/time strings for either time you can just 
localtime it.

http://danconia.org


fliptop wrote:
 On Wed, 18 Sep 2002 at 12:53, [EMAIL PROTECTED] opined:
 
 [snip]
 n:My problem with this scenario involves my lack of knowledge in --
 n:
 n:A. ... first converting a current system date to a string date (which can 
 n:be appended to a text log file).
 n:B. ... or comparing the logged initial-question date with the current 
 n:system date to determine if 30 days have gone by since the initial question.
 n:
 n:Any ideas on how to do this?
 
 have you looked into using date::calc?  it may be the answer to all your
 questions.
 
 http://search.cpan.org/author/STBEY/Date-Calc-5.1/
 
 


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




Re: why oh why?

2002-09-18 Thread Wiggins d'Anconia

I guess the question I have at this point is why pass the date to the 
form from the server and then back to a script when the end script could 
just as easily get the time using the *time* built in?

Browser window could be opened with the time being set by the server, 
two days later when the user returns to the open window and submits the 
form all of a sudden your submission date is from two days ago but it 
submitted today, this is ugly *unless* it is what you intend which could 
be I suppose.

http://danconia.org

Michael Kelly wrote:
 On Wed, Sep 18, 2002 at 06:09:29PM +1000, Jimmy George wrote:
 
Hello again World
 
 
 Hi Jimmy,
 
 
I am trying - half heartily right now - to get a DDMM or similar date
back from a users server to write to a file when they fill in an order
form. My first attempt of :-

!--#config timefmt=%d%b%y--
input type=hidden name=submit_date value=lt;--#echo
var=quot;LOCAL_TIMEquot; --gt;
 
 
 First: SSI is _Server_-Side Includes. That means it's parsed on the server,
 before it ever gets to the user. Therefore, you can't HTML-escape your SSI
 directives, because, as far as the server's concerned, gt; has nothing
 whatsoever to do with . And anyway, even though the SSI directive is
 inside a quoted string, that directive will never reach the user, so it
 needs no escaping.
 
 Second: HTML comments (and therefore SSI directives as well) start with !--.
 
 Third: I believe the variable you're looking for is DATE_LOCAL.
 
 This version of the above code works OMM (and on my server):
 
 !--#config timefmt=%d%b%y--
 input type=hidden name=submit_date value=!--#echo var=DATE_LOCAL --
 
 Ugly, yes, but it works.
 
 If you want a purely
 
 
inside the forms shtml page gives an error from the server I check it
on. The rest of the form is OK with this cut out.

This shtml page calls a cgi script that simply writes the form content
to a secure file on the users website and sends a thank you message. I
have not yet been able to get the server I am hosted from to give me a date!!

It did take me a week to realise that despite what some books say you DO
have to have shtml on some machines when SSI is being used. I need some
sites to look at for more information I think - or some stupidly simple
piece of cgi that writes today's date to a file when it closes.
 
 
 Try this: http://httpd.apache.org/docs/howto/ssi.html
 
GOOD beginners work.

TIA

JimmyG
 
 
 Hope that helps,


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




sort

2002-09-18 Thread Daniel Hurtado Brenner


Hi friend:
I want know if is possible to do this:

For example:
If i have a flat data base myfile.txt with this info:

1|name|address|
2|name two|address two|
3|name three|address three|
4|name four|address four|
. (etc, etc)

If i execute:

 open(IN,$myfile.txt);
 while(IN){
  @file=split(/\|/,$_);
If ($file[0] ne ){
print $field[0] | $field[1] | $field[2];
}
}
close (IN);

THE RESULTS IS:

1|name|address|
2|name two|address two|
3|name three|address three|
4|name four|address four|

OK. BUT HOW I CAN DO FOR THIS RESULTS BE:
4|name four|address four|
3|name three|address three|
2|name two|address two|
1|name|address|

??

Thanks
Daniel
(Excuse me my english)


result is: 






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




Re: Creating thumbnails (Newbie Question)...

2002-09-18 Thread Wiggins d'Anconia

Second part:

Depends on how complex you want your thumbnail page to be (of course).

Simplest might be to store all your thumbnails to a directory, do an 
opendir, then while readdir, print your image tag changing only the file 
name in each case.

To complicate matters, you can use the same Image::Magick module to read 
the thumbnail to generate the width/height tags on the fly though I 
would say that is probably overkill.  As for handling pages/numbered to 
display on each page, and stepping between them you are probably going 
to have to pass a couple of variables to the script, such as where to 
start displaying and how many to display. Or you could go the simple 
route and hard code the number shown, in which case you could just pass 
a page variable, either way you then generate the urls on the fly 
referencing previous,next,first,last, etc. So many options, 
so little time.

http://danconia.org



Yuen, Alex wrote:
 One part is to create a thumbnail image from a regular image.
 
 Second part is to create a web page or thumbnail page for viewing. Maybe 10
 to 20 images per page.
 
 Thanks.
 
 Alex
 
 
 
--
From: fliptop[SMTP:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 10:52 AM
To:   Yuen, Alex
Cc:   'Perl Beginners - CGI'
Subject:  Re: Creating thumbnails (Newbie Question)...

On Wed, 18 Sep 2002 at 09:56, Yuen, Alex opined:

YA:I was wondering if it is possible to write a CGI (Perl) program to make
a
YA:thumbnail page for my website.
YA:
YA:If so, how would I start and use for doing this?

if you question is how to create a thumbnail from a regular image, then 
you could use ImageMagick.

http://www.imagemagick.org
http://search.cpan.org/author/LGODDARD/Image-Magick-Thumbnail-0.01/



 
 


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




GPL - how does it work

2002-09-18 Thread Alex Agerholm

Hi,

I am quite new to Perl and GPL, so I hope that someone can help me or direct
me to where I can read about this.

I am writing a CGI application/script in Perl which I am going to sell
This application uses a few Perl modules (CGI.pm, Session.pm) which is
covered by the GPL.
How am I going to handle that, when I do not want to release my application
under GPL ?

In other words how can you use Perl modules under GPL in commercial
applications without making your application public ?

Thanks in advance
Alex



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