Closing Sendmail throws error?

2002-01-21 Thread Steven Vargas

Hi there, I'm getting this error message:
Error closing sendmail: at /webdocs/docs/clone/cgi-bin/sendoff.cgi line 48.

The email goes through successfully, but still get the error. Any help would
be greatly appreciated!

Thanks heaps.

Here's the snippet of code:
#!/usr/bin/perl -wT

use strict;
use CGI;
use CGI::Carp qw( fatalsToBrowser );


#Taint stuff, pretty standard
BEGIN {
$ENV{PATH} = "/bin:/usr/bin";
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV ) };
}

my $q   = new CGI;
my $email   = "foo.bar\@foobar.com";
my $message = "Hi there!\n\nThis is a test email";

send_feedback( $email, $message );


sub send_feedback {
my ($email, $message) = @_;

open MAIL, "| /usr/lib/sendmail -t -i" or die "Could not open sendmail:
$!";

print MAIL <


Re: [CGI] Using SSI in a CGI program

2002-01-21 Thread Marty Landman

At 02:51 PM 1/21/02 -0800, Troy May wrote:

>I have an HTML template which gets inserted into a CGI program.  I need to
>insert an SSI into it, but when the page is created it will not show up like
>it does with a standard HTML file.

Troy, this is because the server will not parse the page generated by a CGI 
for SSI statements. IOW the normal alternatives are :

-  SSI embedded in an SHTML or other admin defined filetype gets parsed & 
acted on accordingly before sending to the client

-  CGI link results in call to a program which creates the page on the fly 
which is then sent as is to the client

>   Do I need to do anything different to
>this to execute it correctly so it will work like a standard SSI on my page?
>Here's what I need to insert:
>
>

Sure, just stick the file into the template within your script.

Marty

Website Creation Made SIMPL(tm)
http://face2interface.com/Home/Demo.shtml
WebSafe Color Picker -- http://face2interface.com/WebSafe


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




RE: Using SSI in a CGI program

2002-01-21 Thread Hanson, Robert

The simple answer is that it won't work.  SSI's are handled by the web
server, and the web server will not parse your script output for them, it
will only parse HTML files (or shtml depending on your setup).

I've attached a module we use on occation for this specific purpose.  It
includes pod if you want the full explaination, but here is a summary.  It
currently handles virtual includes and execs.

use Apt::Utils qw/handleIncludes/;

my $html = ... # I assume you have the HTML in a var.
my $path = "/the/path/to/the/webserver/root/"

my $html = handleIncludes($html, $path);

Enjoy.

Rob

-Original Message-
From: Troy May [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 5:52 PM
To: Beginners CGI List
Subject: Using SSI in a CGI program


Hello,

I have an HTML template which gets inserted into a CGI program.  I need to
insert an SSI into it, but when the page is created it will not show up like
it does with a standard HTML file.  Do I need to do anything different to
this to execute it correctly so it will work like a standard SSI on my page?
Here's what I need to insert:



When I view source on the ending page of the CGI program I can see it there,
but it doesn't execute like it should.

Any ideas?

Thanks!


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




Utils.pm
Description: Binary data

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


RE: Using SSI in a CGI program

2002-01-21 Thread Camilo Gonzalez

Troy,

Not sure why you're doing that. SSI won't work on parsed pages. You're
already generating a page so why not include header.html in your template or
as a heredoc or open it as a filehandle and print it?

-Original Message-
From: Troy May [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 4:52 PM
To: Beginners CGI List
Subject: Using SSI in a CGI program


Hello,

I have an HTML template which gets inserted into a CGI program.  I need to
insert an SSI into it, but when the page is created it will not show up like
it does with a standard HTML file.  Do I need to do anything different to
this to execute it correctly so it will work like a standard SSI on my page?
Here's what I need to insert:



When I view source on the ending page of the CGI program I can see it there,
but it doesn't execute like it should.

Any ideas?

Thanks!


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




Using SSI in a CGI program

2002-01-21 Thread Troy May

Hello,

I have an HTML template which gets inserted into a CGI program.  I need to
insert an SSI into it, but when the page is created it will not show up like
it does with a standard HTML file.  Do I need to do anything different to
this to execute it correctly so it will work like a standard SSI on my page?
Here's what I need to insert:



When I view source on the ending page of the CGI program I can see it there,
but it doesn't execute like it should.

Any ideas?

Thanks!


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




Re: binmode with graphics, @ARGV, -T switch

2002-01-21 Thread Harvey Quamen

Briac:

Thanks so much for all the help and advice.  It's great to have a 
list like this, and I certainly appreciate the time you took to 
answer all my questions.  That particular example is A LOT clearer 
now, and I learned a lot from your email.  Thank you!

Harv Quamen

(P.S.  Sorry to take up bandwidth -- tried to do this off-list, but 
it bounced back.)

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




Re: mkdir in cgi-script

2002-01-21 Thread Curtis Poe

--- "Randal L. Schwartz" <[EMAIL PROTECTED]> wrote:
> > "Rene" == Rene Verharen <[EMAIL PROTECTED]> writes:
> 
> Rene> The (sub)dirs I want to create are input from a form, so I had to
> Rene> change your example a little because
> 
> Rene> my @dir=qw($FORM{'dir'});
> 
> No no no!  This is a security hole, unless you've also validated the
> data using code you didn't show.  Please either *say* that or *show*
> that... we have a lot of beginners looking over your shoulder.

The amusing thing is, in this tiny example, this winds up NOT being a security hole 
only because
the author forgot (or didn't know) that qw// does not interpolate variables (perldoc 
perlop):

$ perl -e '
$FORM{'dir'} = shift;
my @dir = qw($FORM{'dir'});
print "@dir\n$FORM{'dir'}"' 'rm -fr /'
$FORM{dir}
rm -fr /

Blind luck saves the day (though, to be fair, once that programmer realizes the 
problem, the fix
would probably introduce a security problem).

Cheers,
Curtis "Ovid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

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




Re: Return a ZIP file like this example with an image

2002-01-21 Thread Stephan Tinnemeyer

[EMAIL PROTECTED] wrote:
> 
> But how to do it with a .zip file?
> I've tried some different 'content-type' with no success...
> 

Did you try 'application/zip'?

Cheers

Stephan
-- 
Dipl.-Chem. Stephan Tinnemeyer
Lindenallee 20
24105 Kiel
Germany

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




Return a ZIP file like this example

2002-01-21 Thread thomas . carl . johansson



Hi,

I need help to return a winzip-file like I can do with an image like this code.

#!/usr/bin/perl

$source = "image.gif";
$status = "";
$file = "";

open (IMAGE, "<$source") or $status = "File not found!";
 $size = -s "$source";
 read (IMAGE, $file, $size);
close IMAGE;

if ($status ne "") {
  print "content-type: text/html\n\n";
  print $status;
}
else {
  print "content-type: image/gif\n\n";

  #print $size;
  print $file;
}



This returns an image just as you view it like : http://www.domain.com/image.gif


But how to do it with a .zip file?
I've tried some different 'content-type' with no success...

Regards
/Thomas J



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




Return a ZIP file like this example with an image

2002-01-21 Thread thomas . carl . johansson



Hi,

I need help to return a winzip-file like I can do with an image like this code.

#!/usr/bin/perl

$source = "image.gif";
$status = "";
$file = "";

open (IMAGE, "<$source") or $status = "File not found!";
 $size = -s "$source";
 read (IMAGE, $file, $size);
close IMAGE;

if ($status ne "") {
  print "content-type: text/html\n\n";
  print $status;
}
else {
  print "content-type: image/gif\n\n";

  #print $size;
  print $file;
}



This returns an image just as you view it like : http://www.domain.com/image.gif


But how to do it with a .zip file?
I've tried some different 'content-type' with no success...

Regards
/Thomas J



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