= first AND $nip <= last") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) > 0) die($tracker_lang['index00001'] . " $ip " . $tracker_lang['index00002'] . "."); if ($CURUSER["class"] >= 7 && $ip != $CURUSER["adminip"]) { logoutcookie(); header("Location: $DEFAULTBASEURL/login.php?error=ip"); } if ($_SERVER["REQUEST_METHOD"] == "POST") { $choice = $_POST["choice"]; if ($CURUSER && $choice != "" && $choice < 256 && $choice == floor($choice)) { $res = sql_query("SELECT * FROM polls ORDER BY added DESC LIMIT 1") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_assoc($res) or die($tracker_lang['index00003']); $pollid = $arr["id"]; $userid = $CURUSER["id"]; $res = sql_query("SELECT * FROM pollanswers WHERE pollid=$pollid && userid=$userid") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_assoc($res); if ($arr) die($tracker_lang['index00004']); sql_query("INSERT INTO pollanswers VALUES(0, $pollid, $userid, $choice)") or sqlerr(__FILE__, __LINE__); if (mysql_affected_rows() != 1) stderr($tracker_lang['error'], $tracker_lang['index00005']); header("Location: $DEFAULTBASEURL/"); die; } else stderr($tracker_lang['error'], $tracker_lang['index00006']); } stdhead($tracker_lang['homepage']); print("
"); print(""); print(""); print(""); print(""); print("
" . $tracker_lang['news']); if(get_user_class() >= UC_ADMINISTRATOR){ print(" - [".$tracker_lang['create']."]"); } else { } print("

"); if(!$CURUSER) { } else { $resource = sql_query("SELECT * FROM news WHERE ADDDATE(news.added, INTERVAL 30 DAY) > NOW() ORDER BY added DESC LIMIT 10") or sqlerr(__FILE__, __LINE__); print(""); // if (mysql_num_rows($resource)) { print("
\n
    "); while($array = mysql_fetch_array($resource)) { if ($news_flag == 0) { print(" "); print("".date("d.m.Y",strtotime($array['added']))." - \n"); print("".$array['subject']."\n"); print("".format_comment($array['body']).""); if (get_user_class() >= UC_ADMINISTRATOR) { print("[Edit]"); print("[Delete]"); } print("

    "); $news_flag = 1; } else { print("< "); print("".date("d.m.Y",strtotime($array['added']))." - \n"); print("".$array['subject']."\n"); print("".format_comment($array['body']).""); if (get_user_class() >= UC_ADMINISTRATOR) { print("[Edit]"); print("[Delete]"); } print("

    "); } } print("
\n"); } else { } print("
"); print("
"); $res = sql_query("SELECT * FROM polls ORDER BY added DESC LIMIT 1") or sqlerr(__FILE__, __LINE__); if($pollok=(mysql_num_rows($res))) { $arr = mysql_fetch_assoc($res); $pollid = $arr["id"]; $userid = $CURUSER["id"]; $question = $arr["question"]; $o = array($arr["option0"], $arr["option1"], $arr["option2"], $arr["option3"], $arr["option4"], $arr["option5"], $arr["option6"], $arr["option7"], $arr["option8"], $arr["option9"], $arr["option10"], $arr["option11"], $arr["option12"], $arr["option13"], $arr["option14"], $arr["option15"], $arr["option16"], $arr["option17"], $arr["option18"], $arr["option19"]); $res = sql_query("SELECT * FROM pollanswers WHERE pollid=$pollid AND userid=$userid") or sqlerr(__FILE__, __LINE__); $arr2 = mysql_fetch_assoc($res); } print("
"); print("
"); print("
"); print(""); print(""); print(""); print(""); print("
" . $tracker_lang['poll']); if(get_user_class() >= UC_JMODERATOR){ print(" - [".$tracker_lang['create']."] [Редактирай] [Изтрий]"); } else { } print("
"); if($pollok) { print("

$question

\n"); $voted = $arr2; if ($voted) { if ($arr["selection"]) $uservote = $arr["selection"]; else $uservote = -1; $res = sql_query("SELECT selection FROM pollanswers WHERE pollid=$pollid AND selection < 20") or sqlerr(__FILE__, __LINE__); $tvotes = mysql_num_rows($res); $vs = array(); $os = array(); while ($arr2 = mysql_fetch_row($res)) $vs[$arr2[0]] += 1; reset($o); for ($i = 0; $i < count($o); ++$i) if ($o[$i]) $os[$i] = array($vs[$i], $o[$i]); function srt($a,$b) { if ($a[0] > $b[0]) return -1; if ($a[0] < $b[0]) return 1; return 0; } if ($arr["sort"] == "yes") usort($os, srt); print print("\n"); $i = 0; while ($a = $os[$i]) { if ($i == $uservote) $a[1] .= " *"; if ($tvotes == 0) $p = 0; else $p = round($a[0] / $tvotes * 100); print("\n"); ++$i; } print("
" . $a[1] . "  " . " $p%
\n"); $tvotes = number_format($tvotes); print("

Гласували: $tvotes

\n"); } else { print("
\n"); $i = 0; while ($a = $o[$i]) { print("$a
\n"); ++$i; } print("
"); print("".$tracker_lang['blank_vote']."
\n"); print("

"); print("
"); } if ($voted) print("
".$tracker_lang['old_polls']." - Коментирай анкетата
\n"); if (get_user_class() >= UC_JMODERATOR) { print("
"); print("
Анкети информация
"); } } else { } print("
"); } //print("
"); ?>

"); loggedinorreturn(); ?>



Чат:    [Обнови чата]   [More smiles]

Емоциконки:

BB Codes: [Картинка] [Удебелен] [Синьо] [Жълто] [Червено] [Пурпурно] [Оранжево] [Зелено]

"); //// stdfoot(); ?>