mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-20 00:23:40 +02:00
bug: new session system does not use db session handler during install.php
bug: put back function generate_key (was also used by new password generation and new feed generation) git-svn-id: http://piwigo.org/svn/trunk@1013 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -25,8 +25,38 @@
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// The function generate_key creates a string with pseudo random characters.
|
||||
// the size of the string depends on the $conf['session_id_size'].
|
||||
// Characters used are a-z A-Z and numerical values. Examples :
|
||||
// "Er4Tgh6", "Rrp08P", "54gj"
|
||||
// input : none (using global variable)
|
||||
// output : $key
|
||||
function generate_key($size)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$md5 = md5(substr(microtime(), 2, 6));
|
||||
$init = '';
|
||||
for ( $i = 0; $i < strlen( $md5 ); $i++ )
|
||||
{
|
||||
if ( is_numeric( $md5[$i] ) ) $init.= $md5[$i];
|
||||
}
|
||||
$init = substr( $init, 0, 8 );
|
||||
mt_srand( $init );
|
||||
$key = '';
|
||||
for ( $i = 0; $i < $size; $i++ )
|
||||
{
|
||||
$c = mt_rand( 0, 2 );
|
||||
if ( $c == 0 ) $key .= chr( mt_rand( 65, 90 ) );
|
||||
else if ( $c == 1 ) $key .= chr( mt_rand( 97, 122 ) );
|
||||
else $key .= mt_rand( 0, 9 );
|
||||
}
|
||||
return $key;
|
||||
}
|
||||
|
||||
if (isset($conf['session_save_handler'])
|
||||
and ($conf['session_save_handler'] == 'db'))
|
||||
and ($conf['session_save_handler'] == 'db')
|
||||
and defined('PHPWG_INSTALLED'))
|
||||
{
|
||||
session_set_save_handler('pwg_session_open',
|
||||
'pwg_session_close',
|
||||
|
||||
Reference in New Issue
Block a user