首页| 版块| 我的| 发帖| 消息
主题:测试图片投票帖
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 ==
zhangjingyu回帖于2018-08-06 22:34[查看电脑版]
下一页 (1/2)
下一楼»:hack/ext_thread/threadtype/picvote/index.php
楼上代码3-5行为投票权限判断;
6-12 ..
«上一楼:困了,睡觉,明天再更新吧。

查看全部回帖(22)
«返回主帖