BVB Source Codes

Pcook CMS bubble guest v3.0 SDCMS version Show sdcms_vote.asp Source code

Return Download Pcook CMS bubble guest v3.0 SDCMS version: download sdcms_vote.asp Source code - Download Pcook CMS bubble guest v3.0 SDCMS version Source code - Type:.asp
  1. <!--#include file="sdcms_check.asp"-->
  2. <%
  3. set sdcms=new Sdcms_Admin
  4. sdcms.Check_admin
  5. sdcms.Check_lever 8
  6. set sdcms=nothing
  7. select case action
  8. case "add":title="添加投票"
  9. case "edit":title="修改投票"
  10. case "show":title="查看投票"
  11. case else:title="投票管理"
  12. end select
  13. sd_table="sd_vote"
  14. sdcms_head
  15. %>
  16. <div class="sdcms_notice"><span>管理操作:</span><a href="?action=add">添加投票</a> ┊ <a href="?">投票管理</a></div>
  17. <br>
  18. <ul id="sdcms_sub_title">
  19.         <li class="sub"><%=title%></li>
  20.        
  21. </ul>
  22. <div id="sdcms_right_b">
  23. <%
  24. select case action
  25. case "add":add
  26. case "edit":edit
  27. case "save":save
  28. case "del":del
  29. case "show":shows
  30. case else:main
  31. end select
  32. closedb
  33. sub main
  34. %>
  35.   <table border="0" align="center" cellpadding="3" cellspacing="1" class="table_b" id="tagContent0">
  36.     <tr>
  37.       <td width="30" class="title_bg">ID</td>
  38.       <td class="title_bg">投票名称</td>
  39.       <td width="160" class="title_bg">日期</td>
  40.       <td width="160" class="title_bg">管理</td>
  41.     </tr>
  42.         <%
  43.         set rs=conn.execute("select id,title,adddate  from "&sd_table&"   order by id desc")
  44.         while not rs.eof
  45.         %>
  46.     <tr onmouseover=this.bgColor='#EBFFDC'; onmouseout=this.bgColor='#ffffff';  bgcolor='#ffffff'>
  47.         <%for i=0 to 2%>
  48.       <td <%if i<>1 then%>align="center"<%end if%>><%=rs(i)%></td>
  49.           <%next%>
  50.       <td align="center"><a href='?action=show&id=<%=rs(0)%>'>查看</a> <a href="?action=edit&id=<%=rs(0)%>">编辑</a> <a href="?action=del&id=<%=rs(0)%>" onclick='return confirm("真的要删除?不可恢复!");'>删除</a></td>
  51.     </tr>
  52.         <%rs.movenext
  53.         wend%>
  54.   </table>
  55.  
  56. <%
  57. end sub
  58. sub add
  59. check_info
  60. %>
  61.   <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
  62.   <form name="add" method="post" action="?action=save&act=add" onSubmit='return checkadd()'>
  63.     <tr>
  64.       <td width="9%" align="center" class="tdbg">投票名称:      </td>
  65.       <td width="91%" class="tdbg"><input name="t0" type="text" class="input" id="t0" size="40"></td>
  66.     </tr>
  67.     <tr class="tdbg">
  68.       <td align="center">投票选项:      </td>
  69.       <td><input name='t1' type='radio' value='1'  checked />单选 <input  name='t1' type='radio' value='0' />多选</td>
  70.     </tr>
  71.     <tr class="tdbg">
  72.       <td align="center">项目内容:</td>
  73.       <td><input type='button' class="bnt" name='addvote' value='添加项目' onclick='Addvote();'> <input type='button' class="bnt" name='modifyvote' value='修改项目' onclick='return Modifyvote();'> <input type='button' class="bnt" name='delvote' value='删除项目' onclick='Delvote();'> <input class="bnt" onClick='changepos(content,-1)'  value='上 移' type='button'> <input class="bnt" onClick='changepos(content,1)' type='button' value='下 移'><br><input type='hidden' name='votes' value='' ><select class="inputs" name='content' style='width:400px;height:200px;margin-top:5px;' size='2' ondblclick='return Modifyvote();' ></select>    
  74.         </td>
  75.     </tr>
  76.  
  77.     <tr class="tdbg">
  78.           <td>&nbsp;</td>
  79.       <td><input name="Submit" type="submit" class="bnt" value="保 存">
  80.         <input name="Submit23" type="button" onClick="history.go(-1)" class="bnt" value="返 回"></td>
  81.     </tr>
  82.         </form>
  83.   </table>
  84. <%
  85. end sub
  86. sub edit
  87. set rs=conn.execute("select id,title,stype,vote,result from "&sd_table&" where id="&id&"")
  88. if rs.eof then
  89. echo "请勿非法提交参数":Died
  90. end if
  91. check_info
  92. %>
  93.   <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1">
  94.   <form name="add" method="post" action="?action=save&act=save&id=<%=id%>" onSubmit='return checkadd()'>
  95.     <tr>
  96.       <td width="9%" align="center" class="tdbg">投票名称:      </td>
  97.       <td width="91%" class="tdbg"><input name="t0" type="text" class="input" value="<%=rs(1)%>" id="t0" size="30"></td>
  98.     </tr>
  99.     <tr class="tdbg">
  100.       <td align="center">投票选项:      </td>
  101.       <td><input name='t1' type='radio' value='1' <%=w_check(rs(2),1)%> />单选 <input  name='t1' type='radio' value='0' <%=w_check(rs(2),0)%> />多选</td>
  102.     </tr>
  103.     <tr class="tdbg">
  104.       <td align="center">项目内容:</td>
  105.       <td><input type='button' class="bnt" name='addvote' value='添加项目' onclick='Addvote();'> <input type='button' class="bnt" name='modifyvote' value='修改项目' onclick='return Modifyvote();'> <input type='button' class="bnt" name='delvote' value='删除项目' onclick='Delvote();'> <input class="bnt" onClick='changepos(content,-1)'  value='上 移' type='button'> <input class="bnt" onClick='changepos(content,1)' type='button' value='下 移'><br><input type='hidden' name='votes' value='' ><select class="inputs" name='content' style='width:400px;height:200px;margin-top:5px;' size='2' ondblclick='return Modifyvote();' ><%result=split(rs(4),"|")
  106. for i=0 to ubound(result)
  107. next
  108. vote=split(rs(3),"|")
  109. for i=0 to ubound(vote)-1
  110. echo "<option value="&vote(i)&"|"&result(i)&">"&vote(i)&"|"&result(i)&"</option>"
  111. next%></select></td>
  112.     </tr>
  113.          
  114.     <tr class="tdbg">
  115.           <td>&nbsp;</td>
  116.       <td><input name="Submit" type="submit" class="bnt" value="保 存">
  117.         <input name="Submit22" type="button" onClick="history.go(-1)" class="bnt" value="返 回"></td>
  118.     </tr>
  119.         </form>
  120.   </table>
  121. <%
  122. end sub
  123. sub shows
  124. set rs=conn.execute("select id,title,vote,result from sd_vote where id="&id&"")
  125. if rs.eof then
  126. response.Redirect("?"):Died
  127. else
  128. vote=rs(2)
  129. result=rs(3)
  130. total_vote=0
  131. vote=split(vote,"|")
  132. result=split(result,"|")
  133. for i=0 to ubound(result)
  134. if not result(i)="" then total_vote=result(i)+total_vote
  135. next
  136. end if
  137. %>
  138. <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table_b">
  139.      <tr>
  140.       <td width="45%" align="center" class="title_bg" >选项      </td>
  141.       <td width="45%" class="title_bg" >比例 </td>
  142.       <td width="10%" class="title_bg" >票数</td>
  143.     </tr>
  144. <%for i=0 to (ubound(vote)-1)%>
  145.     <tr class="tdbg">
  146.           <td><%echo ""&i+1&". "&vote(i)&""%></td>
  147.       <td><div style='border:1px solid #ccc;'>
  148. <%echo "<div style='width:"
  149. if result(i)=0 then
  150. echo "0"
  151. else
  152. echo ""&Formatpercent(result(i)/total_vote,0)&""
  153. end if
  154. echo ";background:#f00;'>"
  155. echo "</div>"
  156. echo "</div>"
  157. %></td>
  158.       <td align="center"><%echo ""&result(i)&" ("
  159. if total_vote<>0 then
  160. echo ""&Formatpercent(result(i)/total_vote,0)&""
  161. else
  162. echo "0"
  163. end if%>)</td>
  164.     </tr>
  165. <%next%>
  166. <tr>
  167.       <td colspan="3" align="center" class="tdbg" ><input name="Submit2" type="button" onClick="history.go(-1)" class="bnt" value="返 回"></td>
  168.     </tr>
  169.   </table>
  170. <%
  171. end sub
  172.  
  173. sub save
  174.  
  175. t0=trim(request("t0"))
  176. t1=trim(request("t1"))
  177. votes=trim(request("votes"))
  178.  
  179. if votes="" then
  180. echo "<script>alert('项目内容不能为空');location.href='javascript:history.go(-1)';</script>":Died
  181. end if
  182.  
  183. votes=split(votes,",")
  184. for i=0 to (ubound(votes)-1)
  185. if not instr(votes(i),"|")>0 then
  186. echo "<script>alert('投票选项"&i+1&"有错误');location.href='javascript:history.go(-1)';</script>":Died
  187. end if
  188.  somevote=split(votes(i),"|")
  189.    for j=0 to ubound(somevote)
  190.    s=somevote(0)
  191.    s1=somevote(1)
  192.    if not isnumeric(s1) then
  193.    echo "<script>alert('投票选项"&i+1&"值错误');location.href='javascript:history.go(-1)';</script>":Died
  194.    end if
  195.    next  
  196.    vote=vote&s&"|"
  197.    result=result&s1&"|"
  198. next
  199.  
  200.  
  201. set rs=server.CreateObject("adodb.recordset")
  202. sql="select id,vote,result,title,stype from "&sd_table&""
  203. if act="save" then
  204.  sql=sql&" where id="&id&""
  205. end if
  206. rs.open sql,conn,1,3
  207.  
  208. if act="add" then
  209.   rs.addnew
  210. else
  211.   rs.update
  212. end if
  213. rs(1)=vote
  214. rs(2)=result
  215. rs(3)=t0
  216. rs(4)=t1
  217. rs.update
  218. if act="add" then
  219. conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','添加投票:"&rs(3)&"')")
  220. else
  221. conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','修改投票:"&rs(3)&"')")
  222. end if
  223. response.Redirect("?")
  224. end sub
  225. sub del
  226. conn.execute("Insert into sd_log (sdcms_name,ip,content) values('"&sdcms_adminname&"','"&sdcms_adminip&"','删除投票:"&conn.execute("select title from "&sd_table&" where id="&id&"")(0)&"')")
  227.   conn.execute("delete from "&sd_table&" where id="&id&"")
  228.   response.Redirect("?")
  229. end sub
  230.  
  231. sub pass
  232.   conn.execute("update   "&sd_table&" set ispass="&t&" where id="&id&"")
  233.   response.Redirect("?")
  234. end sub
  235.  
  236. sub check_info
  237. with response
  238. .write("        <script>")
  239. .write("function changepos(obj,index)")
  240. .write("{")
  241. .write("if(index==-1){")
  242. .write("if (obj.selectedIndex>0){")
  243. .write("obj.options(obj.selectedIndex).swapNode(obj.options(obj.selectedIndex-1))")
  244. .write("}")
  245. .write("}")
  246. .write("else if(index==1){")
  247. .write("if (obj.selectedIndex<obj.options.length-1){")
  248. .write("obj.options(obj.selectedIndex).swapNode(obj.options(obj.selectedIndex+1))")
  249. .write("}")
  250. .write("}")
  251. .write("}")
  252.  
  253. .write("function Addvote(){")
  254. .write("  var thisvote='投票名称'+(document.add.content.length+1)+'|0'; ")
  255. .write("  var vote=prompt('请输入投票名称和初始值,中间用“|”隔开:',thisvote);")
  256. .write("  if(vote!=null&&vote!=''){document.add.content.options[document.add.content.length]=new Option(vote,vote);}")
  257. .write("}")
  258. .write("function Modifyvote(){")
  259. .write("  if(document.add.content.length==0) return false;")
  260. .write("  var thisvote=document.add.content.value; ")
  261. .write("  if (thisvote=='') {alert('请先选择一个投票项目,再点修改按钮!');return false;}")
  262. .write("  var vote=prompt('请输入投票名称和初始值,中间用“|”隔开:',thisvote);")
  263. .write("  if(vote!=thisvote&&vote!=null&&vote!=''){document.add.content.options[document.add.content.selectedIndex]=new Option(vote,vote);}")
  264. .write("}")
  265. .write("function Delvote(){")
  266. .write("  if(document.add.content.length==0) return false;")
  267. .write("  var thisvote=document.add.content.value; ")
  268. .write("  if (thisvote=='') {alert('请先选择一个投票项目,再点删除按钮!');return false;}")
  269. .write("  document.add.content.options[document.add.content.selectedIndex]=null;")
  270. .write("}")
  271. .write("        function checkadd()")
  272. .write("        {")
  273. .write("        if (document.add.t0.value=='')")
  274. .write("        {")
  275. .write("        alert('投票名称不能为空');")
  276. .write("        document.add.t0.focus();")
  277. .write("        return false")
  278. .write("        }")
  279.  
  280. .write("        if (document.add.content.length==0)")
  281. .write("        {")
  282. .write("        alert('投票项目不能为空');")
  283. .write("        document.add.content.focus();")
  284. .write("        return false")
  285. .write("        }")
  286. .write("        if (document.add.content.length<2)")
  287. .write("        {")
  288. .write("        alert('投票项目内容至少两个以上');")
  289. .write("        document.add.content.focus();")
  290. .write("        return false")
  291. .write("        }")
  292. .write("var s=""""; ")
  293. .write("for(i=0;i<=document.all(""content"").length-1;i++) ")
  294. .write("{ ")
  295. .write("var s=s+document.add.content.options(i).value+"",""; ")
  296. .write("} ")
  297. .write("document.add.votes.value=s")
  298. .write("        }")
  299. .write("        </script>")
  300. end with
  301. end sub
  302. %>  
  303. </div>
  304. </body>
  305. </html>
downloadsdcms_vote.asp Source code - Download Pcook CMS bubble guest v3.0 SDCMS version Source code
Related Source Codes/Software:
Oo 126 CMS movie site system - This procedure ASP + ACC/ASP + SQL, using new kern... 2016-09-21
IDC sales web site - Beautiful IDC sales web site source code 2016-09-21
NPOINT virtual host v1.7.0 formal version management system - The system main function is introduced 2016-09-21
Classified information network business in suzhou - Overall module: classification of supply and deman... 2016-09-21
Jie Yang v0.6.3 article system - System functions: 1, the system settings A confi... 2016-09-21
Age design website information management system SDCMS v1.1 SP1 - SDCMS is designed to build the information managem... 2016-09-21
Age design website information management system SDCMS v1.1 SP1 - SDCMS is designed to build the information managem... 2016-09-21
C9 v2.1.1 static post system - Program USES ASP + ACC structure design and develo... 2016-09-21
Imitation green download station perfect version - Before increased | software home page, on the basi... 2016-09-21
Subdomain hosting edition v1.9 s taobao, pat - The background site admin 2016-09-21
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top