|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
Windows本身的所有问题都会一成不变的也累加到了它的身上。安全性、稳定性、跨平台性都会因为与NT的捆绑而显现出来;1.vote.asp
<%@LANGUAGE="VBSCRIPT"%>
<%OPTIONEXPLICIT%>
<%Response.Buffer=True%>
<!--#INCLUDEFILE="adovbs.inc"-->
<%
***Remembertocreatethosevariablesbeforetryingtousethem.
DimobjConn
DimobjRec3
DimstrConnect
DimvarTopic,varTopicID,varSelectionNum,varSelected
Dimi,varTotal,varThis,varThisTitle,varAlreadyVote
strConnect="DRIVER={MicrosoftAccessDriver(*.mdb)};DBQ="&Server.MapPath("vote.mdb")&";DefaultDir="&Server.MapPath(".")&";DriverId=25;FILE=MSAccess;MaxBufferSize=512;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;;UserId=admin;"
SetobjConn=Server.CreateObject("ADODB.Connection")***CreateanADOdatabaseconnectionobject.
SetobjRec3=Server.CreateObject("ADODB.Recordset")**CreateanADORecordSetobject.
objConn.OpenstrConnect***Opentheconnectiontothedatabase
objRec3.Open"vote",objConn,adOpenForwardOnly,adLockPessimistic,adUseServer***Opentherecordset
varTopic=Request.Form("topic")
varTopicID=Request.Form("topicID")
ifvarTopicID=""then
varTopicID=Request.QueryString("topicID")
endif
varSelectionNum=Request.Form("selectionNum")
varSelected=Request.Form("selected")
objRec3.Filter=0
objRec3.Filter="topicID="&varTopicIDonlynumbercanbefilter?
IfNOTobjRec3.EOFthen
ifRequest.Form("selected")=""then
else
varAlreadyVote="alreadyVote"&"_"&varTopicID
ifSession(varAlreadyVote)"true"then
objRec3("selection"&varSelected&"_count")=objRec3("selection"&varSelected&"_count")+1
objRec3.Update
Session(varAlreadyVote)="true"
endif
endif
varTotal=0
fori=0toobjRec3("selectionNum")-1
varTotal=varTotal+objRec3("selection"&i&"_count")
next
%>
<palign=left><%=varTopic%></p>
<palign=center>
<tablewidth=480border=0cellspacing=0cellpadding=0bgcolor=#000000>
<captionalign=left><fontsize=2>共有<fontcolor=red><%=varTotal%></font>人列入</font></caption>
<tr><td>
<tablewidth=480border=0cellspacing=1cellpadding=3>
<trbgcolor=#dcdcdcalign=centervalign=center>
<thwidth=120><fontsize=2>选项</font></td>
<thwidth=300><fontsize=2>比例</font></td>
<thwidth=60><fontsize=2>人数</font></td>
</tr>
<%
fori=0toobjRec3("selectionNum")-1
varThisTitle=objRec3("selection"&i&"_title")
varThis=objRec3("selection"&i&"_count")
%>
<trbgcolor=#ffffffvalign=center>
<tdwidth=120align=center><fontsize=2color=#ff0000><%=varThisTitle%></font></td>
<tdwidth=300align=left><imgsrc="http://edu.cnzz.cn/NewsInfo/color.gif"width=<%=varThis*100/varTotal%>height=12border=0><fontsize=2color=#ff0000>
<%=left(varThis*100/varTotal,5)%>%
</font>
</td>
<tdwidth=60align=center><fontsize=2color=#ff0000><%=varThis%></font></td>
</tr>
<%
next
%>
</table>
</td></tr>
</table></p>
<%
elsenothistopicyet
objRec3.AddNew
objRec3("topicID")=varTopicID
objRec3("topic")=varTopic
objRec3("selectionNum")=varSelectionNum
fori=0tovarSelectionNum
objRec3("selection"&i&"_title")=Request.Form("selection"&i&"_title")
next
objRec3.Update
response.write"added"
EndIf
objRec3.Close
objConn.Close
SetobjRec3=Nothing
SetobjConn=Nothing
%>
2.vote.htm
<HTML>
<HEAD>
<scriptlanguage="JavaScript">
functionnewswindow(url)
{ContentWindow=window.open(url,"_blank","toolbar=no,width=640,height=400;,directories=no,status=yes,scrollbars=yes,resize=yes,menubar=yes")
}
</script>
</HEAD>
<BODY>
您以为"你说我说"栏目
<formmethod="post"action="vote.asp"target="new">
<tr>
<tdwidth=80>
<inputtype="radio"name="selected"value="0"style="background-color:rgb(255,205,96)">对照凌乱<br>
<inputtype="radio"name="selected"value="1"style="background-color:rgb(255,205,96)">因陋就简<br>
<inputtype="radio"name="selected"value="2"style="background-color:rgb(255,205,96)">次序井然
</td>
<tdwidth=55>
<inputtype=hiddenname=topicIDvalue=1>
<inputtype=hiddenname=topicvalue=您以为你说我说栏目>
<inputtype=hiddenname=selectionNumvalue=3>
<inputtype=hiddenname=selection0_titlevalue=对照凌乱>
<inputtype=hiddenname=selection1_titlevalue=因陋就简>
<inputtype=hiddenname=selection2_titlevalue=次序井然>
<inputtype="button"value="检察"style="background-color:rgb(255,205,96)"onClick=newswindow("vote.asp?topicID=1")target=new>
<inputtype=submitvalue="提交"style="background-color:rgb(255,205,96)">
</td>
</tr>
</form>
</BODY>
</HTML>
3.vote.mdb
aAccessdatabasefile,thereisatablenamed"vote"
fields:
topicIDtopicselectionNumselection0_titleselection0_count...
ASP在国内异常流行,因为国内大多使用的是盗版的Windows和盗版的SQLServer,而ASP+COM+SQLServer实际上也是一种不错的搭配,其性能也不输于PHP+MYSQL,特别是Windows系统和SQLServer都有图形界面,比APACHE和MYSQL易于维护,因此对于不重视知识产权的国家来说也是一种不错的选择。 |
|