|
|
|
|
|
|
| |
A random password generator. The script can generate passwords of varying complexity. You can specify the maximum and minimum length of the password and the characters that are to be included in the password.
| <?php
function random_string($minlength = 6, $maxlength = 6, $uselower = true, $useupper = false, $usenumbers = true, $usespecial = false){
$charset = '';
if ($useupper) $charset .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if ($usenumbers) $charset .= "1234567890";
if ($usespecial) $charset .= "~@#$%^*()_+-={}|][";
if (empty($charset) || $uselower) $charset .= "abcdefghijklmnopqrstuvwxyz";
$length = ($minlength > $maxlength) ? mt_rand ($maxlength, $minlength) : mt_rand ($minlength, $maxlength);
$charsetlength = strlen($charset) - 1;
for ($i=0; $i<$length; $i++) {
$str .= $charset[mt_rand(0, $charsetlength)];
}
return $str;
}
echo 'SIMPLEST : ' . random_string(5, 5, false, false) . "<br>\n";
echo 'SIMPLE : ' . random_string(5, 5, false, true, false) . "<br>\n";
echo 'MEDIUM : ' . random_string() . "<br>\n";
echo 'HARD : ' . random_string(5, 10, true, true, false) . "<br>\n";
echo 'HARDER : ' . random_string(5, 10, true, true) . "<br>\n";
echo 'HARDEST : ' . random_string(5, 10, true, true, true, true) . "<br>\n";
?> | | |
|
| A damaged image generator (class) for validating text.
CAPTCHA - Completely Automated Public Turing test to tell Computers and Humans Apart Categories : PHP, PHP Classes, Security, GD image library, Security | | | A few functions to create random passwords. Categories : PHP, Security, Strings | | | A PHP function to encrypt and decrypt a number or string or a combination of the two. Categories : PHP, Encryption, Security | | | Dollar Serial Number Validator Categories : PHP, Security, Algorithms | | | A very simple PHP single password cookie based login without usernames. Categories : PHP, Cookies, Security, Beginner Guides | | | mysql_escape_string Categories : PHP, MySQL, Databases, Strings | | | Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form Categories : HTML, PHP, Strings | | | MD5 secured login Categories : PHP, Java Script, Authentication, Security | | | function textwrap will wrap text to any desired width using <BR>\n as the default line break.
Default wrap width is 80 columns.
Categories : Strings, HTML and PHP, PHP | | | Secure URL $_GET Categories : PHP, Data Validation, Security | | | Adding dashes to credit card numbers Categories : Strings, Credit Cards, PHP | | | Encoding data using PGP via PHP's proc_* functions Categories : Cryptography, Security, Email, PHP, PGP | | | I need a trim function/regexp that will trim all " " from the ends of a string. Categories : Regexps, PHP, Strings | | | Customizable encoding and decoding strings with security. Categories : PHP, Strings, HTML and PHP | | | Printer friendly pages from anywhere on a website. Categories : PHP, Strings, Content Management | |
|
|
|