diff --git a/functions/imap_general.php b/functions/imap_general.php index 8bd2485ae..066fb4c2d 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -20,9 +20,12 @@ */ function sqimap_session_id() { + global $data_dir, $username; + $IMAPSessionID = substr(session_id(), -4); if( $IMAPSessionID == '' ) { - $IMAPSessionID = GenerateRandomString(4, '', 7); + $IMAPSessionID = str_pad( dechex( getPref( $data_dir, $username, 'counter', 0 ) ), + 4, '0', STR_PAD_LEFT); } return( $IMAPSessionID ); diff --git a/functions/prefs.php b/functions/prefs.php index 5ecf530f9..1d5fb68fb 100644 --- a/functions/prefs.php +++ b/functions/prefs.php @@ -70,7 +70,7 @@ if (isset($prefs_cache[$string])) return $prefs_cache[$string]; else - return $default; + return $default; } diff --git a/src/redirect.php b/src/redirect.php index f40910576..011b14b28 100644 --- a/src/redirect.php +++ b/src/redirect.php @@ -104,6 +104,8 @@ session_register ('username'); setcookie('key', $key, 0, $base_uri); do_hook ('login_verified'); + setPref( $data_dir, $username, 'counter', + getPref( $data_dir, $username, 'counter', 0 ) + 1 ); } /* Set the login variables. */