Changeset 1013


Ignore:
Timestamp:
01/25/06 01:47:31 (14 years ago)
Author:
rvelices
Message:

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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_session.inc.php

    r1010 r1013  
    2626// +-----------------------------------------------------------------------+ 
    2727 
     28// The function generate_key creates a string with pseudo random characters. 
     29// the size of the string depends on the $conf['session_id_size']. 
     30// Characters used are a-z A-Z and numerical values. Examples : 
     31//                    "Er4Tgh6", "Rrp08P", "54gj" 
     32// input  : none (using global variable) 
     33// output : $key 
     34function generate_key($size) 
     35{ 
     36  global $conf; 
     37 
     38  $md5 = md5(substr(microtime(), 2, 6)); 
     39  $init = ''; 
     40  for ( $i = 0; $i < strlen( $md5 ); $i++ ) 
     41  { 
     42    if ( is_numeric( $md5[$i] ) ) $init.= $md5[$i]; 
     43  } 
     44  $init = substr( $init, 0, 8 ); 
     45  mt_srand( $init ); 
     46  $key = ''; 
     47  for ( $i = 0; $i < $size; $i++ ) 
     48  { 
     49    $c = mt_rand( 0, 2 ); 
     50    if ( $c == 0 )      $key .= chr( mt_rand( 65, 90 ) ); 
     51    else if ( $c == 1 ) $key .= chr( mt_rand( 97, 122 ) ); 
     52    else                $key .= mt_rand( 0, 9 ); 
     53  } 
     54  return $key; 
     55} 
     56 
    2857if (isset($conf['session_save_handler'])  
    29   and ($conf['session_save_handler'] == 'db'))  
     58  and ($conf['session_save_handler'] == 'db') 
     59  and defined('PHPWG_INSTALLED'))  
    3060{ 
    3161  session_set_save_handler('pwg_session_open',  
Note: See TracChangeset for help on using the changeset viewer.