contrAction.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:7k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../../FS_Inc/Function.asp" -->
  5. <!--#include file="../../FS_Inc/Func_page.asp" -->
  6. <!--#include file="../lib/strlib.asp" -->
  7. <!--#include file="../lib/UserCheck.asp" -->
  8. <%'Copyright (c) 2006 Foosun Inc. Code by Einstein.liu
  9. '-----------------------------------------
  10. response.expires=0 
  11. response.addHeader "pragma" , "no-cache" 
  12. response.addHeader "cache-control" , "private" 
  13. response.Charset="gb2312"
  14. '---------------------------------------------
  15. Dim action,id,contrRs,sqlstatement,contrPoint,contrMoney,Rs
  16. Dim ContID,ContSytle,ContTitle,SubTitle,ContContent,AddTime,PassTime,ClassID,MainID,KeyWords,IsPublic,InfoType,UserNumber,OtherContent,IsLock,isTF,Hits,AdminLock,PicFile,TempletID,FileName,FileExeName,AuditTF,Untread,contr_type,ConstrCheck
  17. action=request.QueryString("action")
  18. id=DelHeadAndEndDot(NoSqlHack(Request.QueryString("id")))
  19. Set Rs=User_Conn.execute("Select top 1 contrPoint,contrMoney from FS_ME_SysPara")
  20. if Rs.eof then
  21. Response.Redirect("../error.asp?ErrCodes=<li>请先设置会员参数</li>&ErrorUrl=")
  22. ELse
  23. contrPoint=Rs("contrPoint")
  24. if not isnumeric(contrPoint) then contrPoint=0
  25. contrMoney=Rs("contrMoney")
  26. if not isnumeric(contrMoney) then contrMoney=0
  27. End if
  28. Set Rs=Conn.execute("Select top 1 isConstrCheck from FS_NS_SysParam")
  29. if Rs.eof then
  30. ConstrCheck=1
  31. ELse
  32. ConstrCheck=Rs("isConstrCheck")
  33. End if
  34. Rs.close
  35. Set Rs=nothing
  36. if action="lock" then
  37. User_Conn.execute("Update FS_ME_InfoContribution set isLock=1 where contID in("&id&") and UserNumber='"&Session("FS_UserNumber")&"'")
  38. Response.Write("<a href='解锁' onClick=""contrAction('unlock','"&id&"','span_lock_"&id&"');return false;""><font color='red'>解锁</font></a>")
  39. response.End()
  40. Elseif action="unlock" then
  41. User_Conn.execute("Update FS_ME_InfoContribution set isLock=0 where contID in("&id&") and UserNumber='"&Session("FS_UserNumber")&"'")
  42. Response.Write("<a href='锁定' onClick=""contrAction('lock','"&id&"','span_lock_"&id&"');return false;"">锁定</a>")
  43. response.End()
  44. Elseif action="delete" then
  45. User_Conn.execute("Delete from FS_ME_InfoContribution where contID in("&id&") and UserNumber='"&Session("FS_UserNumber")&"'")
  46. Response.Write("ok")
  47. response.End()
  48. Else
  49. Set contrRs=server.CreateObject(G_FS_RS)
  50. if id<>"" And action="edit" then
  51. sqlstatement="select ContID,ContSytle,ContTitle,SubTitle,ContContent,AddTime,PassTime,ClassID,MainID,KeyWords,IsPublic,InfoType,UserNumber,OtherContent,IsLock,isTF,Hits,AdminLock,PicFile,TempletID,FileName,FileExeName,AuditTF,Untread,type,NewsID from FS_ME_InfoContribution where ContID="&ID&" and UserNumber='"&Session("FS_UserNumber")&"'"
  52. Elseif action="add" then
  53. sqlstatement="Select * From FS_ME_InfoContribution where 1=2"
  54. End if
  55. contrRs.open sqlstatement,User_Conn,1,3
  56. if action="add" or contrRs.eof then
  57. contrRs.addnew
  58. End if
  59. ContSytle=request.Form("sel_ContSytle")
  60. ContTitle=request.Form("txt_ContTitle")
  61. SubTitle=request.Form("txt_subTitle")
  62. ContContent=request.Form("txt_Content")
  63. AddTime=dateValue(Now)
  64. ClassID=request.Form("txt_ClassID")
  65. if trim(ClassID)="" then ClassID=0
  66. MainID=request.Form("txt_mainClassID")
  67. if trim(MainID)="" then MainID=0
  68. KeyWords=request.Form("txt_KeyWords")
  69. IsPublic=request.Form("rad_IsPublic")
  70. InfoType=request.Form("sel_InfoType")
  71. UserNumber=Session("FS_UserNumber")
  72. OtherContent=request.Form("txt_OtherContent")
  73. IsLock=request.Form("rad_IsLock")
  74. isTF=request.Form("rad_isTF")
  75. PicFile=request.Form("txt_img")
  76. If ConstrCheck=1 Then
  77. AuditTF=0
  78. Else
  79. AuditTF=1
  80. End If
  81. contr_type=request.Form("sel_type")
  82. '■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  83. '是否需要审核
  84. If ConstrCheck=0 and IsPublic="1" and IsLock="0" and ID="" Then
  85. Dim NewsTemplet,sql_news_cmd,news_Rs,Str_NS_Config
  86. if trim(MainID)="" then
  87. Response.Redirect("lib/error.asp?ErrCodes=<li>请选择栏目</li>")
  88. Response.End()
  89. End if
  90. Response.Write "SELECT NewsTemplet FROM FS_NS_NewsClass WHERE ClassID='"&MainID&"'"
  91. Set Str_NS_Config=Conn.Execute("SELECT NewsTemplet FROM FS_NS_NewsClass WHERE ClassID='"&MainID&"'")
  92. NewsTemplet=Str_NS_Config(0)
  93. Str_NS_Config.Close:Set Str_NS_Config=Nothing
  94. Set news_Rs= Server.CreateObject(G_FS_RS)
  95. sql_news_cmd="select  ID,NewsID,NewsTitle,CurtTitle,Content,Keywords,Author,classID,isPicNews,NewsPicFile,SaveNewsPath,FileName,FileExtName,addtime,Templet,NewsProperty,Editor from FS_NS_News"
  96. news_Rs.open sql_news_cmd,Conn,1,3
  97. news_Rs.addNew
  98. news_Rs("NewsID")=GetRamCode(15)
  99. news_Rs("NewsTitle")=ContTitle
  100. news_Rs("CurtTitle")=SubTitle
  101. news_Rs("Content")=ContContent
  102. news_Rs("Keywords")=Keywords
  103. news_Rs("Author")=session("FS_UserName")
  104. news_Rs("Editor")="" 
  105. news_Rs("NewsProperty")="0,1,1,1,0,0,0,0,1,0,0"
  106. news_Rs("Templet")=NewsTemplet
  107. news_Rs("classID")=MainID
  108. if trim(PicFile)<>"" then
  109. news_Rs("NewsPicFile")=PicFile
  110. news_Rs("isPicNews")=1
  111. news_Rs("NewsSmallPicFile")=PicFile
  112. End if
  113. news_Rs("SaveNewsPath") = "/Constr_"&year(now)&month(now)&day(now)&""
  114. news_Rs("FileName")=GetRamCode(8)
  115. news_Rs("FileExtName")="html"
  116. news_Rs("AddTime")=Now()
  117. news_Rs.update
  118. if G_IS_SQL_DB = 0 then'是否是sqlserver
  119. contrRs("NewsId")=news_Rs("ID")
  120. Else
  121. contrRs("NewsId")=Conn.Execute("SELECT IDENT_CURRENT('FS_NS_News')")(0)
  122. End if
  123. news_Rs.close
  124. Set news_Rs=Nothing
  125. End If
  126. '■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  127. contrRs("ContSytle")=ContSytle
  128. contrRs("ContTitle")=ContTitle
  129. contrRs("SubTitle")=SubTitle
  130. contrRs("ContContent")=ContContent
  131. contrRs("AddTime")=AddTime
  132. if ClassID<>"" then contrRs("ClassID")=ClassID
  133. if MainID<>"" then
  134. Dim tmpRs
  135. Set tmpRs=Conn.execute("select id from FS_NS_NewsClass where classid='"&MainID&"'") 
  136. if not tmpRs.eof then
  137. contrRs("MainID")=tmpRs("id")
  138. End if
  139. tmpRs.close
  140. Set tmpRs=nothing
  141. End if
  142. contrRs("KeyWords")=KeyWords
  143. contrRs("IsPublic")=IsPublic
  144. contrRs("InfoType")=InfoType
  145. contrRs("UserNumber")=UserNumber
  146. contrRs("OtherContent")=OtherContent
  147. contrRs("IsLock")=IsLock
  148. contrRs("isTF")=isTF
  149. contrRs("PicFile")=PicFile
  150. contrRs("AuditTF")=AuditTF
  151. contrRs("type")=contr_type
  152. contrRs.update
  153. contrRs.close
  154. if action="add" then
  155. User_Conn.execute("Update FS_ME_Users set Integral=Integral+"&Clng(contrPoint)&" , FS_Money=FS_Money+"&Clng(contrMoney)&",ConNumber=ConNumber+1 where usernumber='"&usernumber&"'")
  156. End if
  157. if err.number<>0 then
  158. Response.Redirect("../lib/error.asp?ErrCodes="&err.description&"&ErrorUrl=")
  159. Else
  160. Response.Redirect("../lib/success.asp?ErrCodes=操作成功!&ErrorUrl=../contr/contrManage.asp")
  161. End if
  162. End if
  163. Conn.close
  164. User_Conn.close
  165. Set Conn=nothing
  166. Set contrRs=nothing
  167. %>