六天,看来你够苦的.帮你一下,用application做的,不知你是否满意,
首先在你网站根目录下新建一个名为:Global.asa的文件,然后把下列代码贴上去:
script language="vbscript" runat="server"
Sub Application_OnStart
application("yes")=0
application("no")=0
End Sub
/script
然后再建一个投票的ASP文件,内容:
style type="text/css"
!--
.Vote {
height: 15px;
width: 200px;
border: 1px solid #0033FF;
}
#cYes {
background-color: #FF6600;
height: 15px;
width: 100px;
}
#cNo {
background-color: #FF6600;
height: 15px;
width: 100px;
}
--
/style
form action="" method="post"
做一个投票系统难吗?br /
input name="yes" type="radio" value="yes" onclick="if (this.checked==true) no.checked=false;" /赞成br /
input name="no" type="radio" value="no" onclick="if (this.checked==true) yes.checked=false;"/反对br /
input name="投票" type="submit" value="投票" /
/form
%
nyes=0
nNo=0
'如果想重新计票,用下面四行
'application.lock()
'application("yes")=application("yes")+1
'application("no")=application("no")+1
'application.unlock()
count=application("yes")+application("no")
if count0 then
nyes=int(application("yes")*200/count)
nNo=int(application("no")*200/count)
end if
sYes=Request.form("yes")
sNo=Request.form("no")
act= Request.form("投票")
if act="投票" Then
if sYes="yes" Then
application.lock()
application("yes")=application("yes")+1
application.unlock()
Else
if sNo="no" then
application.lock()
application("no")=application("no")+1
application.unlock()
end if
End if
'图形化显示投票结果
count=application("yes")+application("no")
if count0 then
nyes=int(application("yes")*200/count)
nNo=int(application("no")*200/count)
end if
end if
%
赞成:%=application("yes")%票
div class="90be-a33a-dc07-01ad Vote" div ID="cYes" neme="cYes" style="width:%=nyes%px;"/div/div
反对::%=application("no")%票
div class="a33a-dc07-01ad-fa5e Vote" div ID="cNo" neme="cNo" style="width:%=nNo%px;"/div/div
最安全的就是手工
跟自己请朋友投一样
拉票
冲刺之一
团队实力强
加百度账号
快速搞定
人工速度快,
每票都截图,
不同地址不同手机投票,
和自己拉票一样。人多力量大,
无形中增加了票数,提升了名次。
你如果完全不会,从头开始做会很麻烦,涉及到很多东西,两个解决 *** ,最简单的是去申请一个免费的投票,比如互动力量
还有一个 *** ,是去下载一个投票的源码(比如搜索一下 asp 投票 源码)可以找到很多。
1、你们用的是微信自带的投票还是购买别人的投票系统, 2、如果是购买别人的投票系统,技术一般可以从查不来,因为后台你直接加上的票数,这一段代码的记录为空 3、如果是微信自带的,好像改不了票数吧!
我之前做过类似的投票小项目,在这里把源码发给你。你自己好好的参考一下。--------------------------package com.tv.bean;public class TVBean {
private String tvName;
private int tvCount;
public String getTvName() {
return tvName;
}
public void setTvName(String tvName) {
this.tvName = tvName;
}
public int getTvCount() {
return tvCount;
}
public void setTvCount(int tvCount) {
this.tvCount = tvCount;
}
}------------------------------package com.tv.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;import com.tv.bean.TVBean;
public class DBUtil {
private Connection con;
private PreparedStatement ps = null;
private ResultSet rs;
public void getCon(){
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=TV","sa","");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
public void closeCon(){
try {
if(rs !=null) rs.close();
if(ps != null) ps.close();
if(con != null) con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
public ArrayList getAll(){
ArrayList al = new ArrayList();
this.getCon();
String sql = "select * from TVInfo order by tvCount desc";
try {
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
while(rs.next()){
TVBean tb = new TVBean();
tb.setTvName(rs.getString(1));
tb.setTvCount(rs.getInt(2));
al.add(tb);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
this.closeCon();
}
return al;
}
public boolean updateByName(String name){
this.getCon();
String sql = "update TVInfo set tvCount=tvCount+1 where tvName='"+name+"'";
try {
ps = con.prepareStatement(sql);
int i = ps.executeUpdate();
if(i 0) return true;
else return false;
} catch (SQLException e) {
e.printStackTrace();
return false;
} finally {
this.closeCon();
}
}
}
---------------------------------------package com.tv.servlet;import java.io.IOException;
import java.util.ArrayList;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;import com.tv.dao.DBUtil;public class VoteServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
DBUtil dao = new DBUtil();
String [] name = request.getParameterValues("tvs");
int num = name.length;
for(int i =0; i num; i++){
if(dao.updateByName(name[i])){
request.setAttribute("to", "投票成功!");
ArrayList al = dao.getAll();
HttpSession session = request.getSession();
session.setAttribute("al", al);
request.getRequestDispatcher("success.jsp").forward(request, response);
}else{
request.setAttribute("to", "投票失败!请重新再试!");
}
}
} public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}
-----------------------------------%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%
%@taglib prefix="c" uri=" "%html
head
title电视投票/title
/head body
center
form action="vote" method="post"
table border="1" align="center"
tr align="center"
td
h2
选择您最喜欢的电视剧并投上一票
/h2
/td
/tr
tr
td
input type="checkbox" name="tvs" value="咏春" /
咏春
/td
/tr
tr
td
input type="checkbox" name="tvs" value="金婚" /
金婚
/td
/tr
tr
td
input type="checkbox" name="tvs" value="士兵突击" /
士兵突击
/td
/tr
tr
td
input type="checkbox" name="tvs" value="少年张三丰" /
少年张三丰
/td
/tr
tr
td align="center"
input type="submit" value=" 提交 " /
input type="reset" value=" 重置 " /
/td
/tr
/table
/form
/center
/body
/html
-------------------------------------之一段代码为JavaBean;第二段代码为数据库连接类;第三段代码为Servlet控制类;第四段代码为 *** P显示页面。希望能够解决你的问题!