Re: conecting cgi and mdb? help please:)
At 13:43 17/04/02, you wrote: >I have install ActivePerl 5.6.1.630 in folder c:\perl >then I have run ppm and do the fallowing: > >PPM> install dbi >Install package 'dbi?' (y/N): y >Installing package 'dbi'... >Error installing package 'dbi': Could not locate a PPD file for package dbi >PPM> This operation is case-sensitive -- you need to type 'install DBI'. best, Mo Mo Holkar Undying King Games [EMAIL PROTECTED] Free games! at http://www.ukg.co.uk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Parsing variables and HTML
Hello All, I am having a little bit of trouble with HTML and perl. I want to be able to parse variable from some HTML code where a user hits a submit button and the data they entered from that from should be parsed to the next sub. At the moment I am using the following code... $action = param("action"); $crud1 = param("crud1"); $crud2 = param("crud2"); $crud3 = param("crud3"); if ($action =~ /first/) {first();} elsif ($action =~ /second_sub/) {second_sub();} else{ first();} sub first { print< #User enters data in some text boxes here... HTML } # Script is now taken to second_sub(); sub second_sub { print $crud1, $crud2, $crud3; } but for some reason the the data from first() is not being placed into second_sub(); Should I be adding some more hidden HTML tags in the first(); sub? Any help on this would be greatly appricated. Regards, Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: uploadfile cgi
Oops wrong error this is the error I get from my webserver [Wed Apr 17 04:24:24 2002] [error] [client 217.129.197.231] Premature end of script headers: /home/formprof/public_html/cgi-bin/manage.pl Pedro Santos _ ArteVirtual, Exploração de Tecnologias de Informação e Comunicação Pedro Costa & Santos,Lda. Rua Barro Branco, Bustelo Apartado 256 3720 Oliveira de Azeméis Tel. (351)256602395 - (351)962836722 www.artevirtual.pt [EMAIL PROTECTED] _ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
What does this error mean?
Hi all, I have the following error: [Wed Apr 17 06:31:08 2002] [error] (26)Text file busy: exec of /var/www/teddy/cgi-bin/test.pl failed What does it mean "text file busy"? I've just made a test perl file with cat command, gave it the 755 rights, then I used a sync command but it doesn't want to work. The shebang line is ok, and it just prints the "Context-type: text/html\n\n"; and another line of text. What could be the problem? Thanks. Teddy, [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
uploadfile cgi
Hi could someone tell me what's wrong with this cgi please Every time I try to run the next script througha form I get a 500 Internal Server Error and my http log(apache) gives me this error: [Wed Apr 17 04:08:27 2002] [error] [client 217.129.197.231] script not found or unable to stat: /home/formprof/public_html/cgi-bin/manage.pl here's the script: #!/usr/bin/perl -w use strict; use CGI; use Fcntl qw( :DEFAULT :flock); use constant UPLOAD_DIR => "/home/formprof/public_html/cgi-bin/uploads"; use constant BUFFER_SIZE => 16_384; use constant MAX_FILE_SIZE => 24_288; #Limit each upload to 1mb use constant MAX_DIR_SIZE => 100 * 524_288; #Limit total uploads to 100mb use constant MAX_OPEN_TRIES => 100; $CGI::DISABLE_UPLOADS = 0; $CGI::POST_MAX = MAX_FILE_SIZE; my $q = new CGI; $q->cgi_error and error( $q, "Error tranfering file: " . $q->cgi_error); my $file = $q->param( "file" ) || error( $q, "No file received."); my $filename = $q->param( "filename" ) || error( $q, "No filename entered" ); my $fh = $q->upload( $file ); my $buffer = ""; if ( dir_size( UPLOAD_DIR ) + $ENV{CONTENT_LENGTH} > MAX_DIR_SIZE ) { error( $q, "Upload directory is full." ); } #Allow letters, digits, periods, underscores, dashes #Convert anything else to an underscore $filename =~ s/[^\w.-]/_/g; if ( $filename =~/^(\w[\w.-]*)/ ) { $filename = $1; } else { error( $q, "Invalid file name; files must start with a letter or number."); } #Open output file, making sure the name is unique until ( sysopen OUTPUT, UPLOAD_DIR . $filename, O_CREAT | O_EXCL ) { $filename =~ s/(\d*)(\.\w+)$/($1||0) + 1 . $2/e; $1 >= MAX_OPEN_TRIES and error( $q, "Unable to save your file." ); } #This is necessary for non-Unix systems; does nothing on Unix binmode $fh; binmode OUTPUT; #Write contents to output file while ( read( $fh, $buffer, BUFFER_SIZE ) ) { print OUTPUT $buffer; } close OUTPUT; sub dir_size { my $dir = shift; my $dir_size = 0; #Loop trough files and sum the sizes; doesn't descend down suddirs opendir DIR, $dir or die "Unable to open $dir: $!"; while ( readdir DIR ) { $dir_size += -s "$dir/$_"; } return $dir_size; } sub_error { my( $q, $reason ) = @_; print $q->header( "text/html" ), $q->start_html( "Error" ), $q->h1( "Error" ), $q->p( "Your upload was not processed because the following error accured: "), $q->p( $q->i( $reason ) ), $q->end_html; exit; } Thanks Pedro Santos _ ArteVirtual, Exploração de Tecnologias de Informação e Comunicação Pedro Costa & Santos,Lda. Rua Barro Branco, Bustelo Apartado 256 3720 Oliveira de Azeméis Tel. (351)256602395 - (351)962836722 www.artevirtual.pt [EMAIL PROTECTED] _ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Definition
It just makes dealing with quotes alot easier. And you don't need to escape the extra quotes within it. For example, print "value=\"true\""; print qq!value="true"!; print qq/value="true"/; are all the same. The qq uses the next character instead of the " character. Then you must end the line with the same character you started with. (qq!!, qq//, qq~~) Sorry, it's hard to explain in an email. -Original Message- From: Bill Lyles [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 16, 2002 7:31 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Definition Ok, Sorry about that Anyway what do you mean perldoc -f qq? what does the ~qq mean? - Original Message - From: "fliptop" <[EMAIL PROTECTED]> To: "Bill Lyles" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 16, 2002 8:53 PM Subject: Re: Definition > Bill Lyles wrote: > > > href="file://C:\Program Files\Common Files\Microsoft Shared\Stationery\"> > > As I am somewhat new to perl > > > > can someone tell me what this means > > > > $header = qq~ > > > > I understand the header but what is the qq~ for? > > > perldoc -f qq > > btw, it's considered bad form to send html-ized email to the list. > > > -- > 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: Perl CGI with ISP - advice?
I cannot answer these questions, as I am facing exactly the same situation and have exactly the same set of question myself -- so I will be monitoring closely for any answers! However, as per CGI.pm, I do know that on Tripod/Lycos accts, they install CGI.pl and a number of Tripod*.pl modules for you (optionally). If they do any registration or just copy the files, I don't know, but the text of these install pages indicates that they are just copied to /cgi-bin, nothing more. My new (DomainAvenue*) host also supports PHP4, which I am just now looking at. Quite frankly, for what I want to do (and am currently doing using SSI) this looks like a better initial choice -- I may need additional Perl scripts, but with the MySQL support, more C-like syntax, scripts embedded in HTML & Perl-like regexp support, this LOOKS more accessible to me (with a C++, Java, 4-GL programming background, Win-centric & lite on Unix shell scripts & a lot of SSI-enabled HTML pages to enhance incrementally.) Also, if you're using (client-side) Win (or Linux or Mac, I guess), download ActiveState's Perl && Komodo (v1.1 is free for edu / learning / home purposes). Komodo is a Win IDE w/ Perl / PHP / more develop / debugging support. I just dl'd and, initially, it looks GREAT!! http://www.activestate.com *DomainAvenue.com offers: $35/yr w/ domain name/10Mg/SSI/Perl/PHP4/5-POP3/MySQL & unlim bandwidth/email aliases/more -- great deal!!! Get one! Tell Carol in support I sent you. http://www.domainavenue.com. *BTW: I am not affiliated in any way with DomainAvenue.com or it's parent Wyith, Inc. -- I am just a very happy customer who wants to spread the word, since they've gone the extra mile (or 100) to support me with questions similar to these. For example, at my request (to lessen MY workload) they enabled SSI for all .html files on all accounts (in addition to .shtml), simply because MY current pages expect it. They've also made numerous changes to the account management pages at my specific request and are working on more right now. And they did it FAST. They are great! David Van Camp Software Development Consulting Patterns, Reuse, Software Process Improvement http://www.davidvancamp.com Visit the OO Pattern Digest! A catalog of condensed patterns, books and related resources http://patterndigest.tripod.com Moving soon to: http://patterndigest.com - Original Message - From: "John Brooking" <[EMAIL PROTECTED]> To: "Beginners CGI" <[EMAIL PROTECTED]> Sent: Tuesday, April 16, 2002 4:17 PM Subject: Perl CGI with ISP - advice? > > Hi, > >I'm writing a Perl-based system to allow simple site content management through web forms. I'm a relative beginner to both Perl and CGI, although I have much experience with C, Visual Basic, and relational database programming. The system I'm writing is targeted to non-profits and small businesses, the kinds of outfits which typically will have sites hosted by an ISP, not on their own hardware with their own people to administer it. So my software will need to be (1) small, and (2) installable to a virtual domain cgi-bin path by FTP with normal owner permissions, not system admin and/or shell access. I've found that this cuts down on available technology quite dramatically. > >One hesitation I have is that most Perl modules assume that you can run an install procedure to "install" the module in your system. If an outfit has only FTP access to its virtual domain, not shell access or sysadm privilege, the only thing you can do is copy the module's files over from some other place you've installed them (such as my PC's hard drive). This seems to be working with two of the modules I've used so far (HTML::Template and AnyData::CSV), but I'm hesitant to rely too much on a lot of them. Obviously, you run a risk if a module has platform-specific functionality. I'm particularly shy of CGI.pm, both due to size and also uncertainty of if it can be "installed" by a simple file copy. > >I'd appreciate any advice anyone could give on the difficulties I might encounter in this endeavor, in particular module size and ability to install on an ISP-hosted virtual domain by FTP alone. Should I be convincing the ISP to install the modules in their /site/lib instead, rather than us putting them in our virtual domain? Is CGI.pm recommended in this situation? Any other issues you would foresee me having? (I already know I'll have to think through security at some point.) Thanks in advance for any replies. > > - John Brooking > > > > - > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Definition
Ok, Sorry about that Anyway what do you mean perldoc -f qq? what does the ~qq mean? - Original Message - From: "fliptop" <[EMAIL PROTECTED]> To: "Bill Lyles" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 16, 2002 8:53 PM Subject: Re: Definition > Bill Lyles wrote: > > > href="file://C:\Program Files\Common Files\Microsoft Shared\Stationery\"> > > As I am somewhat new to perl > > > > can someone tell me what this means > > > > $header = qq~ > > > > I understand the header but what is the qq~ for? > > > perldoc -f qq > > btw, it's considered bad form to send html-ized email to the list. > > > -- > 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]
Cookied
Why isnt my cookie getting saved. - #!/usr/bin/perl -w # WeBeWebin # Browse Admin # Andrew Rosolino # V. 1.0 # Load Modules use DBI; use CGI qw/:standard/; use CGI::Carp 'fatalsToBrowser'; # <-- recommended my $q = new CGI; # Making connection to the database; sub DBI { $dsn = "DBI:mysql:homewebewebin:localhost"; $dbh = DBI->connect($dsn, webewebin,w3b3w3bin) or die "$DBI::errstr"; $sth = $dbh->prepare("SELECT username,password FROM browse_admin") or die "$DBI::errstr"; $sth->execute or die "$DBI::errstr"; ($username,$password) = $sth->fetchrow_array; } unless ($q->param('Act')) { &begin; } else { ✓ } #Start Admin sub begin { if(defined $ENV{HTTP_COOKIE}) { ($a, $b) = split(/=/, $ENV{HTTP_COOKIE}); print "$ENV{HTTP_COOKIE}"; } print header, start_html('Login Admin'), h1('Login:'), start_form, "$ENV{'HTTP_COOKIE'}",p, "Username: ",textfield('username'),p, "Password: ",password_field('password'),p, hidden('Act','check'),p, submit('Login'), end_form; } #Check Admin sub check { &DBI; $sth = $dbh->prepare("SELECT username,password FROM browse_admin") or die "$DBI::errstr"; $sth->execute or die "$DBI::errstr"; while(($username,$password) = $sth->fetchrow_array) { if($username eq $q->param('username') && $password eq $q->param('password')) { &bed; } else { print header, "Username Or Password Is Incorrect"; } } $sth->finish; $dbh->disconnect; } sub bed { $cookie = $q->cookie(-name=>"$username", -value=>"$password", -expires=>'1d', -path=>'/', -domain=>'.webewebin.com', -secure=>1); print $q->header(-cookie=>$cookie),p, "Cookie Planted ( I Think.Hope )"; print "$ENV{'HTTP_COOKIE'}"; } -- Andrew __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Definition
Bill Lyles wrote: > href="file://C:\Program Files\Common Files\Microsoft Shared\Stationery\"> > As I am somewhat new to perl > > can someone tell me what this means > > $header = qq~ > > I understand the header but what is the qq~ for? perldoc -f qq btw, it's considered bad form to send html-ized email to the list. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Definition
As I am somewhat new to perl can someone tell me what this means $header = qq~ I understand the header but what is the qq~ for? Thanks
Definition
As I am somewhat new to perl can someone tell me what this means $header = qq~ I understand the header but what is the qq~ for? Thanks
Perl CGI with ISP - advice?
Hi, I'm writing a Perl-based system to allow simple site content management through web forms. I'm a relative beginner to both Perl and CGI, although I have much experience with C, Visual Basic, and relational database programming. The system I'm writing is targeted to non-profits and small businesses, the kinds of outfits which typically will have sites hosted by an ISP, not on their own hardware with their own people to administer it. So my software will need to be (1) small, and (2) installable to a virtual domain cgi-bin path by FTP with normal owner permissions, not system admin and/or shell access. I've found that this cuts down on available technology quite dramatically. One hesitation I have is that most Perl modules assume that you can run an install procedure to "install" the module in your system. If an outfit has only FTP access to its virtual domain, not shell access or sysadm privilege, the only thing you can do is copy the module's files over from some other place you've installed them (such as my PC's hard drive). This seems to be working with two of the modules I've used so far (HTML::Template and AnyData::CSV), but I'm hesitant to rely too much on a lot of them. Obviously, you run a risk if a module has platform-specific functionality. I'm particularly shy of CGI.pm, both due to size and also uncertainty of if it can be "installed" by a simple file copy. I'd appreciate any advice anyone could give on the difficulties I might encounter in this endeavor, in particular module size and ability to install on an ISP-hosted virtual domain by FTP alone. Should I be convincing the ISP to install the modules in their /site/lib instead, rather than us putting them in our virtual domain? Is CGI.pm recommended in this situation? Any other issues you would foresee me having? (I already know I'll have to think through security at some point.) Thanks in advance for any replies. - John Brooking - Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax
conecting cgi and mdb? help please:)
I have install ActivePerl 5.6.1.630 in folder c:\perl then I have run ppm and do the fallowing: PPM> install dbi Install package 'dbi?' (y/N): y Installing package 'dbi'... Error installing package 'dbi': Could not locate a PPD file for package dbi PPM> this is error message and my question is: 1.way I can't install dbi when I am offline? This package I can install only when I am online like others pelage ("INSTALL DBD-Mysql") 2.Can I connect cgi with Microsoft access database " *.mdb " and how to configure those relationship? 3. Can I use Microsoft access database " *.mdb " on servers where is supported mysql? 4.How can I reply on messages because I don't see button "reply"?? Thanks, Dragan
Re: Validating form data
On 15 Apr 2002 22:46:33 -0400, [EMAIL PROTECTED] (Daniel Falkenberg) wrote: >I am just about to go ahead and start validating form data. I was >thinking about tackling it in the following way... > >$data1 = param("data1"); >$data2 = param("data2"); >$data3 = param("data3"); >$data4 = param("data4"); > >if ($data1 ne "Whatever") { > print "Not equal"; >elsif ($data2 ne "Test") { > print "Hello world"; >Of coarse I will be making it a little for stringent :) but is there a >better way of tackling this? Hi, if you are going to test your form input, you may as well do it the suggested "perl way" and use the "taint checking" process. Read perldoc perlsec. Put -T on your shebang line, and you are in "taint-checking mode". To taint check, you setup a regex to extract the $1 from it. Anything passing thru the $1 variable is considered clean. This way, you will be checking your variable, and doing the taintchecking at the same time. The generic variable testing takes this form, where you put in a more suitable regex for your variable. if ($data1 !~ /^(Whatever)$/) { $data1 = $1; # $data now untainted } else {die "Bad data in $data1";# log this somewhere } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]