Story Solitaire 2 handlevote.asp

Source: Internet
Author: User
Tags servervariables visual studio
<%@ Language=vbscript%>
<%
' The following is an ASP program for processing votes
If Request.ServerVariables ("http_method") = "POST" Then
If Request.Form ("Voteradio") <> "" Then
' Only the user chooses to think that the article is good to continue to write
Set Rec=server. CreateObject ("Adodb.recordset")
Rec. activeconnection= "Dsn=vote"
If Request.Form ("Votecomment") <> "" Then
' Add the user's message to the data
Rec. Source= "SELECT * from Tbcomment"
Rec. Open, 1,3
Tempstr=request.form ("Votecomment")
Rec. AddNew
Rec ("Userip") =request.servervariables ("REMOTE_ADDR")
Rec ("comment") =tempstr
Rec. Update
Rec. Close
Tempstr= "<PRE>" & TempStr & "</PRE>"
Tempstr=tempstr & "<P> You cast a vote, thank you </P>"
Else
' If the user does not have a message, then
Tempstr= "This netizen has nothing to say, he/she just think this article is very good, so cast a vote"
End If
' Update the database that records the polling times according to the user's vote
'????? What if there is no such item???
Rec. Source= "SELECT * from Tbvote where votechapter= '" & Request.Form ("Voteradio") & ""
Rec. Open, 1,3
If Rec. BOF Then
' If the article is the first time to vote, add a new record
Rec. AddNew
Rec ("Votecount") =1
Rec ("Votechapter") =request.form ("Voteradio")
Rec. Update
Else
' Otherwise update the voting count +1
Rec ("Votecount") =rec ("Votecount") +1
Rec. Update
End If
Rec. Close
Set rec=nothing
Else
' This message will appear if no new article is submitted or if the user does not have a choice.
Tempstr= "<PRE>" & "This netizen really strange, all feel bad also vote" & "</PRE>"
End If
Response.Redirect "showmessage.asp?message=" & TempStr
End If
%>
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
</HEAD>
<BODY>
</BODY>
</HTML>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.