mb_internal_encoding('UTF-8'); mb_http_output('pass'); if (defined('PHPC_DEBUG')) { error_reporting(E_ALL); ini_set('display_errors', 1); ini_set('html_errors', 1); } $phpc_prefix = "phpc_" . SQL_PREFIX . SQL_DATABASE; $phpc_title = ""; require_once "{$phpc_includes_path}/calendar.php"; // Make the database connection. require_once "{$phpc_includes_path}/phpcdatabase.class.php"; if (!defined("SQL_PORT")) { define("SQL_PORT", ini_get("mysqli.default_port")); } $phpcdb = new PhpcDatabase(SQL_HOST, SQL_USER, SQL_PASSWD, SQL_DATABASE, SQL_PORT); session_start(); require_once "{$phpc_includes_path}/schema.php"; if ($phpcdb->get_config('version') < PHPC_DB_VERSION) { if (isset($_GET['update'])) { phpc_updatedb($phpcdb->dbh); } else { print_update_form(); } exit; } if (empty($_SESSION["{$phpc_prefix}uid"])) { if (!empty($_COOKIE["{$phpc_prefix}login"]) && !empty($_COOKIE["{$phpc_prefix}uid"]) && !empty($_COOKIE["{$phpc_prefix}login_series"])) { // Cleanup before we check their token so they can't login with // an ancient token $phpcdb->cleanup_login_tokens();
redirect('install.php'); exit; } if (defined('PHPC_DEBUG')) { error_reporting(E_ALL); ini_set('display_errors', 1); ini_set('html_errors', 1); } $phpc_prefix = "phpc_" . SQL_PREFIX . SQL_DATABASE; require_once "{$phpc_includes_path}/calendar.php"; // Make the database connection. require_once "{$phpc_includes_path}/phpcdatabase.class.php"; if (!defined("SQL_PORT")) { define("SQL_PORT", ini_get("mysqli.default_port")); } $phpcdb = new PhpcDatabase(SQL_HOST, SQL_USER, SQL_PASSWD, SQL_DATABASE, SQL_PORT); session_set_cookie_params(0, "", "", false, true); session_start(); if (empty($_SESSION["{$phpc_prefix}uid"])) { if (!empty($_COOKIE["{$phpc_prefix}login"]) && !empty($_COOKIE["{$phpc_prefix}uid"]) && !empty($_COOKIE["{$phpc_prefix}login_series"])) { // Cleanup before we check their token so they can't login with // an ancient token $phpcdb->cleanup_login_tokens(); $phpc_uid = $_COOKIE["{$phpc_prefix}uid"]; $phpc_login_series = $_COOKIE["{$phpc_prefix}login_series"]; $phpc_token = $phpcdb->get_login_token($phpc_uid, $phpc_login_series); if ($phpc_token) { if ($phpc_token == $_COOKIE["{$phpc_prefix}login"]) { $user = $phpcdb->get_user($phpc_uid); phpc_do_login($user, $phpc_login_series); } else {