$text\n"; if ( !MemberPrintPoll( $ID ) ) echo _t_err("_No polls available") ."\n"; $ret = ob_get_contents(); ob_end_clean(); return $ret; } /** * Add vote */ function PolsVoteAdd ( ) { global $ID; if ( $_COOKIE["polls_question_{$ID}"] > 0 ) return 0; if ( !(int)$_POST['vote'] ) return 0; $res = db_res("UPDATE `polls_a` SET `Votes` = `Votes` + 1 WHERE `IDanswer` = ". (int)$_POST['vote']); if ( $res ) setcookie("polls_question_{$ID}", 1 , time() + ( 10000 * 3600 ), '/' ); return $res; } /** * Print a poll */ function MemberPrintPoll( $ID ) { $query = "SELECT max(`Votes`) AS `VotesMax` FROM `polls_a` WHERE `ID` = $ID"; $arr = db_arr($query); if ( !$arr ) return 0; $VotesMax = $arr['VotesMax']; $query = "SELECT `Question` FROM `polls_q` WHERE `Active` = 'on' AND `ID` = $ID"; $quest_arr = db_arr($query); if ( !$quest_arr ) return 0; $poll_question = process_line_output( $quest_arr['Question'] ); $query = "SELECT `IDanswer`, `Answer`, `Votes` FROM `polls_a` WHERE `ID` = $ID"; $res = db_res($query); if ( !$res ) return 0; if ( !mysql_num_rows($res) ) return 0; echo "
\n"; while ( $answ_arr = mysql_fetch_array($res) ) { $answer_text = process_line_output( $answ_arr['Answer'] ); echo " \n"; } echo "
{$poll_question}
  "; echo DesignProgressPos ( _t("_votes").": ".$answ_arr['Votes'], 200, $VotesMax, $answ_arr['Votes'] ); echo "
\n"; return 1; } ?>