diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2004-02-03 02:29:35 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2004-02-03 02:29:35 +0000 |
commit | 06c37481ccdc52735776c6ec24204a21f5a00d7f (patch) | |
tree | d4f9a601aecafa6fc244220ab5cf8c88038fea65 /phpBB/includes/functions.php | |
parent | 8aff2f6758cd3fcf87da26485663e296b1c4fff6 (diff) | |
download | forums-06c37481ccdc52735776c6ec24204a21f5a00d7f.tar forums-06c37481ccdc52735776c6ec24204a21f5a00d7f.tar.gz forums-06c37481ccdc52735776c6ec24204a21f5a00d7f.tar.bz2 forums-06c37481ccdc52735776c6ec24204a21f5a00d7f.tar.xz forums-06c37481ccdc52735776c6ec24204a21f5a00d7f.zip |
gen_random_string move ... not entirely sure about this ... may well return to user functions
git-svn-id: file:///svn/phpbb/trunk@4785 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e0f9655cc8..fb1081bb66 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -86,6 +86,24 @@ function set_config($config_name, $config_value, $is_dynamic = FALSE) } } +// Generates an alphanumeric random string of given length +function gen_rand_string($num_chars) +{ + $chars = 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', '1', '2', '3', '4', '5', '6', '7', '8', '9'); + + list($usec, $sec) = explode(' ', microtime()); + mt_srand($sec * $usec); + + $max_chars = count($chars) - 1; + $rand_str = ''; + for ($i = 0; $i < $num_chars; $i++) + { + $rand_str .= $chars[mt_rand(0, $max_chars)]; + } + + return $rand_str; +} + function get_userdata($user) { global $db; @@ -1087,14 +1105,6 @@ function msg_handler($errno, $msg_text, $errfile, $errline) switch ($errno) { - case E_WARNING: - case E_NOTICE: - if (defined('DEBUG_EXTRA')) - { -// echo "PHP Notice on line <b>$errline</b> in <b>$errfile</b> :: <b>$msg_text</b><br />"; - } - break; - case E_USER_ERROR: if (isset($db)) { |