代码拉取完成,页面将自动刷新
同步操作将从 foru/ForU CMS 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
$c_main = 'vote';
include './library/inc.php';
non_numeric_back(intval($_GET['id']), $_lang['illegal']);
// 记入投票数据
if ($act == 'vote') {
if ($db->getOne("SELECT id FROM cms_vote_log WHERE l_ip = '" . getIp() . "'") && !empty($_COOKIE['cms']['ifvote'])) {
alert_href('您已参与过投票,谢谢您的支持!', 'vote.php?act=view&id=' . $_GET['id']);
}
foreach ($_GET['vote'] as $row) {
non_numeric_back(intval($_GET['vote']), $_lang['illegal']);
$arr['v_id'] = $_GET['id'];
$arr['o_id'] = $row;
$arr['l_ip'] = getIp();
$arr['l_date'] = gmtime();
$db->autoExecute('cms_vote_log', $arr, 'INSERT');
// 更新项目统计
$db->query("UPDATE cms_vote SET v_count=v_count+1 WHERE id=" . $_GET['id']);
$db->query("UPDATE cms_vote_option SET o_count=o_count+1 WHERE id=" . $row);
}
setcookie('cms[ifvote]', 1, gmtime()+COOKIE_EXPIRE);
alert_href('您已完成投票,谢谢您的支持!', 'vote.php?act=view&id=' . $_GET['id']);
}
elseif ($act == 'view') {
// 获取投票数据
$vote = $db->getRow("SELECT * FROM cms_vote WHERE id = " . $_GET['id']);
$vote_option = $db->getAll("SELECT * FROM cms_vote_option WHERE v_id = " . $vote['id'] . " ORDER BY id ASC");
if ($vote['v_count'] == 0) {
foreach ($vote_option as $key => $val) {
$vote_option[$key]['pct'] = '0%';
}
} else {
foreach ($vote_option as $key => $val) {
$vote_option[$key]['pct'] = round($val['o_count'] / $vote['v_count'] * 100) . '%';
}
}
}
else {
// 获取投票数据
$vote = $db->getRow("SELECT * FROM cms_vote WHERE id = " . $_GET['id']);
$vote_option = $db->getAll("SELECT * FROM cms_vote_option WHERE v_id = " . $vote['id'] . " ORDER BY o_order DESC,id ASC");
}
//读取指定的频道模型
include $t_path . self_name();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。