Re: Form parameter as filename?

2002-01-07 Thread Rob Cottingham

Thanks for the suggestion, Fliptop.  Someone finally pointed out my problem:
data tainting was on, and I had to untaint the data before Perl would let me
use it in something as exposed as a filename.

Whew!!

Cheers,
--rob


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




RE: scheduling

2002-01-07 Thread Matthew Keen

Camilo,

What operating System are you ftp'ing from ???

-Original Message-
From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 8 January 2002 9:46 AM
To: '[EMAIL PROTECTED]'; Camilo Gonzalez
Cc: [EMAIL PROTECTED]
Subject: RE: scheduling


How can I find out about cron?

-Original Message-
From: fliptop [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 4:30 PM
To: Camilo Gonzalez
Cc: [EMAIL PROTECTED]
Subject: Re: scheduling


Camilo Gonzalez wrote:

> Anyone know of a module or method that will run a Perl script on a given
> time each day? I need to FTP a file from one site to another daily and I
was
> hoping to automate it.


can you write a cron job to do it?

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


IMPORTANT NOTICE:
This e-mail and any attachment to it is intended only to be read or used by
the named addressee.  It is confidential and may contain legally privileged
information.  No confidentiality or privilege is waived or lost by any
mistaken transmission to you.  If you receive this e-mail in error, please
immediately delete it from your system and notify the sender.  You must not
disclose, copy or use any part of this e-mail if you are not the intended
recipient.  The RTA is not responsible for any unauthorised alterations to
this e-mail or attachment to it.  


IMPORTANT NOTICE:
This e-mail and any attachment to it is intended only to be read or used by
the named addressee.  It is confidential and may contain legally privileged
information.  No confidentiality or privilege is waived or lost by any
mistaken transmission to you.  If you receive this e-mail in error, please
immediately delete it from your system and notify the sender.  You must not
disclose, copy or use any part of this e-mail if you are not the intended
recipient.  The RTA is not responsible for any unauthorised alterations to
this e-mail or attachment to it.  

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




Cookies and SSI

2002-01-07 Thread Robert Howard

If a script is being called as a Server Side Include, is it still possible
to set and read cookies from within the script? Problem I am running into is
that the header of the main html is read before my script, so no cookies are
set by using print header (-cookie => $session_cookie).

R.A. Howard


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




Re: 2 Q's, Google and Me - can you spell it out?

2002-01-07 Thread Curtis Poe

--- Henk van Ess <[EMAIL PROTECTED]> wrote:
> Dear all,
> 
> They told me that this forum teaches Perl in a friendly atmosphere, so I
> hope you can help me. My name is Henk van Ess and I run www.voelspriet.nl, a
> Dutch site about searchengines (non-commercial).
> 
> I'm busy with a form for searching all kind of special operators in search
> engines and I want to do that job with radioboxes.
> 
> One radiobox should give the following output:

I'm not sure if you mean radion *button* or *check* box.  I am guessing the latter, 
but what I
present will work either way.
 
> http://www.google.com/search?q(FIXED VALUE)+(VARIABLE)
> 
> where FIXED VALUE= allintitle: and the VARIABLE is the search term that the
> user enters.
> 
> EXAMPLE:
> 
> Say someone searches for the word Perl and checks the radiobox "Search title
> only", I will need the output:

Without reproducing the rest of your email, I'll cut to the chase :)  Unless you use 
Javascript,
you are trying to combine to form parameter values into one and you can't do that 
directly from
the form (that I know of).  Here's one way to do this through Perl:

#!/usr/bin/perl -wT
use strict;
use CGI qw/:standard/;
use URI::Escape;

# if we came from the form, grab the values and create the URL
if ( param )
{
# get the form data
# see perldoc CGI
my $_prefix = param( 'prefix' ) || '';
my $_search = param( 'search' ) || '';

# untaint it
# see perldoc perlsec
my ( $prefix ) = ( $_prefix =~ /^([a-zA-Z\d\s_:]+)$/ ); #create appropriate 
regex
my ( $search ) = ( $_search =~ /^([a-zA-Z\d\s_:]+)$/ ); #create appropriate 
regex

# escape characters with special meaning in URIs
# see perldoc URI::Escape
$prefix = uri_escape( $prefix );
$search = uri_escape( $search );
print redirect( "http://www.google.com/search?q=$prefix%20$search"; );
}
# otherwise, print the Web page
else
{
print header;
print 



Test page



 All in 
title





END_HTML
}

It works this way:  if we have no form parameters, print the Web page.  If we have form
parameters, grab them, untaint them, convert any characters that may have a special 
meaning in a
URL, and the do a redirect.  All relevant section have pointers to the correct 
documentation.

Obviously, you'll need more than this, but I hope this is a good starting point.

Hope this helps.

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[2]: Curtis Poe Script/Lesson Questions

2002-01-07 Thread K.L. Hayes

Hello Mr. Poe & All,

Thank you very much for your articulate & thorough answers. I'm sure
you've enlightened others as well with your response.

I'm a Site Designer turning Perl Hacker over the last 5-6 months &
I'm just concerned about being dangerous in the transition. IMO It's
better that I ask questions & do the homework than to risk my clients
data & servers.

Your contributions to this list and online lessons are of great help.

Thank You!

Best regards,
K.L. Hayes

Monday, January 07, 2002, 2:24:42 PM, you wrote:

CP> --- "K.L. Hayes" <[EMAIL PROTECTED]> wrote:
>> 17:  if ( $tainted_username =~ /^([a-zA-Z\d_]+)$/ )
>> 18:  {
>> 19:  $username = $1;
>> 20:  }
>> 21:  else
>> 22:  {
>> 23:  display_page( $message );
>> 24:  exit;
>> 25:  }
>> 
>> OK... The questions...
>> 
>> 1. Why doesn't "use strict" complain about the $1 not being declared?

CP> "use strict", amongst other things, complains about misspelled lexical variables 
or misspelled
CP> global variables that have been declared with the "use vars" pragma or the new 
"our" keyword (tip:
CP>  "use vars" is better than "our").  The "dollar digit" variables (excluding $0, 
which is the
CP> program name) are special global variables built into Perl.  These variables 
contain the
CP> corresponding subpattern that has been matched in the last successful regex match. 
 Since they are
CP> built into Perl, they do not need to be declared (kind of like $_, @_, etc.).

CP> One important thing to note, though, is that you should usually localize these 
variables if used
CP> in a subroutine.

CP> sub foo
CP> {
CP> my $data = shift;
CP> local $1;
CP> return $1 if $data = /(bar)/;
CP> }

CP> That's important because someone calling your subroutine may also be doing regex 
matching and may
CP> depend on the value of $1, so you don't want to step on this value (of course, 
this is typically
CP> true of all Perl built-in globals).  See 'perldoc -f local' for more information.

>> 2. How can I filter ALL of my form input variables with this regex? Or
>> maybe better asked; How can this be WRITTEN to filter ALL of my form
>> variables at once?

CP> Check out the Untaint or CGI::Untaint modules.  Also, future versions of my 
CGI::Safe module (also
CP> on the CPAN) will include this functionality.

CP> Cheers,
CP> Curtis "Ovid" Poe

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

CP> __
CP> Do You Yahoo!?
CP> Send FREE video emails in Yahoo! Mail!
CP> http://promo.yahoo.com/videomail/



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




RE: scheduling

2002-01-07 Thread Camilo Gonzalez

How can I find out about cron?

-Original Message-
From: fliptop [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 4:30 PM
To: Camilo Gonzalez
Cc: [EMAIL PROTECTED]
Subject: Re: scheduling


Camilo Gonzalez wrote:

> Anyone know of a module or method that will run a Perl script on a given
> time each day? I need to FTP a file from one site to another daily and I
was
> hoping to automate it.


can you write a cron job to do it?

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




Re: scheduling

2002-01-07 Thread fliptop

Camilo Gonzalez wrote:

> Anyone know of a module or method that will run a Perl script on a given
> time each day? I need to FTP a file from one site to another daily and I was
> hoping to automate it.


can you write a cron job to do it?


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




2 Q's, Google and Me - can you spell it out?

2002-01-07 Thread Henk van Ess

Dear all,

They told me that this forum teaches Perl in a friendly atmosphere, so I
hope you can help me. My name is Henk van Ess and I run www.voelspriet.nl, a
Dutch site about searchengines (non-commercial).

I'm busy with a form for searching all kind of special operators in search
engines and I want to do that job with radioboxes.

One radiobox should give the following output:

http://www.google.com/search?q(FIXED VALUE)+(VARIABLE)

where FIXED VALUE= allintitle: and the VARIABLE is the search term that the
user enters.

EXAMPLE:

Say someone searches for the word Perl and checks the radiobox "Search title
only", I will need the output:

http://www.google.com/search?q=allintitle%3A+perl

EXTRA INFO:

The form/script I want to make is intended to reduce typing. If someone
searches for the title of the
webpageon Google normally, he will have to enter:

allintitle: (search term)

With the form/script the user will have to check the radiobox "Search title
only", type the search term and voila, there's the answer.

WHAT I DID TILL NOW:

As you see I will have to use the name="q" for input twice. I think I've got
some wonderfull advice, but I can't bake a cake of the snippets people have
sent me. It feels that I'm so close.

Here is the HTML I started with:



http://www.google.nl/search"; target="_blank">



 
Search a title of a
webpage only






THIS IS THE ANSWER I'VE GOT:

(cut)

You are attempting to drive the Google search
directly from your form, with no intervening CGI script of your own. In that
case, you are limited to the variable names and values understood by the
Google script and have no capability to combine values as needed to compose
the URL you want.

With your own CGI script, it's fairly simple. Assume you've named that 
button as "prefix".

$host="www.google.nl";
$q = param('q');
$prefix = param('prefix');
$q = $prefix . "%3A+" . $q;
...
... deal with num, nl, and so on
...
$url = "http://$host?q=$q&num=$num...";;
print "Location: $url\n\n"; # redirect

so you've just reformatted the variables sent from the user's form into the
URL needed to drive the Google search. (The use of the param() function is
common to several CGI libraries...you may have to use something slightly
different, depending on which library you chose to use -- you definitely
want to use a CGI library rather than rolling your own from scratch.)

Prefix might not be checked. In that case, you'd not want to do the line

$q = $prefix . "%3A+" . $q;

so change that to be:

$q = $prefix . "%3A+" . $q if $prefix;

(cut)

BACK TO MY QUESTION
--

Can someone spell it out for me what I have to put in the HTML-code and what
exactly in the .cgi or .pl??

What do i put in the HTML to get the CGI running? SO what do I put here:

Search a title of a
webpage only

to link the HTML to the CGI?

And how does the CGI look? How do I start and end that script? Can you write
it out for me?

I will credit you on my site for helping me... so be prepared to get famous
:)

Henk van Ess
www.voelspriet.nl


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




scheduling

2002-01-07 Thread Camilo Gonzalez

Anyone know of a module or method that will run a Perl script on a given
time each day? I need to FTP a file from one site to another daily and I was
hoping to automate it.

if ( $Camilo_Gonzalez && $Web_Developer ) {
 Taylor Johnson Associates;
 [EMAIL PROTECTED]  ;
 www.taylorjohnson.com  ;
}

 



Re: Re[2]: Curtis Poe Script/Lesson Questions

2002-01-07 Thread Curtis Poe

--- "K.L. Hayes" <[EMAIL PROTECTED]> wrote:
> Hello Jonathan & All,
> 
> Thank you for taking the time to answer. I "thought" that the $1 was
> locally scoped but didn't want to "assume" it. Better not to assume
> things with Perl has been my experience.

See my previous reply to your question.  $1 is a built-in global and will not be 
"locally scoped"
unless you declare it as such.
 
> I don't fully understand the trinary operator. However I'll research
> this tonight.

Pseudo-code:

if "x is true" ? do this : else do this;

same as:

if ( "x is true" )
{
do this
}
else
{
do this instead
}

I tend to use trinary operators a lot.  But don't use them if you don't like them. :)

> My main concern was that I didn't want people to be able to gain any
> access to my server using my form as a gateway. Is there a better way
> to filter/secure input to my script when using CGI.pm? Is the input
> automagically filtered when using CGI.pm? I'm not finding anything
> about this subject in the CGI.pm docs. Am I not looking hard enough?

CGI.pm does not filter anything for you (well, you can set the $CGI::POST_MAX variable 
to limit
posting size, but that's not quite what you were asking).  There has been some 
additional
discussion of security regarding this lesson in my course.  You can find this 
dicussion at
http://www.perlmonks.org/index.pl?node_id=136655 and at
http://www.perlmonks.org/index.pl?node_id=136864.  These get a little deep, though.

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 FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: Curtis Poe Script/Lesson Questions

2002-01-07 Thread Curtis Poe

--- "K.L. Hayes" <[EMAIL PROTECTED]> wrote:
> 17:  if ( $tainted_username =~ /^([a-zA-Z\d_]+)$/ )
> 18:  {
> 19:  $username = $1;
> 20:  }
> 21:  else
> 22:  {
> 23:  display_page( $message );
> 24:  exit;
> 25:  }
> 
> OK... The questions...
> 
> 1. Why doesn't "use strict" complain about the $1 not being declared?

"use strict", amongst other things, complains about misspelled lexical variables or 
misspelled
global variables that have been declared with the "use vars" pragma or the new "our" 
keyword (tip:
 "use vars" is better than "our").  The "dollar digit" variables (excluding $0, which 
is the
program name) are special global variables built into Perl.  These variables contain 
the
corresponding subpattern that has been matched in the last successful regex match.  
Since they are
built into Perl, they do not need to be declared (kind of like $_, @_, etc.).

One important thing to note, though, is that you should usually localize these 
variables if used
in a subroutine.

sub foo
{
my $data = shift;
local $1;
return $1 if $data = /(bar)/;
}

That's important because someone calling your subroutine may also be doing regex 
matching and may
depend on the value of $1, so you don't want to step on this value (of course, this is 
typically
true of all Perl built-in globals).  See 'perldoc -f local' for more information.

> 2. How can I filter ALL of my form input variables with this regex? Or
> maybe better asked; How can this be WRITTEN to filter ALL of my form
> variables at once?

Check out the Untaint or CGI::Untaint modules.  Also, future versions of my CGI::Safe 
module (also
on the CPAN) will include this functionality.

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 FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re[2]: Curtis Poe Script/Lesson Questions

2002-01-07 Thread K.L. Hayes

Hello Jonathan & All,

Thank you for taking the time to answer. I "thought" that the $1 was
locally scoped but didn't want to "assume" it. Better not to assume
things with Perl has been my experience.

I don't fully understand the trinary operator. However I'll research
this tonight.

My main concern was that I didn't want people to be able to gain any
access to my server using my form as a gateway. Is there a better way
to filter/secure input to my script when using CGI.pm? Is the input
automagically filtered when using CGI.pm? I'm not finding anything
about this subject in the CGI.pm docs. Am I not looking hard enough?

Again, thank you for your time & help.

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

+=+
+ "Only two things are infinite, the universe and +
+ human stupidity, and I'm not sure about the former."+
+ -- Albert Einstien  +
+=+

Monday, January 07, 2002, 1:50:39 PM, you wrote:

>> 1. Why doesn't "use strict" complain about the $1 not
>> being declared?

JEP> $1, $2 etc are locally scoped variables which come from the
JEP> regex.  A regex like:

JEP> m/(..)(.*)/

JEP> will place the first two characters into $1, and the rest
JEP> into $2 - according to the parathesis.

>> 2. How can I filter ALL of my form input variables with
>> this regex? Or maybe better asked;  How can this be
>> WRITTEN to filter ALL of my form variables at once?

JEP> Usually you don't want to use the same one for all,
JEP> although you can.  Do something like:

JEP> foreach ($value1, $value2, $value3) {
JEP>   /^()$/ ? $_=$1 : undef $_;
JEP> }

JEP> The ? : is a special trinary operator which effectively
JEP> does:

JEP> if (...)   {...} else {...}
JEP>(...) ? {...}  :   {...}

JEP> Take care,

JEP> Jonathan Paton

JEP> __
JEP> Do You Yahoo!?
JEP> Everything you'll ever need on one web page
JEP> from News and Sport to Email and Music Charts
JEP> http://uk.my.yahoo.com



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




Re: Curtis Poe Script/Lesson Questions

2002-01-07 Thread Jonathan E. Paton

> 1. Why doesn't "use strict" complain about the $1 not
> being declared?

$1, $2 etc are locally scoped variables which come from the
regex.  A regex like:

m/(..)(.*)/

will place the first two characters into $1, and the rest
into $2 - according to the parathesis.

> 2. How can I filter ALL of my form input variables with
> this regex? Or maybe better asked;  How can this be
> WRITTEN to filter ALL of my form variables at once?

Usually you don't want to use the same one for all,
although you can.  Do something like:

foreach ($value1, $value2, $value3) {
  /^()$/ ? $_=$1 : undef $_;
}

The ? : is a special trinary operator which effectively
does:

if (...)   {...} else {...}
   (...) ? {...}  :   {...}

Take care,

Jonathan Paton

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




Curtis Poe Script/Lesson Questions

2002-01-07 Thread K.L. Hayes

Hello All,

I was looking over the lesson posted by Curtis Poe & have questions I
hope somebody (maybe Mr. Poe?) can help with.

The lesson is posted here:
http://www.easystreet.com/~ovid/cgi_course/lesson_four/lesson_four_2.html

The code in question is this piece here:

17:  if ( $tainted_username =~ /^([a-zA-Z\d_]+)$/ )
18:  {
19:  $username = $1;
20:  }
21:  else
22:  {
23:  display_page( $message );
24:  exit;
25:  }

OK... The questions...

1. Why doesn't "use strict" complain about the $1 not being declared?

2. How can I filter ALL of my form input variables with this regex? Or
maybe better asked; How can this be WRITTEN to filter ALL of my form
variables at once?

Any & all enlightenment is welcome & appreciated. Thank you in advance
for your time.

-- 
Best regards,
K.L. Hayes
mailto:[EMAIL PROTECTED]

+=+
+ "Only two things are infinite, the universe and +
+ human stupidity, and I'm not sure about the former."+
+ -- Albert Einstien  +
+=+



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




Re: File Upload via URL

2002-01-07 Thread Brent Michalski


If i remember correctly, this is also not allowed.  It would be a big
security risk to allow something like this.  The same goes for the "file
upload" box that you put on an HTML form...  You cannot prefill the values
in it.


Brent




   

"Rafala,   

Michael" To: [EMAIL PROTECTED]

  Subject: File Upload via URL  

   

01/07/02   

01:04 PM   

   

   





I want to call my file upload cgi program and upload a file via a URL
rather
than using a Form on a Web page.

My script works via the upload form, which looks like this:






But when I try this URL:

http:\\myServer\cgi-bin\upload.cgi?upload_file="c:\myfile"

the script gets the filepath, but can't read the original file. I'm sure it
has to do with the get/post thing, but I can't figure out how to get around
it. Is there something I can do to either the URL or the script to
accomplish this? Is it even possible?

mike rafala
rafala m at cadmus com

--
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: File Upload via URL

2002-01-07 Thread Curtis Poe

--- "Rafala, Michael" <[EMAIL PROTECTED]> wrote:
> I want to call my file upload cgi program and upload a file via a URL rather
> than using a Form on a Web page.
> 
> My script works via the upload form, which looks like this:
> 
> 
> 
> 
> 
> 
> But when I try this URL:
> 
> http:\\myServer\cgi-bin\upload.cgi?upload_file="c:\myfile"
> 
> the script gets the filepath, but can't read the original file. I'm sure it
> has to do with the get/post thing, but I can't figure out how to get around
> it. Is there something I can do to either the URL or the script to
> accomplish this? Is it even possible?
> 
> mike rafala
> rafala m at cadmus com

This is because, if you use the URL, you are automatically using a GET request with
enctype="x-www-form-urlencoded".  File uploads only work with a POST request,
enctype="multipart/form-data".  This is a common cause of bugs in file upload routines.

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 FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




File Upload via URL

2002-01-07 Thread Rafala, Michael

I want to call my file upload cgi program and upload a file via a URL rather
than using a Form on a Web page.

My script works via the upload form, which looks like this:






But when I try this URL:

http:\\myServer\cgi-bin\upload.cgi?upload_file="c:\myfile"

the script gets the filepath, but can't read the original file. I'm sure it
has to do with the get/post thing, but I can't figure out how to get around
it. Is there something I can do to either the URL or the script to
accomplish this? Is it even possible?

mike rafala
rafala m at cadmus com

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




Parsing url from html content

2002-01-07 Thread Özgür ÖZTÜRK

With the following code i want to get the url of the first link (which come 
from a query at google.com).
My target token is
http://www.hotmail.com/>
and i want to get
http://www.hotmail.com
from there, but my program get the first letter "a". I couldn't find any way 
to access the rest of the token. Any one can do that ?


#!/usr/local/bin/perl

use LWP::UserAgent;
use HTML::TokeParser;

$tokencounter=0;

print "Content-type:text/html\n\n";

$options{"agent"}="Mozilla/4.6 [en] (XII; I; SunOS 5.7 sun4u)";
my $agent=new LWP::UserAgent(%options);
$request=new HTTP::Request('GET'=>
 "http://www.google.com/search?hl=tr&q=hotmail&lr=";);
$response=$agent->request($request);
$response->is_success() || die("error".$response->status_line())."\n";

$page=new HTML::TokeParser(\($response->content()));

while($token=$page->get_token()){
  $type=shift(@$token);
  $text=shift(@$token);
  if($type eq "S" and $text eq ("p" or "P")){
$tokencounter=$tokencounter+1;
if($tokencounter eq 2){
  $token=$page->get_token();
  $token=$page->get_url();
  $type=shift(@$token);
  $text=shift(@$token);
  print $text;
  print "\n";
}
  }
}



_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




fulltext search on a cd

2002-01-07 Thread Bernd Lach

Hello, 

I maybe have a little bit tricky question (for me at least):

I want to create a fulltext search possibility in a web project 
that should be stored on a cd-rom.
the web project consists of html files.
The fulltext search should search in all that documents.
as result there should be a list of links that contain the word 
that was searched for.

Is there any possibility to create a standalone search engine in 
perl that runs without launching a server application on the cd-
rom (if this is possible at all)??
or any other suggestions?

Bernhard


__
Einmal schenken, 12mal auspacken - Kurzweilige Zeitschriften-Abos:
http://www.lycos.de/webguides/entertainment/weihnachten/abo.html
Jetzt eigene Domains für 2,50 DM/Monat
http://lycos.de.domainnames.com/default.asp?caller=lycos_d_footer





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


Re: Form parameter as filename?

2002-01-07 Thread fliptop

Rob Cottingham wrote:

> I'm trying to use a parameter passed from a CGI form as the basis of a
> filename:
> 
>my $file_location = "/home2/samuel-c/HTML/alex/urltest/";
>my $filename=param('category');
>my $fileid=$file_location.'urls_'.$filename;
> 
>open(ULL, ">>$fileid") || die "Can't open the URL file: $! \n";
> 
> Doesn't work worth a damn.  (The "category" parameter is a keyword, like
> "intro".)  But if I use this line instead to define $fileid...
> 
>my $fileid="/home2/samuel-c/HTML/alex/urltest/urls_intro;
> 
> ...then it works like a charm.  I've also tried this with a keyword read in
> from a text file; that didn't work either.  Any suggestions?


where does it fail?  do you get a reason from $! if it dies at the open?

also, you may want to try this:

use Data::Dumper;

my $file_location = "/home2/samuel-c/HTML/alex/urltest/";
my $filename=param('category');
my $fileid=$file_location.'urls_'.$filename;

warn "fileid: ", Dumper($fileid);

and see what the value of $fileid is.


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




Editing Virtusertable

2002-01-07 Thread insomniak

Hi All,
I'm working on a project that involves editing some files on a mail server
(running on Solaris)

e.g.
/etc/mail/access
/etc/mail/virtusertable

When the contents of either of these files are updated I have to run makemap
hash etc... (to compile a Berkley .db file)
My question is; Can I simply use DBI (or similar) to edit the .db file
directly avoiding the need to run makemap after each edit?

Has anyone done anything similar or even any ideas to point me in the right
direction?

Regards
Mark Kneen


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




Re: CGI perl html urgent

2002-01-07 Thread Carl Franks

   print <
   
   EndHTML9
 
When you do this, there must be no spaces before the EndHTML9
i.e.

   print <
   
EndHTML9


Hope this helps,
Carl Franks

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




Form parameter as filename?

2002-01-07 Thread Rob Cottingham



Hi, all --

I'm trying to use a parameter passed from a CGI form as the basis of a
filename:

   my $file_location = "/home2/samuel-c/HTML/alex/urltest/";
   my $filename=param('category');
   my $fileid=$file_location.'urls_'.$filename;

   open(ULL, ">>$fileid") || die "Can't open the URL file: $! \n";

Doesn't work worth a damn.  (The "category" parameter is a keyword, like
"intro".)  But if I use this line instead to define $fileid...

   my $fileid="/home2/samuel-c/HTML/alex/urltest/urls_intro;

...then it works like a charm.  I've also tried this with a keyword read in
from a text file; that didn't work either.  Any suggestions?

Thanks,
--rob


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