/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function str_makerand($length, $useupper, $usespecial, $usenumbers) { $charset = "abcdefghijklmnopqrstuvwxyz"; if ($useupper) $charset .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if ($usenumbers) $charset .= "0123456789"; if ($usespecial) $charset .= "~@#$%^*()_+-={}|]["; // Note: using all special characters this reads: "~!@#$%^&*()_+`-={}|\\]?[\":;'><,./"; if ($length == '' || $length == 0) for ($i = 0; $i < $length; $i++) return $key; }