zhangjingyu
先把代码贴上,明天再说“逻辑”错在哪里。
if($ext_action == 'vote'){
S::gp(array('tid','item_id'));
if(!in_array($groupid, $picvote_config['vote_permission'])){
Showmsg('您没有权限投票!');
}
$post_info = $db->get_one("SELECT * FROM pw_ext_picvote_post WHERE tid =".S::sqlEscape($tid));
if($post_info['end_time']$timestamp){
Showmsg('投票尚未开始!');
}
$idvote_count = $db->get_value("SELECT COUNT(*) FROM pw_ext_picvote_log WHERE tid =".S::sqlEscape($tid)." AND uid =".S::sqlEscape($winduid));
if($post_info['num_limit']get_value("SELECT COUNT(*) FROM pw_ext_picvote_log WHERE tid =".S::sqlEscape($tid)." AND ip =".S::sqlEscape($onlineip));
if($post_info['ip_limit']get_value("SELECT COUNT(*) FROM pw_ext_picvote_log WHERE item_id =".S::sqlEscape($item_id)." AND uid =".S::sqlEscape($winduid));
if($already_vote){
Showmsg('您已经为该选手投过票啦!');
}
$db->update("UPDATE pw_ext_picvote_item SET vote=vote+1 WHERE id=".S::sqlEscape($item_id));
$db->update("INSERT INTO pw_ext_picvote_log SET ". S::sqlSingle(array(
'item_id' => $item_id,
'tid' => $tid,
'uid' => $winduid,
'username' => $windid,
'ip' => $onlineip,
'vote_time' => $timestamp,
)));
echo "操作成功!\treload";
ajax_footer();
} elseif ($ext_action ==