Seite 3 von 5

Verfasst: 03.06.2005 09:07
von Mänu

Verfasst: 03.06.2005 09:41
von Markus67
Hi ...

die functions_post.php ist in Ordnung.

suche in der posting.php

Code: Alles auswählen

	// Vote in a poll
	//
	if ( (!empty($HTTP_POST_VARS['vote_id'])) and (is_array($HTTP_POST_VARS['vote_id'])) and (isset($HTTP_POST_VARS['vote_id'])) )
	{
		$vote_option_id = intval($HTTP_POST_VARS['vote_id']);
		for($i = 0; $i < $max_voting; $i++)
			  {
			    $vote_option_id = $vbn[$i];
		$vote_id = $HTTP_POST_VARS['vote_id'];
		$sql = "SELECT vd.vote_id, vd.vote_max
			FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
			WHERE vd.topic_id = $topic_id
				AND vr.vote_id = vd.vote_id
				AND vr.vote_option_id = $vote_option_id
			GROUP BY vd.vote_id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
		}

		if ( $vote_info = $db->sql_fetchrow($result) )
		{
			$max_vote = $vote_info['vote_max'];
		}
		$max_voting=count($vote_id);
		if ($max_voting>$max_vote)
		{
			$max_voting=$max_vote;
		}
		for($i = 0; $i < $max_voting; $i++)
		{
			$vbn[$i]= $vote_id[$i];
		}

		$sql = "SELECT vd.vote_id
			FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
			WHERE vd.topic_id = $topic_id
				AND vr.vote_id = vd.vote_id
				AND vr.vote_option_id = $vote_option_id
			GROUP BY vd.vote_id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
		}

		if ( $vote_info = $db->sql_fetchrow($result) )
		{
			$vote_id = $vote_info['vote_id'];

			$sql = "SELECT *
				FROM " . VOTE_USERS_TABLE . "
				WHERE vote_id = $vote_id
					AND vote_user_id = " . $userdata['user_id'];

				if ( !$db->sql_query($sql, END_TRANSACTION) )
				{
					message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__, $sql);
				}

				$message = $lang['Vote_cast'];
			}
			else
			{
				$message = $lang['Already_voted'];
			}

			$db->sql_freeresult($result2);
		}

//		$db->sql_freeresult($result);

		$template->assign_vars(array(
			'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">')
		);
		$message .=  '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
		message_die(GENERAL_MESSAGE, $message);
	}
	else
	{
		redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
	}
}

else if ( $submit || $confirm )
ersetze mit:

Code: Alles auswählen

	// Vote in a poll
	//
	if ( !empty($HTTP_POST_VARS['vote_id']) )
	{
		$vote_option_id = intval($HTTP_POST_VARS['vote_id']);

		$vote_id = $HTTP_POST_VARS['vote_id'];
		$sql = "SELECT vd.vote_id, vd.vote_max    
			FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
			WHERE vd.topic_id = $topic_id 
				AND vr.vote_id = vd.vote_id 
				AND vr.vote_option_id = $vote_option_id
			GROUP BY vd.vote_id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
		}

		if ( $vote_info = $db->sql_fetchrow($result) )
		{
			$max_vote = $vote_info['vote_max'];
		}
		$max_voting=count($vote_id);
		if ($max_voting>$max_vote)
		{
			$max_voting=$max_vote;
		}
		for($i = 0; $i < $max_voting; $i++)
		{
			$vbn[$i]= $vote_id[$i];
		}

		$sql = "SELECT vd.vote_id    
			FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
			WHERE vd.topic_id = $topic_id 
				AND vr.vote_id = vd.vote_id 
				AND vr.vote_option_id = $vote_option_id
			GROUP BY vd.vote_id";
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, 'Could not obtain vote data for this topic', '', __LINE__, __FILE__, $sql);
		}

		if ( $vote_info = $db->sql_fetchrow($result) )
		{
			$vote_id = $vote_info['vote_id'];

			$sql = "SELECT * 
				FROM " . VOTE_USERS_TABLE . "  
				WHERE vote_id = $vote_id 
					AND vote_user_id = " . $userdata['user_id'];
			if ( !($result2 = $db->sql_query($sql)) )
			{
				message_die(GENERAL_ERROR, 'Could not obtain user vote data for this topic', '', __LINE__, __FILE__, $sql);
			}

			if ( !($row = $db->sql_fetchrow($result2)) )
			{

			  for($i = 0; $i < $max_voting; $i++)
			  {
			    $vote_option_id = $vbn[$i];


				$sql = "UPDATE " . VOTE_RESULTS_TABLE . " 
					SET vote_result = vote_result + 1 
					WHERE vote_id = $vote_id 
						AND vote_option_id = $vote_option_id";
				$vote_option_id = ''
				if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
				{
					message_die(GENERAL_ERROR, 'Could not update poll result', '', __LINE__, __FILE__, $sql);
				}

			  }
				$sql = "UPDATE " . VOTE_DESC_TABLE . " 
					SET vote_voted = vote_voted + 1 
					WHERE vote_id = $vote_id 
						AND topic_id = $topic_id";
				if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
				{
					message_die(GENERAL_ERROR, 'Could not update poll voted', '', __LINE__, __FILE__, $sql);
				}

				$sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip) 
					VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip')";
				if ( !$db->sql_query($sql, END_TRANSACTION) )
				{
					message_die(GENERAL_ERROR, "Could not insert user_id for poll", "", __LINE__, __FILE__, $sql);
				}

				$message = $lang['Vote_cast'];
			}
			else
			{
				$message = $lang['Already_voted'];
			}
			$db->sql_freeresult($result2);
		}
		else
		{
			$message = $lang['No_vote_option'];
		}
		$db->sql_freeresult($result);

		$template->assign_vars(array(
			'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">')
		);
		$message .=  '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id") . '">', '</a>');
		message_die(GENERAL_MESSAGE, $message);
	}
	else
	{
		redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
	}
}
else if ( $submit || $confirm )
Vorher eine Sicherungskopie deiner bisherigen posting.php erstellen :wink:

Markus

Verfasst: 03.06.2005 09:46
von Mänu
Krieg jetzt diese Fehlermeldung beim post erstellen
Parse error: parse error, unexpected $ in /home/www/web291/html/forum/posting.php on line 1604

Verfasst: 03.06.2005 09:48
von Markus67
Hi ...

verlinke nochmal bitte die neue posting.php

Markus

Verfasst: 03.06.2005 09:51
von Mänu
Ne, moment, ist diese fehlermeldung, hab mich vorher beim erstellen verschrieben:
Parse error: parse error, unexpected T_IF in /home/www/web291/html/forum/posting.php on line 869


http://www.maenumania.ch/files/posting.txt

Verfasst: 03.06.2005 10:12
von Markus67
Hi ...

suche in der posting.php

Code: Alles auswählen

  // Vote in a poll 
   // 
   if ( !empty($HTTP_POST_VARS['vote_id']) ) 
ersetze mit:

Code: Alles auswählen

  // Vote in a poll 
  // 
		if ( (!empty($HTTP_POST_VARS['vote_id'])) and (is_array($HTTP_POST_VARS['vote_id'])) and (isset($HTTP_POST_VARS['vote_id'])) )
Markus

Verfasst: 03.06.2005 10:16
von Mänu
Immer noch dasselbe..
Parse error: parse error, unexpected T_IF in /home/www/web291/html/forum/posting.php on line 869

Verfasst: 03.06.2005 10:43
von Markus67
Hi ...

Hast du zufällig noch den MOD Admin Voting eingebaut?
Verlinke mal bitte auch noch die viewtopic.php als txt-Datei.

Markus

Verfasst: 03.06.2005 10:50
von Mänu
Ne, nicht dass ich wüsste... :-?

viewtopic.txt

Verfasst: 03.06.2005 11:12
von Markus67
Hi ...

suche in der viewtopic.php

Code: Alles auswählen

$poll_expires_c = $lang['Results_after'];
ersetze mit:

Code: Alles auswählen

$poll_expires_c = '';
Sonst konnte ich da auch nichts finden.

Markus