<?
- session_start();
-
+ require_once "sessions.php";
+
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: -1");
require_once "db.php";
if (! DISABLE_SESSIONS) {
- session_start();
-
+ require_once "sessions.php";
+
if (!$_SESSION["prefs_cache"])
$_SESSION["prefs_cache"] = array();
}
<?
- session_start();
+ require_once "sessions.php";
require_once "sanity_check.php";
require_once "version.php";
<?
- session_start();
+ require_once "sessions.php";
require_once "config.php";
require_once "functions.php";
<?
- session_start();
+ require_once "sessions.php";
require_once "sanity_check.php";
require_once "functions.php";
<?
- session_start();
+ require_once "sessions.php";
require_once "sanity_check.php";
require_once "version.php";
drop table if exists ttrss_feed_categories;
drop table if exists ttrss_users;
drop table if exists ttrss_themes;
+drop table if exists ttrss_sessions;
begin;
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE) TYPE=InnoDB;
+create table ttrss_sessions (int_id integer not null primary key auto_increment,
+ id varchar(300) unique not null,
+ data text,
+ expire integer not null,
+ index (id),
+ index (expire)) TYPE=InnoDB;
+
commit;
drop table ttrss_feed_categories;
drop table ttrss_users;
drop table ttrss_themes;
+drop table ttrss_sessions;
begin;
feed_id integer default null references ttrss_feeds(id) ON DELETE CASCADE,
entered timestamp not null default NOW());
+create table ttrss_sessions (int_id serial not null primary key,
+ id varchar(300) unique not null,
+ data text,
+ expire integer not null);
+
+create index ttrss_sessions_id_index on ttrss_sessions(id);
+create index ttrss_sessions_expire_index on ttrss_sessions(expire);
+
commit;
alter table ttrss_entries change author author varchar(250) not null;
alter table ttrss_entries alter column author set default '';
+create table ttrss_sessions (int_id integer not null primary key auto_increment,
+ id varchar(300) unique not null,
+ data text,
+ expire integer not null,
+ index (id),
+ index (expire)) TYPE=InnoDB;
+
update ttrss_version set schema_version = 6;
alter table ttrss_entries alter column author set not null;
alter table ttrss_entries alter column author set default '';
+create table ttrss_sessions (int_id serial not null primary key,
+ id varchar(300) unique not null,
+ data text,
+ expire integer not null);
+
+create index ttrss_sessions_id_index on ttrss_sessions(id);
+create index ttrss_sessions_expire_index on ttrss_sessions(expire);
+
update ttrss_version set schema_version = 6;
commit;
--- /dev/null
+<?
+ // Original from http://www.daniweb.com/code/snippet43.html
+
+ require_once "config.php";
+ require_once "db.php";
+
+ $session_expire = 600;
+
+ ini_set("session.gc_probability", 50);
+
+ function open ($s, $n) {
+
+ global $session_connection;
+
+ $session_connection = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
+
+ return true;
+ }
+
+ function read ($id){
+
+ global $session_connection,$session_read;
+
+ $query = "SELECT data FROM ttrss_sessions WHERE id='$id'";
+
+ $res = db_query($session_connection, $query);
+
+ if (db_num_rows($res) != 1) {
+ return "";
+ } else {
+ $session_read = db_fetch_assoc($res);
+ $session_read["data"] = base64_decode($session_read["data"]);
+ return $session_read["data"];
+ }
+ }
+
+ function write ($id, $data) {
+
+ if (! $data) {
+ return false;
+ }
+
+ global $session_connection, $session_read, $session_expire;
+
+ $expire = time() + $session_expire;
+
+ $data = db_escape_string(base64_encode($data), $session_connection);
+
+ if ($session_read) {
+ $query = "UPDATE ttrss_sessions SET data='$data',
+ expire='$expire' WHERE id='$id'";
+ } else {
+ $query = "INSERT INTO ttrss_sessions (id, data, expire)
+ VALUES ('$id', '$data', '$expire')";
+ }
+
+ db_query($session_connection, $query);
+ return true;
+ }
+
+ function close () {
+
+ global $session_connection;
+
+ db_close($session_connection);
+
+ return true;
+ }
+
+ function destroy ($id) {
+
+ global $session_connection;
+
+ $query = "DELETE FROM ttrss_sessions WHERE id = '$id'";
+
+ db_query($session_connection, $query);
+
+ return true;
+ }
+
+ function gc ($expire) {
+
+ global $session_connection;
+
+ $query = "DELETE FROM ttrss_sessions WHERE expire < " . time();
+
+ db_query($session_connection, $query);
+ }
+
+ session_set_save_handler ("open", "close", "read", "write", "destroy", "gc");
+ session_start();
+?>
<?
- session_start();
+ require_once "sessions.php";
require_once "sanity_check.php";
require_once "version.php";
<?
- session_start();
+ require_once "sessions.php";
require_once "sanity_check.php";
require_once "version.php";
<?
- session_start();
+ require_once "sessions.php";
define('MAX_SCHEMA_VERSION', 5);
<?
- session_start();
-
+ require_once "sessions.php";
+
require_once "config.php";
require_once "functions.php";
require_once "db.php";