note 116713 added to function.shuffle

From: Date: Sun, 15 Feb 2015 02:55:26 +0000
Subject: note 116713 added to function.shuffle
Groups: php.notes 
Request: Send a blank email to php-notes+get-201733@lists.php.net to get a copy of this message
Very Strong Password Generator. The output fulfills all security standards as in the website www.passwordmeter.com (no relation with the website owner). <?php $password = array(); $characters[] = array('!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~'); $characters[] = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); $characters[] = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); $characters[] = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); shuffle($characters); for ($i=0, $j=0; $i<20; $i++, $j++) { if ($j >= count($characters)) $j = 0; while (true) { $char = $characters[$j][array_rand($characters[$j])]; if (!in_array(strtolower($char), array_map('strtolower', $password))) break; } $password[$i] = $char; } $offset = rand(1, count($password)); $password = array_merge(array_slice($password, $offset), array_slice($password, 0, $offset)); echo htmlspecialchars(implode('', $password)); ?> ---- Server IP: 72.52.91.14 Probable Submitter: 179.191.10.178 ---- Manual Page -- http://php.net/manual/en/function.shuffle.php Edit -- https://master.php.net/note/edit/116713 Del: integrated -- https://master.php.net/note/delete/116713/integrated Del: useless -- https://master.php.net/note/delete/116713/useless Del: bad code -- https://master.php.net/note/delete/116713/bad+code Del: spam -- https://master.php.net/note/delete/116713/spam Del: non-english -- https://master.php.net/note/delete/116713/non-english Del: in docs -- https://master.php.net/note/delete/116713/in+docs Del: other reasons-- https://master.php.net/note/delete/116713 Reject -- https://master.php.net/note/reject/116713 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201733) next »