
Sergei Miami - 2007-11-21 22:59:20 -
In reply to message 1 from Swen Horvath
Seems that author does some mistakes in Read and gc functions, in SQL queries, but script is very useful, thanks.
1.
Find line: // Fetch session data from the selected database
And change next string to: $sql = 'SELECT `session_data` FROM `sessions` WHERE `session_id` = \'' . addslashes( $id ) . '\' AND `expires` > UNIX_TIMESTAMP();';
2.
Find line: // Build DELETE query
And change next string to: $sql = 'DELETE FROM `sessions` WHERE `expires` <= UNIX_TIMESTAMP();';
3.
Also, here is SQL table to work with:
CREATE TABLE `sessions` (
`session_id` varchar(40) collate utf8_unicode_ci NOT NULL,
`session_data` longtext collate utf8_unicode_ci NOT NULL,
`expires` int(11) NOT NULL,
PRIMARY KEY (`session_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
4.
And format of session_hosts.ini:
[n] <-- any number
host = abc <-- hostname
database = abc <-- db name
user = abc <-- db user
password = abc <-- db password
[n+1]
next database...
Woa'la!