256 Kilobytes

Answers in Server-Side | By Some Guy

Published

495 views, 0 RAMs, and 1 comment

Tags: PHP, Random Number Generation, Passwords, Correct Horse Battery Staple

Profile Photo - Some GuySome GuyBasic Subscriber

Ex:

  • word1-word2-word3-word4-12345

Download more RAM. 🐏 ⨉ 0Posted by Some Guy 2 years ago 🕓 Posted at 19 March, 2019 19:19 PM PDT

This is a debug account.

Profile Photo - August R. GarciaAugust R. GarciaLARPing as a Sysadmi...Portland, ORSite Owner
function correct_horse_battery_staple() {

        // The file that contains the words you want to use
        $f_contents = file(public_path() . "/storage/text/words"); 

        // Choose a Random Separator
        $separators = ["-", "_", "~", ".", "+"];
        $separator = $separators[array_rand($separators)];

        $pw = "";

        // Replace "5" with the number of words desired
        for ($iii = 0; $iii < 5; ++$iii) {
                // Get a random line from the file (assuming your file's words are split by line) 
                $t = trim($f_contents[rand(0, count($f_contents) - 1)]) . $separator;
                
                // Randomly apply capitalization to the selected words 
                $r= rand(0,2); 
                if     ($r == 0) { $t = strtoupper($t); }
                elseif ($r == 1) { $t = strtoupper($t); }
                elseif ($r == 2) { /**/          }       

                $pw .= $t;
        }       

        // Add a random number to the end of the password (with leading zeroes) 
        $pw .= str_pad( rand(1,100000), 6, "0", STR_PAD_LEFT);

        return $pw
}

Example output:

  • Tran's-PILAWS-chorale's-DISHPAN-INVARIANT-011771
  • SILENT_EXISTENTIALIST_GYRATED_demean_COOLEY_008305
  • expelled+HOOKWORM+MISHMASH+FLIPPERS+human+091237
Download more RAM. 🐏 ⨉ 0Posted by August R. Garcia 2 years ago

Edit History

• [2019-03-19 19:23 PDT] August R. Garcia (2 years ago)
• [2019-03-19 19:23 PDT] August R. Garcia (2 years ago)
🕓 Posted at 19 March, 2019 19:23 PM PDT

Sir, I can do you a nice SEO.

Post a New Comment

Do you like having a good time?

Register an Account

You can also login to an existing account or reset your password. All use of this site is subject to the terms of service and privacy policy.

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account

Answers— Read More

Find more related content below!