Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: how can i also show sub folders

by Zaxo (Archbishop)
on Nov 21, 2001 at 13:14 UTC ( [id://126740]=note: print w/replies, xml ) Need Help??


in reply to how can i also show sub folders

First, I'd like to warn you to look above this snippet for security problems. I don't see anything here to say you run this in taint mode, or use CGI; for query parsing. You may be doing that already, which is good.

File::Find is a great help in recursing through directory trees. It will do the right thing with symlinks, and can handle all the file tests you need to do.

If you have many, you may want to consider a Schwartzian Transform for a case insensitive sort.

Update: Re your reply:

  1. cgi-lib.pl has been superceded by CGI.pm, which is a modern standard. Your query parsing will be improved by using it.
  2. You should make use of the server's Basic Authentication, rather than handling it in your script. Consider using https for this.
  3. The -wT options on the shebang line will turn on warnings and taint mode. Taint checking forces you to examine user input for damaging stuff. In this case, can a user send '../../../../*' and wipe clean your mounted filesystems?
  4. use strict; as always. It will frustrate you at first, but it is truly worth it. It prevents some sneaky bugs and spots many typos.
'perldoc perlsec' is a good read. I also regard the article phrack 55.7 as required reading. It is a real eye-opener.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: how can i also show sub folders
by jclovs (Sexton) on Nov 21, 2001 at 14:04 UTC
    Now nbot to fell self righteous here, but I really did not like File::Find when I tried to implement it so I choose to make my one recursive dir program:revised Reply to that program which you could modify to do what you wish here. I do believe that for your purposes that File::Find might be suficient for you. Who knows just a suggestion. Clovs aka jclovs
Re: Re: how can i also show sub folders
by Anonymous Monk on Nov 21, 2001 at 18:47 UTC
    well about the security problems im new to CGI but this is what i have @ the top

    use Fcntl; use AnyDBM_File; require "cgi-lib.pl"; &ReadParse(\%in,\%cgi_cfn); print "Content-type: text/html\n\n"; if (!$in{'username'} || !$in{'password'}) { &login_html; exit; } &get_values; &check_login; &actions; &manager_html;
    i dont know if this is better or worse then what you told me.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://126740]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2024-04-19 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found