Revision: 15286
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 30, 2009 01:47 by cshaiku
Initial Code
function randomStr($length) { $randomStr = ""; $chars = array('2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); while(strlen($randomStr) < $length) { $alt = rand(1,2) % 2; if (0 == $alt) $randomStr .= strtoupper($chars[rand(0, count($chars) - 1)]); else $randomStr .= $chars[rand(0, count($chars) - 1)]; } return $randomStr; } $len = (int) 8; // 1 trillion+ is enough doncha think? if (@strlen($_GET['len']) > 0) { if (strlen($_GET['len']) > 2) header('Location:./' . substr(urldecode(addslashes($_GET['len'])), 0, 2)); $len = (int) substr(urldecode(addslashes($_GET['len'])), 0, 2); } $password = randomStr($len);
Initial URL
http://code.cshaiku.com/code_php_password_generator.php
Initial Description
Initial Title
Password Generator
Initial Tags
Initial Language
PHP