OK, update.
I have undone the change to session.class.php. While it worked it has now proved to be unnecessary.
My last_visit problem was the key. Since this was not updating properly it was always more than 7200 seconds since the last login and this is why you are logged out and thrown back to the login prompt.
The reason: I believe in 2.2 in table 'Auth' last_visit was capitalized to 'LAST_VISIT'. It was also a timestamp field. And on mine it was allowed to be null.
In 2.3.1 session.class.php down at lines 48, 49 creates a $timestamp variable. However the MYSQL timestamp data type is peculiar. From the MySQL manual (comments)
it is misleading in that the 'timestamp' field type in mysql holds a datetime value that updates itself unless you explicitly set it
Note that a datetime format is YYYY-MM_DD HH:MM:SS however our $timestamp variable is only in seconds with 10 or 11 digits. If you do the full install and run guestbook.sql this gets set correctly. However with an upgrade you only run the upgrade.sql which just set up the images table and doesn't change the 'auth' table. This is why people have posted the sql files in the forums. These .sql files set 'auth' to INT (11) and 'last_visit' to lower case, which allows the field to be written to when you login and logout. Therefore the time is updated and session check doesn't throw you back to the login script.
So if you are having trouble logging in have a close look at your database with something like PHPMYADMIN or better yet MySQL-Front or MySQLCC and make sure the fields are labelled correctly, and the properties are set to either integer(preferred) or varchar.