sql_query($sql);
$row = $db->sql_fetchrow($result);
$pollID = $row[pollID];
if ($pollID == 0 || $pollID == "") {
$content .= "";
} else {
if (empty($ip)) { $ip = $_SERVER["REMOTE_ADDR"]; }
$revote=24*60*60; //you can revote after 24 hours
$past = time()-$revote;
$db->sql_query("DELETE FROM ".$prefix."_poll_check WHERE time < $past");
$sql="SELECT ip,time FROM ".$prefix."_poll_check WHERE (ip='$ip') AND (pollID='$pollID')";
$result = $db->sql_query($sql);
list($ips,$times) = $db->sql_fetchrow($result);
if ($ip == $ips) {
$time=$times;
$content = VoteResults($pollID,$ip,$time);
} else {
if(!isset($url))
$url = sprintf("modules.php?name=Surveys&op=results&pollID=%d", $pollID);
$content = "
\n\n";
}
}
function VoteResults($pollID,$ip,$time) {
global $pollcomm,$revote,$mode,$content,$resultTableBgColor, $resultBarFile, $Default_Theme, $user, $cookie, $prefix,$db,$admin, $module_name;
$mode=1; //choose your graphic 1,2 or 3
if(!isset($pollID)) $pollID = 1;
$sql="SELECT pollID, pollTitle, timeStamp, artid FROM ".$prefix."_poll_desc WHERE pollID='$pollID'";
$result = $db->sql_query($sql);
$holdtitle = $db->sql_fetchrow($result);
$content .= "$holdtitle[1]
";
for($i = 0; $i < 12; $i++) {
$sql="SELECT optionCount FROM ".$prefix."_poll_data WHERE pollID='$pollID' AND voteID='$i'";
$result = $db->sql_query($sql);
$object =sql_fetch_object($result,$db);
$optionCount =$object->optionCount;
$sum = (int)$sum+$optionCount;
}
for($i = 1; $i <= 12; $i++) {
$sql="SELECT pollID, optionText, optionCount, voteID FROM ".$prefix."_poll_data WHERE pollID='$pollID' AND voteID='$i' ";
$result = $db->sql_query($sql);
$object =sql_fetch_object($result,$db);
if(is_object($object)) {
$optionText = $object->optionText;
$optionCount = $object->optionCount;
if($optionText != "") {
$content .= "- $optionText :
";
if($sum) {
$percent = 100 * $optionCount / $sum;
} else {
$percent = 0;
}
$percentInt = (int)$percent;
$percent2 = (int)$percent;
// $percent3=sprintf(" %.1f%% ", $percent);
$percent3=sprintf("%.0f%%", $percent); // JagaTelesin
if ($mode==1){
if(is_user($user)) {
if($cookie[9]=="") $cookie[9]=$Default_Theme;
if(!$file=@opendir("themes/$cookie[9]")) {
$ThemeSel = $Default_Theme;
} else {
$ThemeSel = $cookie[9];
}
} else {
$ThemeSel = $Default_Theme;
}
if (file_exists("themes/$ThemeSel/images/survey_leftbar.gif") AND file_exists("themes/$ThemeSel/images/survey_mainbar.gif") AND file_exists("themes/$ThemeSel/images/survey_rightbar.gif")) {
$l_size = getimagesize("themes/$ThemeSel/images/survey_leftbar.gif");
$m_size = getimagesize("themes/$ThemeSel/images/survey_mainbar.gif");
$r_size = getimagesize("themes/$ThemeSel/images/survey_rightbar.gif");
$leftbar = "survey_leftbar.gif";
$mainbar = "survey_mainbar.gif";
$rightbar = "survey_rightbar.gif";
} else {
$l_size = getimagesize("themes/$ThemeSel/images/leftbar.gif");
$m_size = getimagesize("themes/$ThemeSel/images/mainbar.gif");
$r_size = getimagesize("themes/$ThemeSel/images/rightbar.gif");
$leftbar = "leftbar.gif";
$mainbar = "mainbar.gif";
$rightbar = "rightbar.gif";
}
if (file_exists("themes/$ThemeSel/images/survey_mainbar_d.gif")) {
$m1_size = getimagesize("themes/$ThemeSel/images/survey_mainbar_d.gif");
$mainbar_d = "survey_mainbar_d.gif";
if ($percent2 > 0 AND $percent2 <= 23) {
$salto = "
";
} elseif ($percent2 > 24 AND $percent2 < 50) {
$a = ($percentInt - 100)/2;
$salto = "
"
."
"
."
";
} elseif ($percent2 > 49 AND $percent2 < 75) {
//@RJR-Pwmg@Rncvkpwo@-@Eqratkijv@(e)@VgejIHZ.eqo
$a = ($percentInt - 200)/2;
$salto = "
"
."
"
."
"
."
"
."
";
} elseif ($percent2 > 74 AND $percent2 <= 100) {
$a = ($percentInt - 300)/2;
$salto = "
"
."
"
."
"
."
"
."
"
."
"
."
";
}
}
if ($percent > 0) {
$content .= "
";
if (file_exists("themes/$ThemeSel/images/survey_mainbar_d.gif")) {
$content .= "$salto";
} else {
$content .= "
";
}
$content .= "
";
} else {
$content .= "
";
if (!file_exists("themes/$ThemeSel/images/survey_mainbar_d.gif")) {
$content .= "
";
}
$content .= "
";
}
$content .= " $percent3";
$content .="
";
} else {
if ($mode==2) {
$color[1]="#FF3300";
$color[2]="#33CC33";
$color[3]="#0099FF";
$color[4]="#990066";
$color[5]="#FF9900";
$color[6]="#FF0000";
$color[7]="#FF66FF";
$color[8]="#FFFF00";
$color[9]="#FF3300";
$color[10]="#FF3300";
$color[11]="#FF3300";
$color[12]="#FF3300";
$content .= "";
if ($percent2==0) $percent2=1;
$content .= " | ";
$content .= " $percent3 | ";
$content.="
";
}
else {
$color[1]="aqua.gif";
$color[2]="red.gif";
$color[3]="blue.gif";
$color[4]="gold.gif";
$color[5]="green.gif";
$color[6]="yellow.gif";
$color[7]="purple.gif";
$color[8]="#orange.gif";
$color[9]="pink.gif";
$color[10]="darkgreen.gif";
$color[11]="brown.gif";
$color[12]="grey.gif";
$content .= "";
if ($percent2==0) $percent2=1;
$content .= "![](\"images/survey/$color[$i]\") | ";
$content .= "$percent3 | ";
$content.="
";
}
}
}
}
}
$content .= "";
$content .= "
";
if ($pollcomm) {
$numcom = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pollcomments WHERE pollID='$pollID'"));
$content .= "
"._VOTES.": $sum
"._PCOMMENTS." $numcom\n\n";
} else {
$content .= "
"._VOTES." $sum
";
}
$ctime=time();
$revote=24*60*60; //you can revote after 24 hours
$revote_1=$time+$revote-$ctime;
if ($revote_1 <= 60) {
$revote_main=$revote_1;
$string="second(s)";
} elseif ($revote_1 >60 AND $revote_1 <= 3600) {
$revote_main=$revote_1/60;
$revote_main=sprintf("%.1f",$revote_main);
$string="minutes(s)";
} elseif ($revote_1 > 3600 AND $revote_1<=86400) {
$revote_main=$revote_1/3600;
$revote_main=sprintf("%.1f",$revote_main);
$string="hour(s)";
} else {
$revote_main=$revote_1/86400;
$revote_main=sprintf("%.1f",$revote_main);
$string="day(s)";
}
$content .= "
Vote again in:
$revote_main $string
";
if (is_admin($admin)) {
global $admin_file;
$content .= "
[ "._ADD." | "._EDIT." ]";
}
return($content);
}
?>