Example #1
0
/**
 * Sets the SMF-style login cookie and session based on the id_member and password passed.
 * - password should be already encrypted with the cookie salt.
 * - logs the user out if id_member is zero.
 * - sets the cookie and session to last the number of seconds specified by cookie_length.
 * - when logging out, if the globalCookies setting is enabled, attempts to clear the subdomain's cookie too.
 *
 * @param int $cookie_length,
 * @param int $id The id of the member
 * @param string $password = ''
 */
function setLoginCookie($cookie_length, $id, $password = '')
{
    global $cookiename, $boardurl, $modSettings, $sourcedir;
    // If changing state force them to re-address some permission caching.
    $_SESSION['mc']['time'] = 0;
    // The cookie may already exist, and have been set with different options.
    $cookie_state = (empty($modSettings['localCookies']) ? 0 : 1) | (empty($modSettings['globalCookies']) ? 0 : 2);
    if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\\{i:0;(i:\\d{1,6}|s:[1-8]:"\\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\\d{1,14};(i:3;i:\\d;)?\\}$~', $_COOKIE[$cookiename]) === 1) {
        $array = @unserialize($_COOKIE[$cookiename]);
        // Out with the old, in with the new!
        if (isset($array[3]) && $array[3] != $cookie_state) {
            $cookie_url = url_parts($array[3] & 1 > 0, $array[3] & 2 > 0);
            smf_setcookie($cookiename, serialize(array(0, '', 0)), time() - 3600, $cookie_url[1], $cookie_url[0]);
        }
    }
    // Get the data and path to set it on.
    $data = serialize(empty($id) ? array(0, '', 0) : array($id, $password, time() + $cookie_length, $cookie_state));
    $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
    // Set the cookie, $_COOKIE, and session variable.
    smf_setcookie($cookiename, $data, time() + $cookie_length, $cookie_url[1], $cookie_url[0]);
    // If subdomain-independent cookies are on, unset the subdomain-dependent cookie too.
    if (empty($id) && !empty($modSettings['globalCookies'])) {
        smf_setcookie($cookiename, $data, time() + $cookie_length, $cookie_url[1], '');
    }
    // Any alias URLs?  This is mainly for use with frames, etc.
    if (!empty($modSettings['forum_alias_urls'])) {
        $aliases = explode(',', $modSettings['forum_alias_urls']);
        $temp = $boardurl;
        foreach ($aliases as $alias) {
            // Fake the $boardurl so we can set a different cookie.
            $alias = strtr(trim($alias), array('http://' => '', 'https://' => ''));
            $boardurl = 'http://' . $alias;
            $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
            if ($cookie_url[0] == '') {
                $cookie_url[0] = strtok($alias, '/');
            }
            smf_setcookie($cookiename, $data, time() + $cookie_length, $cookie_url[1], $cookie_url[0]);
        }
        $boardurl = $temp;
    }
    $_COOKIE[$cookiename] = $data;
    // Make sure the user logs in with a new session ID.
    if (!isset($_SESSION['login_' . $cookiename]) || $_SESSION['login_' . $cookiename] !== $data) {
        // We need to meddle with the session.
        require_once $sourcedir . '/Session.php';
        // Backup and remove the old session.
        $oldSessionData = $_SESSION;
        $_SESSION = array();
        session_destroy();
        // Recreate and restore the new session.
        loadSession();
        // @todo should we use session_regenerate_id(true); now that we are 5.1+
        session_regenerate_id();
        $_SESSION = $oldSessionData;
        $_SESSION['login_' . $cookiename] = $data;
    }
}
Example #2
0
/**
 * Do banning related stuff.  (ie. disallow access....)
 * Checks if the user is banned, and if so dies with an error.
 * Caches this information for optimization purposes.
 * Forces a recheck if force_check is true.
 * @param bool $forceCheck = false
 */
function is_not_banned($forceCheck = false)
{
    global $txt, $modSettings, $context, $user_info, $backend_subdir;
    global $sourcedir, $cookiename, $user_settings;
    // You cannot be banned if you are an admin - doesn't help if you log out.
    if ($user_info['is_admin']) {
        return;
    }
    // Only check the ban every so often. (to reduce load.)
    if ($forceCheck || !isset($_SESSION['ban']) || empty($modSettings['banLastUpdated']) || $_SESSION['ban']['last_checked'] < $modSettings['banLastUpdated'] || $_SESSION['ban']['id_member'] != $user_info['id'] || $_SESSION['ban']['ip'] != $user_info['ip'] || $_SESSION['ban']['ip2'] != $user_info['ip2'] || isset($user_info['email'], $_SESSION['ban']['email']) && $_SESSION['ban']['email'] != $user_info['email']) {
        // Innocent until proven guilty.  (but we know you are! :P)
        $_SESSION['ban'] = array('last_checked' => time(), 'id_member' => $user_info['id'], 'ip' => $user_info['ip'], 'ip2' => $user_info['ip2'], 'email' => $user_info['email']);
        $ban_query = array();
        $ban_query_vars = array('current_time' => time());
        $flag_is_activated = false;
        // Check both IP addresses.
        foreach (array('ip', 'ip2') as $ip_number) {
            if ($ip_number == 'ip2' && $user_info['ip2'] == $user_info['ip']) {
                continue;
            }
            $ban_query[] = constructBanQueryIP($user_info[$ip_number]);
            // IP was valid, maybe there's also a hostname...
            if (empty($modSettings['disableHostnameLookup']) && $user_info[$ip_number] != 'unknown') {
                $hostname = host_from_ip($user_info[$ip_number]);
                if (strlen($hostname) > 0) {
                    $ban_query[] = '({string:hostname} LIKE bi.hostname)';
                    $ban_query_vars['hostname'] = $hostname;
                }
            }
        }
        // Is their email address banned?
        if (strlen($user_info['email']) != 0) {
            $ban_query[] = '({string:email} LIKE bi.email_address)';
            $ban_query_vars['email'] = $user_info['email'];
        }
        // How about this user?
        if (!$user_info['is_guest'] && !empty($user_info['id'])) {
            $ban_query[] = 'bi.id_member = {int:id_member}';
            $ban_query_vars['id_member'] = $user_info['id'];
        }
        // Check the ban, if there's information.
        if (!empty($ban_query)) {
            $restrictions = array('cannot_access', 'cannot_login', 'cannot_post', 'cannot_register');
            $request = smf_db_query('
				SELECT bi.id_ban, bi.email_address, bi.id_member, bg.cannot_access, bg.cannot_register,
					bg.cannot_post, bg.cannot_login, bg.reason, IFNULL(bg.expire_time, 0) AS expire_time
				FROM {db_prefix}ban_items AS bi
					INNER JOIN {db_prefix}ban_groups AS bg ON (bg.id_ban_group = bi.id_ban_group AND (bg.expire_time IS NULL OR bg.expire_time > {int:current_time}))
				WHERE
					(' . implode(' OR ', $ban_query) . ')', $ban_query_vars);
            // Store every type of ban that applies to you in your session.
            while ($row = mysql_fetch_assoc($request)) {
                foreach ($restrictions as $restriction) {
                    if (!empty($row[$restriction])) {
                        $_SESSION['ban'][$restriction]['reason'] = $row['reason'];
                        $_SESSION['ban'][$restriction]['ids'][] = $row['id_ban'];
                        if (!isset($_SESSION['ban']['expire_time']) || $_SESSION['ban']['expire_time'] != 0 && ($row['expire_time'] == 0 || $row['expire_time'] > $_SESSION['ban']['expire_time'])) {
                            $_SESSION['ban']['expire_time'] = $row['expire_time'];
                        }
                        if (!$user_info['is_guest'] && $restriction == 'cannot_access' && ($row['id_member'] == $user_info['id'] || $row['email_address'] == $user_info['email'])) {
                            $flag_is_activated = true;
                        }
                    }
                }
            }
            mysql_free_result($request);
        }
        // Mark the cannot_access and cannot_post bans as being 'hit'.
        if (isset($_SESSION['ban']['cannot_access']) || isset($_SESSION['ban']['cannot_post']) || isset($_SESSION['ban']['cannot_login'])) {
            log_ban(array_merge(isset($_SESSION['ban']['cannot_access']) ? $_SESSION['ban']['cannot_access']['ids'] : array(), isset($_SESSION['ban']['cannot_post']) ? $_SESSION['ban']['cannot_post']['ids'] : array(), isset($_SESSION['ban']['cannot_login']) ? $_SESSION['ban']['cannot_login']['ids'] : array()));
        }
        // If for whatever reason the is_activated flag seems wrong, do a little work to clear it up.
        if ($user_info['id'] && ($user_settings['is_activated'] >= 10 && !$flag_is_activated || $user_settings['is_activated'] < 10 && $flag_is_activated)) {
            require_once $sourcedir . '/' . $backend_subdir . '/ManageBans.php';
            updateBanMembers();
        }
    }
    // Hey, I know you! You're ehm...
    if (!isset($_SESSION['ban']['cannot_access']) && !empty($_COOKIE[$cookiename . '_'])) {
        $bans = explode(',', $_COOKIE[$cookiename . '_']);
        foreach ($bans as $key => $value) {
            $bans[$key] = (int) $value;
        }
        $request = smf_db_query('
			SELECT bi.id_ban, bg.reason
			FROM {db_prefix}ban_items AS bi
				INNER JOIN {db_prefix}ban_groups AS bg ON (bg.id_ban_group = bi.id_ban_group)
			WHERE bi.id_ban IN ({array_int:ban_list})
				AND (bg.expire_time IS NULL OR bg.expire_time > {int:current_time})
				AND bg.cannot_access = {int:cannot_access}
			LIMIT ' . count($bans), array('cannot_access' => 1, 'ban_list' => $bans, 'current_time' => time()));
        while ($row = mysql_fetch_assoc($request)) {
            $_SESSION['ban']['cannot_access']['ids'][] = $row['id_ban'];
            $_SESSION['ban']['cannot_access']['reason'] = $row['reason'];
        }
        mysql_free_result($request);
        // My mistake. Next time better.
        if (!isset($_SESSION['ban']['cannot_access'])) {
            require_once $sourcedir . '/lib/Subs-Auth.php';
            $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
            smf_setcookie($cookiename . '_', '', time() - 3600, $cookie_url[1], $cookie_url[0], false, false);
        }
    }
    // If you're fully banned, it's end of the story for you.
    if (isset($_SESSION['ban']['cannot_access'])) {
        // We don't wanna see you!
        if (!$user_info['is_guest']) {
            smf_db_query('
				DELETE FROM {db_prefix}log_online
				WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
        }
        // 'Log' the user out.  Can't have any funny business... (save the name!)
        $old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt['guest_title'];
        $user_info['name'] = '';
        $user_info['username'] = '';
        $user_info['is_guest'] = true;
        $user_info['is_admin'] = false;
        $user_info['permissions'] = array();
        $user_info['id'] = 0;
        $context['user'] = array('id' => 0, 'username' => '', 'name' => $txt['guest_title'], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'can_mod' => false, 'language' => $user_info['language']);
        // A goodbye present.
        require_once $sourcedir . '/lib/Subs-Auth.php';
        $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
        smf_setcookie($cookiename . '_', implode(',', $_SESSION['ban']['cannot_access']['ids']), time() + 3153600, $cookie_url[1], $cookie_url[0], false, false);
        // Don't scare anyone, now.
        $_GET['action'] = '';
        $_GET['board'] = '';
        $_GET['topic'] = '';
        writeLog(true);
        // You banned, sucka!
        fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_access']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_access']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']), 'user');
        // If we get here, something's gone wrong.... but let's try anyway.
        trigger_error('Hacking attempt...', E_USER_ERROR);
    } elseif (isset($_SESSION['ban']['cannot_login']) && !$user_info['is_guest']) {
        // We don't wanna see you!
        smf_db_query('
			DELETE FROM {db_prefix}log_online
			WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
        // 'Log' the user out.  Can't have any funny business... (save the name!)
        $old_name = isset($user_info['name']) && $user_info['name'] != '' ? $user_info['name'] : $txt['guest_title'];
        $user_info['name'] = '';
        $user_info['username'] = '';
        $user_info['is_guest'] = true;
        $user_info['is_admin'] = false;
        $user_info['permissions'] = array();
        $user_info['id'] = 0;
        $context['user'] = array('id' => 0, 'username' => '', 'name' => $txt['guest_title'], 'is_guest' => true, 'is_logged' => false, 'is_admin' => false, 'is_mod' => false, 'can_mod' => false, 'language' => $user_info['language']);
        // SMF's Wipe 'n Clean(r) erases all traces.
        $_GET['action'] = '';
        $_GET['board'] = '';
        $_GET['topic'] = '';
        writeLog(true);
        require_once $sourcedir . '/LogInOut.php';
        Logout(true, false);
        fatal_error(sprintf($txt['your_ban'], $old_name) . (empty($_SESSION['ban']['cannot_login']['reason']) ? '' : '<br />' . $_SESSION['ban']['cannot_login']['reason']) . '<br />' . (!empty($_SESSION['ban']['expire_time']) ? sprintf($txt['your_ban_expires'], timeformat($_SESSION['ban']['expire_time'], false)) : $txt['your_ban_expires_never']) . '<br />' . $txt['ban_continue_browse'], 'user');
    }
    // Fix up the banning permissions.
    if (isset($user_info['permissions'])) {
        banPermissions();
    }
}
Example #3
0
function ssi_pollVote()
{
    global $context, $db_prefix, $user_info, $sc, $smcFunc, $sourcedir, $modSettings;
    if (!isset($_POST[$context['session_var']]) || $_POST[$context['session_var']] != $sc || empty($_POST['options']) || !isset($_POST['poll'])) {
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<script type="text/javascript"><!-- // --><![CDATA[
		history.go(-1);
	// ]]></script>
</head>
<body>&laquo;</body>
</html>';
        return;
    }
    // This can cause weird errors! (ie. copyright missing.)
    checkSession();
    $_POST['poll'] = (int) $_POST['poll'];
    // Check if they have already voted, or voting is locked.
    $request = $smcFunc['db_query']('', '
		SELECT
			p.id_poll, p.voting_locked, p.expire_time, p.max_votes, p.guest_vote,
			t.id_topic,
			IFNULL(lp.id_choice, -1) AS selected
		FROM {db_prefix}polls AS p
			INNER JOIN {db_prefix}topics AS t ON (t.id_poll = {int:current_poll})
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
			LEFT JOIN {db_prefix}log_polls AS lp ON (lp.id_poll = p.id_poll AND lp.id_member = {int:current_member})
		WHERE p.id_poll = {int:current_poll}
			AND {query_see_board}' . ($modSettings['postmod_active'] ? '
			AND t.approved = {int:is_approved}' : '') . '
		LIMIT 1', array('current_member' => $user_info['id'], 'current_poll' => $_POST['poll'], 'is_approved' => 1));
    if ($smcFunc['db_num_rows']($request) == 0) {
        die;
    }
    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);
    if (!empty($row['voting_locked']) || $row['selected'] != -1 && !$user_info['is_guest'] || !empty($row['expire_time']) && time() > $row['expire_time']) {
        redirectexit('topic=' . $row['id_topic'] . '.0');
    }
    // Too many options checked?
    if (count($_REQUEST['options']) > $row['max_votes']) {
        redirectexit('topic=' . $row['id_topic'] . '.0');
    }
    // It's a guest who has already voted?
    if ($user_info['is_guest']) {
        // Guest voting disabled?
        if (!$row['guest_vote']) {
            redirectexit('topic=' . $row['id_topic'] . '.0');
        } elseif (isset($_COOKIE['guest_poll_vote']) && in_array($row['id_poll'], explode(',', $_COOKIE['guest_poll_vote']))) {
            redirectexit('topic=' . $row['id_topic'] . '.0');
        }
    }
    $options = array();
    $inserts = array();
    foreach ($_REQUEST['options'] as $id) {
        $id = (int) $id;
        $options[] = $id;
        $inserts[] = array($_POST['poll'], $user_info['id'], $id);
    }
    // Add their vote in to the tally.
    $smcFunc['db_insert']('insert', $db_prefix . 'log_polls', array('id_poll' => 'int', 'id_member' => 'int', 'id_choice' => 'int'), $inserts, array('id_poll', 'id_member', 'id_choice'));
    $smcFunc['db_query']('', '
		UPDATE {db_prefix}poll_choices
		SET votes = votes + 1
		WHERE id_poll = {int:current_poll}
			AND id_choice IN ({array_int:option_list})', array('option_list' => $options, 'current_poll' => $_POST['poll']));
    // Track the vote if a guest.
    if ($user_info['is_guest']) {
        $_COOKIE['guest_poll_vote'] = !empty($_COOKIE['guest_poll_vote']) ? $_COOKIE['guest_poll_vote'] . ',' . $row['id_poll'] : $row['id_poll'];
        require_once $sourcedir . '/Subs-Auth.php';
        $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
        smf_setcookie('guest_poll_vote', $_COOKIE['guest_poll_vote'], time() + 2500000, $cookie_url[1], $cookie_url[0], false, false);
    }
    redirectexit('topic=' . $row['id_topic'] . '.0');
}
Example #4
0
/**
 * Allow the user to vote.
 * It is called to register a vote in a poll.
 * Must be called with a topic and option specified.
 * Requires the poll_vote permission.
 * Upon successful completion of action will direct user back to topic.
 * Accessed via ?action=vote.
 *
 * @uses Post language file.
 */
function Vote()
{
    global $topic, $txt, $user_info, $smcFunc, $sourcedir, $modSettings;
    // Make sure you can vote.
    isAllowedTo('poll_vote');
    loadLanguage('Post');
    // Check if they have already voted, or voting is locked.
    $request = $smcFunc['db_query']('', '
		SELECT IFNULL(lp.id_choice, -1) AS selected, p.voting_locked, p.id_poll, p.expire_time, p.max_votes, p.change_vote,
			p.guest_vote, p.reset_poll, p.num_guest_voters
		FROM {db_prefix}topics AS t
			INNER JOIN {db_prefix}polls AS p ON (p.id_poll = t.id_poll)
			LEFT JOIN {db_prefix}log_polls AS lp ON (p.id_poll = lp.id_poll AND lp.id_member = {int:current_member} AND lp.id_member != {int:not_guest})
		WHERE t.id_topic = {int:current_topic}
		LIMIT 1', array('current_member' => $user_info['id'], 'current_topic' => $topic, 'not_guest' => 0));
    if ($smcFunc['db_num_rows']($request) == 0) {
        fatal_lang_error('poll_error', false);
    }
    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);
    // If this is a guest can they vote?
    if ($user_info['is_guest']) {
        // Guest voting disabled?
        if (!$row['guest_vote']) {
            fatal_lang_error('guest_vote_disabled');
        } elseif (!empty($_COOKIE['guest_poll_vote']) && preg_match('~^[0-9,;]+$~', $_COOKIE['guest_poll_vote']) && strpos($_COOKIE['guest_poll_vote'], ';' . $row['id_poll'] . ',') !== false) {
            // ;id,timestamp,[vote,vote...]; etc
            $guestinfo = explode(';', $_COOKIE['guest_poll_vote']);
            // Find the poll we're after.
            foreach ($guestinfo as $i => $guestvoted) {
                $guestvoted = explode(',', $guestvoted);
                if ($guestvoted[0] == $row['id_poll']) {
                    break;
                }
            }
            // Has the poll been reset since guest voted?
            if ($row['reset_poll'] > $guestvoted[1]) {
                // Remove the poll info from the cookie to allow guest to vote again
                unset($guestinfo[$i]);
                if (!empty($guestinfo)) {
                    $_COOKIE['guest_poll_vote'] = ';' . implode(';', $guestinfo);
                } else {
                    unset($_COOKIE['guest_poll_vote']);
                }
            } else {
                fatal_lang_error('poll_error', false);
            }
            unset($guestinfo, $guestvoted, $i);
        }
    }
    // Is voting locked or has it expired?
    if (!empty($row['voting_locked']) || !empty($row['expire_time']) && time() > $row['expire_time']) {
        fatal_lang_error('poll_error', false);
    }
    // If they have already voted and aren't allowed to change their vote - hence they are outta here!
    if (!$user_info['is_guest'] && $row['selected'] != -1 && empty($row['change_vote'])) {
        fatal_lang_error('poll_error', false);
    } elseif (!empty($row['change_vote']) && !$user_info['is_guest'] && empty($_POST['options'])) {
        checkSession('request');
        $pollOptions = array();
        // Find out what they voted for before.
        $request = $smcFunc['db_query']('', '
			SELECT id_choice
			FROM {db_prefix}log_polls
			WHERE id_member = {int:current_member}
				AND id_poll = {int:id_poll}', array('current_member' => $user_info['id'], 'id_poll' => $row['id_poll']));
        while ($choice = $smcFunc['db_fetch_row']($request)) {
            $pollOptions[] = $choice[0];
        }
        $smcFunc['db_free_result']($request);
        // Just skip it if they had voted for nothing before.
        if (!empty($pollOptions)) {
            // Update the poll totals.
            $smcFunc['db_query']('', '
				UPDATE {db_prefix}poll_choices
				SET votes = votes - 1
				WHERE id_poll = {int:id_poll}
					AND id_choice IN ({array_int:poll_options})
					AND votes > {int:votes}', array('poll_options' => $pollOptions, 'id_poll' => $row['id_poll'], 'votes' => 0));
            // Delete off the log.
            $smcFunc['db_query']('', '
				DELETE FROM {db_prefix}log_polls
				WHERE id_member = {int:current_member}
					AND id_poll = {int:id_poll}', array('current_member' => $user_info['id'], 'id_poll' => $row['id_poll']));
        }
        // Redirect back to the topic so the user can vote again!
        if (empty($_POST['options'])) {
            redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
        }
    }
    checkSession('request');
    // Make sure the option(s) are valid.
    if (empty($_POST['options'])) {
        fatal_lang_error('didnt_select_vote', false);
    }
    // Too many options checked!
    if (count($_REQUEST['options']) > $row['max_votes']) {
        fatal_lang_error('poll_too_many_votes', false, array($row['max_votes']));
    }
    $pollOptions = array();
    $inserts = array();
    foreach ($_REQUEST['options'] as $id) {
        $id = (int) $id;
        $pollOptions[] = $id;
        $inserts[] = array($row['id_poll'], $user_info['id'], $id);
    }
    // Add their vote to the tally.
    $smcFunc['db_insert']('insert', '{db_prefix}log_polls', array('id_poll' => 'int', 'id_member' => 'int', 'id_choice' => 'int'), $inserts, array('id_poll', 'id_member', 'id_choice'));
    $smcFunc['db_query']('', '
		UPDATE {db_prefix}poll_choices
		SET votes = votes + 1
		WHERE id_poll = {int:id_poll}
			AND id_choice IN ({array_int:poll_options})', array('poll_options' => $pollOptions, 'id_poll' => $row['id_poll']));
    // If it's a guest don't let them vote again.
    if ($user_info['is_guest'] && count($pollOptions) > 0) {
        // Time is stored in case the poll is reset later, plus what they voted for.
        $_COOKIE['guest_poll_vote'] = empty($_COOKIE['guest_poll_vote']) ? '' : $_COOKIE['guest_poll_vote'];
        // ;id,timestamp,[vote,vote...]; etc
        $_COOKIE['guest_poll_vote'] .= ';' . $row['id_poll'] . ',' . time() . ',' . (count($pollOptions) > 1 ? explode(',' . $pollOptions) : $pollOptions[0]);
        // Increase num guest voters count by 1
        $smcFunc['db_query']('', '
			UPDATE {db_prefix}polls
			SET num_guest_voters = num_guest_voters + 1
			WHERE id_poll = {int:id_poll}', array('id_poll' => $row['id_poll']));
        require_once $sourcedir . '/Subs-Auth.php';
        $cookie_url = url_parts(!empty($modSettings['localCookies']), !empty($modSettings['globalCookies']));
        smf_setcookie('guest_poll_vote', $_COOKIE['guest_poll_vote'], time() + 2500000, $cookie_url[1], $cookie_url[0], false, false);
    }
    // Maybe let a social networking mod log this, or something?
    call_integration_hook('integrate_poll_vote', array(&$row['id_poll'], &$pollOptions));
    // Return to the post...
    redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
}