diff options
author | Andrew Dolgov <[email protected]> | 2007-03-02 11:48:46 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-03-02 11:48:46 +0100 |
commit | 7f0acba7b0e44128974e737cd2b82b794287600d (patch) | |
tree | 95f3719f30849705a90b3a3c4471db04fbbe89cf /backend.php | |
parent | c12510cd4d26a1432c9e578063d98db80fff9fe1 (diff) |
login system tweaks
Diffstat (limited to 'backend.php')
-rw-r--r-- | backend.php | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/backend.php b/backend.php index b4eeaf5e0..67bdabb56 100644 --- a/backend.php +++ b/backend.php @@ -16,8 +16,6 @@ error_reporting(DEFAULT_ERROR_LEVEL); */ - $op = $_REQUEST["op"]; - define('SCHEMA_VERSION', 13); require_once "sanity_check.php"; @@ -27,6 +25,25 @@ require_once "db-prefs.php"; require_once "functions.php"; + $script_started = getmicrotime(); + + $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); + + if (!$link) { + if (DB_TYPE == "mysql") { + print mysql_error(); + } + // PG seems to display its own errors just fine by default. + return; + } + + if (DB_TYPE == "pgsql") { + pg_query("set client_encoding = 'UTF-8'"); + pg_set_client_encoding("UNICODE"); + } + + $op = $_REQUEST["op"]; + $print_exec_time = false; if ((!$op || $op == "rpc" || $op == "rss" || $op == "digestSend" || @@ -41,7 +58,8 @@ print_error_xml(7); exit; } - if (!$_SESSION["uid"] && $op != "globalUpdateFeeds" && $op != "rss" && $op != "getUnread") { + if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" + && $op != "rss" && $op != "getUnread") { if ($op == "rpc") { print_error_xml(6); die; @@ -95,22 +113,6 @@ require_once "modules/pref-users.php"; require_once "modules/pref-feed-browser.php"; - $script_started = getmicrotime(); - - $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); - - if (!$link) { - if (DB_TYPE == "mysql") { - print mysql_error(); - } - // PG seems to display its own errors just fine by default. - return; - } - - if (DB_TYPE == "pgsql") { - pg_query("set client_encoding = 'UTF-8'"); - pg_set_client_encoding("UNICODE"); - } if (!sanity_check($link)) { return; } |