= '{$begin_day} 00:00:00'"; } else { $last = "q_num = '$q_num'"; } global $session; $q = <<db->query($q); $session->db->next_record(); $question_num = $session->db->f('q_num'); if(!$question_num) { # echo "No questions"; $bt = "There are no questions at this time, try back soon" . "we update this on a daily basis."; } else { $question = $session->db->f('question'); $question = stripslashes($question); $q_type = $session->db->f('type'); $answers = $session->db->f('answers'); if($q_type == "M" || $q_type == "C") { $answers = split(":", $answers); $acount = count($answers); for($i=0;$i < $acount;$i++) { $counter++; $amenu .= ""; } } elseif($q_type == "T") { $amenu = "\n"; } else { $amenu = "\n"; } } $qanda[] = $question; $qanda[] = $amenu; $qanda[] = $question_num; return($qanda); } function add_vote($q_num,$answer) { global $session,$auth; $q = <<db->query($q); if(!$session->db->affected_rows($q)) { $q = <<db->query($q); } } function has_voted($q_num) { global $session,$auth; $q = <<db->query($q); $session->db->next_record(); $voted = $session->db->f('user_id'); if($voted) { return(true); } else { return(false); } } function fetch_vote_answers($q_num) { $a_num--; global $session; $q = <<db->query($q); $session->db->next_record(); $answer = $session->db->f('answers'); $answers = explode(":",$answer); return($answers); } function get_votes($q_num,$a) { global $session; $q = <<db->query($q); $session->db->next_record(); return($session->db->f('count(*)')); } function fetch_vote_stats($q_num) { global $session; $mbg = "#555599"; $answers = fetch_vote_answers($q_num); $total = count($answers); for($a=0;$a<$total;$a++) { $answer = $answers[$a]; $temp = $a+1; $atotal = get_votes($q_num,$temp); $gtotal = $gtotal + $atotal; $totals[$a] = $atotal; } $numanswers = count($totals); $tb = << Total Votes {$gtotal} EOT; for($i=0;$i < $numanswers;$i++) { $answer = $answers[$i]; $counter++; $this_answer_total = $totals[$i]; $bp = ceil($this_answer_total / $gtotal * 100); $bmp = $bp * 4; if($bp <= 20) { $bar = "images/bar1.gif"; } elseif($bp <= 40) { $bar = "images/bar2.gif"; } elseif($bp <= 60) { $bar = "images/bar3.gif"; } elseif($bp <= 80) { $bar = "images/bar4.gif"; } else { $bar = "images/bar5.gif"; } $g = ""; $quest = $totals->$i->q; $tb .= <<($counter) {$answer} {$bp}%
$this_answer_total
  EOT; } # $tb .= ""; return($tb); } if($admin_level) { } else { } if($v_num) { $forward = $v_num; } $qanda = fetch_new_question($q_num); $question = $qanda[0]; $amenu = $qanda[1]; $q_num = $qanda[2]; $vote = has_voted($q_num); if(!$answer && !$vote && $question && !$forward) { $bt = << We're Taking a Poll! Please help us and vote on issues.

$question



We can only be as good as you want us to be, with your help we can be even better. This page is to assist us in being just what you want. If you have suggestions for other questions let us know. Suggestions EOT; } elseif(!$question && !$forward) { $bt = "

There are no questions at this time

"; } else { if($forward) { $q_num = $forward; } $quest = fetch_new_question($q_num); $message = "" . $quest[0] . "
"; if(!$vote && !$forward) { if($answer != "Choose..." && $answer && $auth) { add_vote($q_num,$answer); $message .= <<
EOT; } else { covertracks($PHP_SELF); } } elseif($vote) { $message .= << Current stats on this question are as follows...

EOT; } $bt = "" . $message; $bt .= fetch_vote_stats($q_num); } $bt = make_table($bt,"70","yes"); print showpage($bt,"opinion"); ?>