/Helios Engine/helios/functions/randomchars.php
PHP | 70 lines | 50 code | 0 blank | 20 comment | 1 complexity | aca8796ea0bff23b68b25383f9efb455 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0
- <?php
- ############################################################################
- # Copyright (C) 2007 by Arturo Mann #
- # arturo.mann@gmail.com #
- # #
- # This program is free software; you can redistribute it and#or modify #
- # it under the terms of the GNU General Public License as published by #
- # the Free Software Foundation; either version 2 of the License, or #
- # (at your option) any later version. #
- # #
- # This program is distributed in the hope that it will be useful, #
- # but WITHOUT ANY WARRANTY; without even the implied warranty of #
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
- # GNU General Public License for more details. #
- # #
- # You should have received a copy of the GNU General Public License #
- # along with this program; if not, write to the #
- # Free Software Foundation, Inc., #
- # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
- ############################################################################
- function generateChars($key) {
- $seed = date(Hmsy);
- mt_srand($seed);
- $chararr = array( 1 => "A",
- 2 => "B",
- 3 => "C",
- 4 => "D",
- 5 => "E",
- 6 => "F",
- 7 => "G",
- 8 => "H",
- 9 => "I",
- 10 => "J",
- 11 => "K",
- 12 => "L",
- 13 => "M",
- 14 => "N",
- 15 => "P",
- 16 => "Q",
- 17 => "R",
- 18 => "S",
- 19 => "T",
- 20 => "U",
- 21 => "V",
- 22 => "W",
- 23 => "X",
- 24 => "Y",
- 25 => "Z",
- 26 => 1,
- 27 => 2,
- 28 => 3,
- 29 => 4,
- 30 => 5,
- 31 => 6,
- 32 => 7,
- 33 => 8,
- 34 => 9,
- 35 => 0,
- );
- $counter = 0;
- while ($counter <= $key) {
- $target = mt_rand(1,35);
- //echo $target;
- $rawst = $rawst.$chararr[$target];
- $counter++;
- }
- return $rawst;
- }
- $stream = $_REQUEST["lenght"];
- $string = generateChars($stream);