Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: File Naming

by Mork29 (Scribe)
on Aug 01, 2000 at 09:03 UTC ( #25407=note: print w/replies, xml ) Need Help??

in reply to File Naming

Ok, my follow up question, how do i exclude only a single character from the username or password or any other fields. ie... don't let them put a / in the username?

Replies are listed 'Best First'.
RE: Re: File Naming
by Anonymous Monk on Aug 01, 2000 at 10:02 UTC
    sub secure_query { $_ = shift; s/\-+(.*)/$1/g; s/(.*)[ \t]+\-(.*)/$1$2/g; tr/\$\'\`\"\<\>\/\;\!\|/_/; return($_); }#End secure_query
      This is probably a little simpler and a lot safer:
      $had_bad_characters = $user =~ s/\W//g; # Safer still (since what's defined as a 'word character' could change + based on locale/Unicode (?)) $user =~ s/[^a-zA-Z_-]//g; # Explicitely define what we want to ACCE +PT as valid
      Generally the secure approach involves defining what is acceptable and disallowing everything else, not trying to filter out what we know/anticipate to be bad, because stuff frequently slips through.

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2023-12-04 04:31 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (21 votes). Check out past polls.