mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-13 20:28:44 +01:00
Changes related to session code updates
git-svn-id: file:///svn/phpbb/trunk@122 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
1952a83d31
commit
46d7b32640
@ -43,68 +43,40 @@ $userdata = Array();
|
||||
|
||||
// Setup forum wide options.
|
||||
// This is also the first DB query/connect
|
||||
$sql = "SELECT * FROM ".CONFIG_TABLE." WHERE selected = 1";
|
||||
$sql = "SELECT *
|
||||
FROM ".CONFIG_TABLE."
|
||||
WHERE selected = 1";
|
||||
if(!$result = $db->sql_query($sql))
|
||||
{
|
||||
error_die($db, SQL_CONNECT);
|
||||
}
|
||||
else
|
||||
{
|
||||
$config = $db->sql_fetchrowset($result);
|
||||
$sitename = stripslashes($config[0]["sitename"]);
|
||||
$allow_html = $config[0]["allow_html"];
|
||||
$allow_bbcode = $config[0]["allow_bbcode"];
|
||||
$allow_sig = $config[0]["allow_sig"];
|
||||
$allow_namechange = $config[0]["allow_namechange"];
|
||||
$posts_per_page = $config[0]["posts_per_page"];
|
||||
$hot_threshold = $config[0]["hot_threshold"];
|
||||
$topics_per_page = $config[0]["topics_per_page"];
|
||||
$override_user_themes = $config[0]["override_themes"];
|
||||
$email_sig = stripslashes($config[0]["email_sig"]);
|
||||
$email_from = $config[0]["email_from"];
|
||||
$default_lang = $config[0]["default_lang"];
|
||||
$require_activation = $config[0]["require_activation"];
|
||||
$sys_timezone = $config[0]["system_timezone"];
|
||||
$config = $db->sql_fetchrow($result);
|
||||
$sitename = stripslashes($config["sitename"]);
|
||||
$allow_html = $config["allow_html"];
|
||||
$allow_bbcode = $config["allow_bbcode"];
|
||||
$allow_sig = $config["allow_sig"];
|
||||
$allow_namechange = $config["allow_namechange"];
|
||||
$posts_per_page = $config["posts_per_page"];
|
||||
$hot_threshold = $config["hot_threshold"];
|
||||
$topics_per_page = $config["topics_per_page"];
|
||||
$override_user_themes = $config["override_themes"];
|
||||
$email_sig = stripslashes($config["email_sig"]);
|
||||
$email_from = $config["email_from"];
|
||||
$default_lang = $config["default_lang"];
|
||||
$require_activation = $config["require_activation"];
|
||||
$sys_timezone = $config["system_timezone"];
|
||||
$sys_lang = $default_lang;
|
||||
}
|
||||
|
||||
include('language/lang_'.$default_lang.'.'.$phpEx);
|
||||
|
||||
// Check if user is banned
|
||||
if(!auth("ip ban", $db, "", $user_ip))
|
||||
{
|
||||
error_die($db, BANNED);
|
||||
}
|
||||
//
|
||||
// Initialise session stuff
|
||||
// See file for more details ...
|
||||
//
|
||||
|
||||
if(isset($HTTP_COOKIE_VARS[$session_cookie]))
|
||||
{
|
||||
$sessid = $HTTP_COOKIE_VARS[$session_cookie];
|
||||
$userid = get_userid_from_session($sessid, $session_cookie_time, $user_ip, $db);
|
||||
|
||||
if ($userid)
|
||||
{
|
||||
$user_logged_in = 1;
|
||||
update_session_time($sessid, $db);
|
||||
|
||||
if(!auth("username ban", $db, $userid))
|
||||
{
|
||||
error_die($db, BANNED);
|
||||
}
|
||||
$userdata = get_userdata_from_id($userid, $db);
|
||||
}
|
||||
}
|
||||
|
||||
// If the user isn't logged in check if they have a user ID cookie.
|
||||
if (!$user_logged_in)
|
||||
{
|
||||
if(isset($HTTP_COOKIE_VARS[$cookie_name]))
|
||||
{
|
||||
$userdata = get_userdata_from_id($HTTP_COOKIE_VARS["$cookie_name"], $db);
|
||||
if(!auth("username ban", $db, $userdata["user_id"]))
|
||||
{
|
||||
error_die($db, BANNED);
|
||||
}
|
||||
}
|
||||
}
|
||||
$userdata = session_pagestart($db, $user_ip, $session_length);
|
||||
|
||||
?>
|
||||
|
@ -69,6 +69,9 @@ define(POST_TOPIC_URL, 't');
|
||||
define(POST_FORUM_URL, 'f');
|
||||
define(POST_USERS_URL, 'u');
|
||||
|
||||
// Session parameters
|
||||
define(AUTOLOGON, 0);
|
||||
|
||||
define('BANLIST_TABLE', $table_prefix.'banlist');
|
||||
define('CATEGORIES_TABLE', $table_prefix.'categories');
|
||||
define('CONFIG_TABLE', $table_prefix.'config');
|
||||
@ -81,7 +84,7 @@ define('POSTS_TABLE', $table_prefix.'posts');
|
||||
define('POSTS_TEXT_TABLE', $table_prefix.'posts_text');
|
||||
define('PRIV_MSGS_TABLE', $table_prefix.'priv_msgs');
|
||||
define('RANKS_TABLE', $table_prefix.'ranks');
|
||||
define('SESSIONS_TABLE', $table_prefix.'sessions');
|
||||
define('SESSIONS_TABLE', $table_prefix.'session');
|
||||
define('THEMES_TABLE', $table_prefix.'themes');
|
||||
define('TOPICS_TABLE', $table_prefix.'topics');
|
||||
define('USERS_TABLE', $table_prefix.'users');
|
||||
|
@ -28,9 +28,10 @@ DEFINE(HEADER_INC, TRUE);
|
||||
$template->set_filenames(array("overall_header" => "overall_header.tpl",
|
||||
"overall_footer" => "overall_footer.tpl"));
|
||||
|
||||
if($user_logged_in)
|
||||
if($userdata['session_logged_in'])
|
||||
{
|
||||
$logged_in_status = "You are logged in as <b>".$userdata["username"]."</b>.";
|
||||
$logged_in_status .= " [<A HREF=\"login.php?submit=logout\">Logout</A>]";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ switch($pagetype)
|
||||
}
|
||||
|
||||
// Show the overall footer.
|
||||
if($user_logged_in)
|
||||
if($userdata['session_logged_in'])
|
||||
{
|
||||
$admin_link = "<a href=\"admin/index.php\">Administration Panel</a>";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user