--- authentication_api.php.old 2004-08-11 19:04:19.000000000 +0200 +++ authentication_api.php 2004-08-11 19:05:17.000000000 +0200 @@ -294,14 +294,14 @@ function auth_generate_unique_cookie_string() { do { $t_cookie_string = auth_generate_cookie_string(); - } while ( !auth_is_cookie_string_unique( $t_cookie_string ) ); + } while ( auth_cookie_string_count( $t_cookie_string ) ); return $t_cookie_string; } # -------------------- # Return true if the cookie login identifier is unique, false otherwise - function auth_is_cookie_string_unique( $p_cookie_string ) { + function auth_cookie_string_count( $p_cookie_string ) { $t_user_table = config_get( 'mantis_user_table' ); $c_cookie_string = db_prepare_string( $p_cookie_string ); @@ -312,11 +312,7 @@ $result = db_query( $query ); $t_count = db_result( $result ); - if ( $t_count > 0 ) { - return false; - } else { - return true; - } + return $t_count; } # -------------------- @@ -330,7 +326,7 @@ $t_cookie = gpc_get_cookie( $t_cookie_name, '' ); # if cookie not found, and anonymous login enabled, use cookie of anonymous account. - if ( is_blank( $t_cookie ) ) { + if ( !auth_cookie_string_count( $t_cookie ) ) { if ( $g_script_login_cookie !== null ) { return $g_script_login_cookie; } else { @@ -343,9 +339,11 @@ $row = db_fetch_array( $result ); $t_cookie = $row['cookie_string']; } - } + } else { + return ''; + } } - } + } return $t_cookie; }