Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
After reviewing some of their code I do totally agree. I thought that I would post something that I found interesting. It seems like the non-perlish way to do the task.
sub GeneratePassword { @digit = ("A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", +"N", "P", "Q", "R", "S", "T", "U", "V", "W", "Y", "Z", "a", "b", "c", + "d", "e", "f", "g", "h", "j", "k", "m", "n", "p", "q", "r", "s", "t" +, "u", "v", "w", "y", "z", "2", "3", "4", "5", "6", "7", "8", "9"); srand(time); $num1 = rand(@digit); $num2 = rand(@digit); $num3 = rand(@digit); $num4 = rand(@digit); $num5 = rand(@digit); $num6 = rand(@digit); $RandomPassword = ("$digit[$num1]" . "$digit[$num2]" . "$digit[$num3]" + . "$digit[$num4]" . "$digit[$num5]" . "$digit[$num6]"); return($RandomPassword); }
I also found how they are getting the cookies, which seems to be what I am going to do. I am going to just get the cookies and check the user to the assigned cookies information. Here is what they had to get the cookies.
sub get_cookie { local($chip, $val); foreach (split(/; /, $ENV{'HTTP_COOKIE'})) { # split cookie at each ; (cookie format is name=value; name=va +lue; etc...) # Convert plus to space (in case of encoding (not necessary, b +ut recommended) s/\+/ /g; # Split into key and value. ($chip, $val) = split(/=/,$_,2); # splits on the first =. # Convert %XX from hex numbers to alphanumeric $chip =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; $val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; # Associate key and value #undef($cookie{$chip}); next if (defined($cookie{$chip})); # \1 is the multiple separator #$cookie{$chip} .= "\1" if (defined($cookie{$chip})); # \1 is the +multiple separator $cookie{$chip} .= $val; } } # end SR NB - the other subroutines from this library [set-cookie, +split-cookie, delete-cookie] have not been included here.

LeGo


In reply to Re: Re: Re: UBB Ultimate Bulletin Board by LeGo
in thread UBB Ultimate Bulletin Board by LeGo

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found