Hello, Iam trying to password protect a script show.pl to be exact but not all of it just specific function in it.

if( param('Αποστολή') ) { if ( ($name eq 'delete') or ($name eq 'deletelog') or ($name eq 'dr +op')) { if ($ENV{REMOTE_USER} eq 'Nik') { if ($name eq 'delete') { $dbh->do( "DELETE FROM guestbook WHERE name=$pray" ); push @print_later, span( {class=>'lime'}, "Μόλις διαγρά +ψατε τον χρήστη => " ); exit 0; } elsif ($name eq 'deletelog') { $dbh->do( 'DELETE FROM guestlog' ); push @print_later, span( {class=>'tip'}, "Η βάση δεδομένω +ν με τα logs μόλις διαγράφηκε!" ); push @print_later, span( {class=>'yellow'}, $pray ); exit 0; } elsif ($name eq 'drop') { $dbh->do( 'DELETE FROM guestbook' ); push @print_later, span( {class=>'tip'}, "Όλες οι εγγραφέ +ς διαγράφηκαν από τη βάση δεδομένων!" ); exit 0; } } else { print header(-status=>'401 Unauthorized', 'WWW-Authenticate'= +>'Basic realm="Only Nik can do perform that!"'); } }
They told me to create a location configuration directive on httpd.conf which i did but remove the Require user Nik which i did and in fact when at the form a user gives soemthing as delete a drop the http auth box pops in but i cannot be vbalidatind as user. Any ideas?

Also i had a problem with a header which should have been print befoe any other print statement and so i had to to push every print in an array and print at the end of the script after the header. But i dont like the idea of pushing things to an array very much isnt any other way to pop a http auth box when a requested feature/function of my cgi-script needs to be run fopr example if the user enters a "delete" or "drop" value at my @name variable?

I hope i agve you to understand what iam about to do.

In reply to Password Protecting specific functions of a Perl Cgi Script by Nik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.