动网论坛教程:普通用户不能看投票结果的修改方法
2010-07-22 18:58:49 来源:WEB开发网page_dispbbs模板页中,template.html(9)修改为:
<!--投票判断不同用户部分-->
<tr><td class=tablebody2 colspan=2 height=25> 您还没有登录,不能进行投票;或者已经过了投票期限。</td></tr>||<tr><td colspan=2 height=25 class=tablebody1> <input type=submit name=Submit value='投 票'> [截止时间:{$timeout}]</td></tr>||<tr><td class=tablebody2 colspan=2 height=25> 您已经投过票了。[过期时间:{$timeout}]</td></tr>||<tr><td colspan=2 height=25 class=tablebody1> <input type=submit name=Submit value='投 票'> [截止时间:{$timeout} | <a href="javascript :openscript('viewvoters.asp?boardid={$boardid}&id={$voteid}',300,500)">查看投票用户</a>]</td></tr>||<tr><td class=tablebody2 colspan=2 height=25> 您已经投过票了,请看结果吧。[过期时间:{$timeout} | <a href="javascript :openscript('viewvoters.asp?boardid={$boardid}&id={$voteid}',300,500)">查看投票用户</a>]</td></tr>
然后在dispbbs.asp中,相应部分加个判断,将以下部份:
Set Trs=Dvbbs.Execute("Select Count(*) From Dv_voteuser Where voteid="&PollID&" And userid="&Dvbbs.userid)
If Trs(0)=0 Then
TempStr = Replace(TempStr,"{$uservoteinfo}",Split(template.html(9),"||")(1))
Else
TempStr = Replace(TempStr,"{$uservoteinfo}",Split(template.html(9),"||")(2))
End If
Set Trs=Nothing
改为:
Set Trs=Dvbbs.Execute("Select Count(*) From Dv_voteuser Where voteid="&PollID&" And userid="&Dvbbs.userid)
If Dvbbs.Membername="XX" then
If Trs(0)=0 Then
TempStr = Replace(TempStr,"{$uservoteinfo}",Split(template.html(9),"||")(3))
更多精彩
赞助商链接