EzPortal - Portal Software for Forums

EzPortal - Made to Fit Your SMF Forum - Glad You Found Us!
+- +-

UserBox

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Recent Posts

New built in translations for six langauges! by EzPortal
March 26, 2024, 11:15:32 pm

Smiley missing in shoutbox 2.1.4 by hustreamload
July 26, 2023, 08:14:02 am

Re: Theme Select Box question? by Shades
March 15, 2023, 06:49:49 pm

Re: Theme Select Box question? by Shades
March 09, 2023, 02:09:24 pm

Re: Theme Select Box question? by Shades
March 09, 2023, 01:55:53 pm

Re: Theme Select Box question? by EzPortal
March 09, 2023, 01:47:42 pm

Re: Theme Select Box question? by Shades
March 09, 2023, 01:34:07 pm

Re: Theme Select Box question? by EzPortal
March 09, 2023, 12:20:17 pm

+- HTML Menu


Sample HTML Block Usage - You May Custom Code it, as needed!

Recent Topics ezBlock

New built in translations for six langauges! by EzPortal
March 26, 2024, 11:15:32 pm

Smiley missing in shoutbox 2.1.4 by hustreamload
July 26, 2023, 08:14:02 am

Theme Select Box question? by Shades
March 15, 2023, 06:49:49 pm

Where is the facebook button color? by EzPortal
February 28, 2023, 06:45:09 pm

Display on Mobile - SMF 2.1.3 and EZ 5.5.2 by BugginIn
December 29, 2022, 04:07:13 pm

Blocks Help by Riggs1973
November 20, 2022, 12:59:30 pm

Surface ol lite theme release Free! by Steffen K.
November 18, 2022, 03:57:24 am

Undefined index: href by EzPortal
October 04, 2022, 08:49:59 pm

SMF-ezportal_column_5.cache): failed to open stream: No such file or directory by EzPortal
June 04, 2022, 11:40:13 am

Arcade block error: failed to open stream: No such file or directory by Shades
May 20, 2022, 02:47:13 pm

Author Topic: Not voting on homepage  (Read 5042 times)

0 Members and 1 Guest are viewing this topic.

Offline os13

  • Posts: 1
  • Karma: 0
Not voting on homepage
« on: August 29, 2011, 04:40:15 pm »
Hey, i have EzPortal and whenever i try to vote...it doesn't count the vote and it redirects me to the same page...so basically nothing happens. Here is my function ssi_pollVote() in SSI.php

Code: [Select]
// Takes care of voting - don't worry, this is done automatically.
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');
// Already voted?
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']));
setcookie('guest_poll_vote', $_COOKIE['guest_poll_vote'], time() + 2500000, $cookie_url[1], $cookie_url[0], 0);
}

redirectexit('topic=' . $row['id_topic'] . '.0');
}


If you wanna check it out, please visit http://businesslynx.ca

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
7008 Views
Last post January 30, 2009, 06:18:12 pm
by alanrobinsonleigh
8 Replies
43493 Views
Last post January 22, 2013, 08:49:35 am
by EzPortal
7 Replies
11130 Views
Last post October 21, 2013, 10:56:02 am
by Jonas1975
1 Replies
5144 Views
Last post February 15, 2015, 04:28:18 pm
by EzPortal
4 Replies
6405 Views
Last post January 22, 2017, 05:55:32 am
by fichtre

+-SMF Gallery

Quick Menu


Powered by EzPortal