ASP的投票程序

ASP的投票程序,第1张

1、用session来保存你需要的字段

比如登陆时登陆成功之后

session("username")=登陆用户名

session("userpass")=登陆密码

这样session就保存了你需要的字段内容

在其他页面 只要获取session就可以

比如:

name=session("username")

pass=session("userpass")

2、这个就好办了 登陆的时候不是判断用户名和密码正确吗

如果正确 直接用id=rs("u_id")就可以了

昨天你就问过这个问题了。好吧。给你写一个吧。现写的没有测试。你试下。有什么问题再问我。表一:【Vote】

1-ID【ID】自动编号

2-名称【Title】文本255

3-关联ID【GLID】数值:关联信息的ID以便在显示时区分不同信息的投票内容表二:【VoteInfo】

1-ID【ID】自动编号

2-名称【Title】文本255

3-点击量【Click】数值

4-关联ID【GLID】数值:关联表一的ID。建立多个投票选项

5-分数【Score】数值:单个选项的分数,-100~100

6-图标地址【ICOFile】文本255:显示图标的地址。建立原理:

制作显示的图片。

pic001a.gif 最大值的红色图

pic001b.gif 一般值得的图片

表一的GLID值不能为空。这个值是你的信息的ID值 <%

'连接数据内容省略

%><!--#include file = Conn.asp --><%

'Infoid为你信息的ID

if Infoid<>"" then

sqlVote = "select * from Vote where Title<>''"

sqlVote = sqlVote &" and [GLID]="&Infoid

Set rsVote = Server.CreateObject("ADODB.RecordSet")

rsVote.Open sqlVote,conn,1,1

if rsVote.recordcount<>0 then '最高记录数

sqlmax="select max(Click) as maxClick from VoteInfo"

Set rsmax = Server.CreateObject("ADODB.RecordSet")

rsmax.open sqlmax,conn,1,1

Max_Click=int(rsmax("maxClick"))

rsmax.close

set rsmax=nothing

sqlVoteInfo = "select * from VoteInfo where Title<>''"

sqlVoteInfo = sqlVoteInfo &" and [GLID]="&rsVote("ID")

Set rsVoteInfo = Server.CreateObject("ADODB.RecordSet")

rsVoteInfo.Open sqlVoteInfo,conn,1,1

if rsVoteInfo.recordcount<>0 then

%>

<table border="0" cellpadding="0" cellspacing="0" width="100%" height="120">

<tr>

<%

for VoteInfoi=1 to rsVoteInfo.recordcount'Max_Click最大的一个数值为100'这里可以加N个条件来显示图的结果。

if rsVoteInfo("Click")=Max_Click then

InfoIMG="pic001a.gif"

else

InfoIMG="pic001b.gif"

end if

%>

<td height="100">

<table border="0" cellpadding="0" cellspacing="0" width="100%" height="120">

<tr>

<td height="100" width="100%" valign=bottom align=center>

<%=rsVoteInfo("Click")%>

<br>

<img src="<%=InfoIMG%>" height="<%=int(rsVoteInfo("Click")/Max_Click*100)%>" width="30">

</td>

</tr>

<tr>

<td height="20" width="100%">

<%=rsVoteInfo("Title")%>

</td>

</tr>

</table>

</td>

<%

rsVoteInfo.movenext

if rsVoteInfo.eof then exit for

next

%>

</tr>

</table>

<%

end if

rsVoteInfo.close

set rsVoteInfo=nothing end if

end if

rsVote.close

set rsVote=nothing

conn.close '关闭数据库

set conn=nothing

%>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/8055848.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-13
下一篇 2023-04-13

发表评论

登录后才能评论

评论列表(0条)

保存