mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
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
This commit is contained in:
parent
8aff2f6758
commit
06c37481cc
1 changed files with 18 additions and 8 deletions
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue