<commit_before><?php

/**
 * Implementation of PHP's session API.
 *
 * What it does:
 *
 *  - It handles the session data in the database (more scalable.)
 *  - It uses the databaseSession_lifetime setting for garbage collection.
 *  - The custom session handler is set by loadSession().
 *
 * @name      <NAME>
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This file contains code covered by:
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:		BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.1
 *
 */

/**
 * Attempt to start the session, unless it already has been.
 */
function loadSession()
{
	global $modSettings, $boardurl, $sc;

	// Attempt to change a few PHP settings.
	@ini_set('session.use_cookies', true);
	@ini_set('session.use_only_cookies', false);
	@ini_set('url_rewriter.tags', '');
	@ini_set('session.use_trans_sid', false);
	@ini_set('arg_separator.output', '&amp;');

	if (!empty($modSettings['globalCookies']))
	{
		$parsed_url = parse_url($boardurl);
<commit_msg>Update Session.php to secure PHPSESSIONID<commit_after><?php

/**
 * Implementation of PHP's session API.
 *
 * What it does:
 *
 *  - It handles the session data in the database (more scalable.)
 *  - It uses the databaseSession_lifetime setting for garbage collection.
 *  - The custom session handler is set by loadSession().
 *
 * @name      <NAME>
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This file contains code covered by:
 * copyright:	2011 Simple Machines (http://www.simplemachines.org)
 * license:		BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.1
 *
 */

/**
 * Attempt to start the session, unless it already has been.
 */
function loadSession()
{
	global $modSettings, $boardurl, $sc;

	// Attempt to change a few PHP settings.
	@ini_set('session.use_cookies', true);
	@ini_set('session.use_only_cookies', false);
	@ini_set('url_rewriter.tags', '');
	@ini_set('session.use_trans_sid', false);
	@ini_set('arg_separator.output', '&amp;');
	
	// Secure PHPSESSIONID
	if (parse_url($boardurl, PHP_URL_SCHEME)==='https')
		@ini_set('session.cookie_secure', true);
	
	if (!empty($modSettings['globalCookies']))
	{
		$parsed_url = parse_url($boardurl);

{'fraction_non_alphanumeric': 0.13831141281289774, 'fraction_numerical': 0.005939753924480272, 'mean_word_length': 4.216814159292035, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2087472', 'n_tokens_mistral': 789, 'n_tokens_neox': 757, 'n_words': 215}