<commit_before><?php
require_once('../../global_functions.php');
require_once('../functions.php');
require_once('../../connections/parameters.php');

//Allow a host to close lobby

try {
    $lobbyID = !empty($_GET['lid']) && is_numeric($_GET['lid'])
        ? $_GET['lid']
        : NULL;

    $token = !empty($_GET['t'])
        ? $_GET['t']
        : NULL;

    if (!empty($lobbyID) && !empty($token)) {
        $lobbyStatus = array();

        $db = new dbWrapper_v2($hostname_gds_site, $username_gds_site, $password_gds_site, $database_gds_site, false);
        $db->q('SET NAMES utf8;');

        if ($db) {
            $sqlResult = $db->q(
                'UPDATE `lobby_list` SET `lobby_active` = 0 WHERE `lobby_id` = ? AND `lobby_secure_token` = ?;',
                'is',
                $lobbyID, $token
            );

            if (!empty($sqlResult)) {
                //RETURN LOBBY ID
                $lobbyStatus['result'] = 'Lobby ' . $lobbyID . ' closed!';
            } else {
                //SOMETHING FUNKY HAPPENED
                $lobbyStatus['error'] = 'Unknown error!';
            }<commit_msg>Update lobby_close to set unset hosted flag on lobbies that are closed<commit_after><?php
require_once('../../global_functions.php');
require_once('../functions.php');
require_once('../../connections/parameters.php');

//Allow a host to close lobby

try {
    $lobbyID = !empty($_GET['lid']) && is_numeric($_GET['lid'])
        ? $_GET['lid']
        : NULL;

    $token = !empty($_GET['t'])
        ? $_GET['t']
        : NULL;

    if (!empty($lobbyID) && !empty($token)) {
        $lobbyStatus = array();

        $db = new dbWrapper_v2($hostname_gds_site, $username_gds_site, $password_gds_site, $database_gds_site, false);
        $db->q('SET NAMES utf8;');

        if ($db) {
            $sqlResult = $db->q(
                'UPDATE `lobby_list` SET `lobby_active` = 0, `lobby_hosted` = 0 WHERE `lobby_id` = ? AND `lobby_secure_token` = ?;',
                'is',
                $lobbyID, $token
            );

            if (!empty($sqlResult)) {
                //RETURN LOBBY ID
                $lobbyStatus['result'] = 'Lobby ' . $lobbyID . ' closed!';
            } else {
                //SOMETHING FUNKY HAPPENED
                $lobbyStatus['error'] = 'Unknown error!';
            }
{'fraction_non_alphanumeric': 0.17447357112161582, 'fraction_numerical': 0.0030081650193382035, 'mean_word_length': 2.0038709677419355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3189376', 'n_tokens_mistral': 777, 'n_tokens_neox': 746, 'n_words': 147}