<?php
chdir("../") or die("bleh");
include "inc/functions.inc.php";
$mysql = new mysql(DB_MAIN);
$pchoiceq = $mysql->select(PRE."forums_polls_options", "threadid='".$_POST['threadid']."' AND id='".$_POST['pollchoice']."'", "id", "ASC", "1");
while($pchoices = mysql_fetch_assoc($pchoiceq))
{
$choice = $_POST['pollchoice'];
$pone = $pchoices['votes'] + 1;
$mysql->update(PRE."forums_polls_options", "votes = votes + 1", "id='".$choice."'");
$mysql->update(PRE."forums_threads", "lastupdate='".time()."'", "id='".$_POST['threadid']."'");
$mysql->insert(PRE."forums_polls_votes", array('threadid', 'ident', 'option', 'date'), array($_POST['threadid'], $_COOKIE['mid'], $choice, time()));
header("Location: ".$_SERVER['HTTP_REFERER']);
}
?>