📄 annex-poll.php
字号:
<?php
include'include/begin.php';
$style_id=(int)$_GET['sid'];
if (file_exists('./cache/template/tpl_' . $style_id . '_read.php')) {
include_once'./cache/template/tpl_' . $style_id . '_read.php';
}else{
jsechoerror(0);
}
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
$aid = (int)$_GET["aid"];
$result = mysql_query("select * from {$db_prefix}annex where id='$aid' && fix='1'", $myconn);
if ($annexs = mysql_fetch_array($result)) {
if ($annexs['code'] != 'poll') {
jsechoerror(10);
}
$tid = $annexs['tid'];
$result = mysql_query("select * from {$db_prefix}title where cid='$tid'", $myconn);
if (!$trow = mysql_fetch_array($result)) {
$yt = 1;
$result = mysql_query("select * from {$db_prefix}posts where id='$tid'", $myconn);
$row = mysql_fetch_array($result);
$result = mysql_query("select * from {$db_prefix}title where cid='$row[tid]'", $myconn);
$trow = mysql_fetch_array($result);
}
$fid = $trow['fid'];
forumpurview();
include language();
if (!$userp3[3]) {
jsechoerror(0);
}
$trow['state'] || $userp3[18] && !$trow['state']?null: jsechoerror(0);
if ($yt) {
!$row['state'] && !$userp3[18]?jsechoerror(0): null;
} else {
$trow[elite] == 0 || $userp3[37] && $trow[elite] == 1?null : jsechoerror(0);
}
$annextype = explode('|', $annexs['type']);
$downuser = explode(',', $annexs['downuser']);
if (!isset($_POST['poll']) || !$annextype[0] && !is_numeric($_POST['poll']) || $annextype[0] && !is_array($_POST['poll'])) {
jsechoerror(0);
}
if ($annextype[1] && !$username) {
jsechoerror(136);
}
!$annextype[1] && in_array($_SERVER['REMOTE_ADDR'], $downuser) || $annextype[1] && in_array($username, $downuser)?jsechoerror(121): null;
unset($polllist, $pollscontent, $value, $polls);
$content = explode('|', htmlspecialchars($annexs['content']));
if (is_array($_POST['poll'])) {
while (list(, $val) = each($_POST['poll'])) {
$value[$val] = 1;
}
} else {
$value[$_POST['poll']] = 1;
} while (list($key, $val) = @each($content)) {
$poll = explode("\t", $val);
$pollscontent[$key] = $poll[0];
$polls[$key] = $poll[1] + $value[$key];
}
$pollnum = array_sum($polls);
while (list($key, $val) = each($polls)) {
$polllist[] = $pollscontent[$key] . "\t" . $polls[$key];
$pollslist .= tpl_fun_jjx15(array('pcontent' => trim($pollscontent[$key]), 'polls' => $polls[$key], 'bkey' => @number_format($polls[$key] / $pollnum * 100, 1)));
}
$polllist = addslashes(implode('|', $polllist));
$downuser[] = $annextype[1]?$username : $_SERVER['REMOTE_ADDR'];
$downusers = implode(',', $downuser);
ka($downusers, 65500);
ka($polllist, 65500);
mysql_query("update {$db_prefix}annex set downuser='$downusers', content='$polllist',downnum='$pollnum' where id='$aid'", $myconn);
$annextype[1]?$downuser = implode(' ', $downuser):$usecho = 'display: none;';
$innerHTML = str_replace("\"", "\\\"", tpl_fun_jjx13(array('downuser' => $downuser, 'usecho' => $usecho, 'r_echo' => $html[0]?'display: none;':'', 'c_echo' => $html[0]?'':'display: none;', 'pollnum' => $pollnum, 'title' => $a_title, 'jjx15' => $pollslist)));
$innerHTML = str_replace("\r", '',$innerHTML);
$innerHTML = str_replace("\n", '',$innerHTML);
echo '<script language="javascript">';
echo 'var emessage = window.parent.document.getElementById(\'annex' . $aid . '\');';
echo 'emessage.innerHTML ="' . $innerHTML . '";';
echo '</script>';
exit;
}
jsechoerror(98);
function jsechoerror($number)
{
global $aid, $templatedir;
include file_exists('./' . $templatedir . '/message.php')?'./' . $templatedir . '/message.php' : './template/default/message.php';
echo '<script language="javascript">';
echo 'var emessage = window.parent.document.getElementById(\'a' . $aid . '\');';
echo 'emessage.innerHTML ="' . $errormessage[$number] . '";';
echo '</script>';
exit;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -