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

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../../FS_InterFace/ns_Function.asp" -->
  5. <!--#include file="../../FS_Inc/Function.asp" -->
  6. <!--#include file="../../FS_Inc/Func_page.asp" -->
  7. <!--#include file="lib/cls_main.asp" -->
  8. <%'Copyright (c) 2006 Foosun Inc. Code by Einstein.Liu
  9. Dim Conn,User_Conn,FS_News,values,action,info_Rs,news_Rs,sql_cmd,sql_news_cmd,str_FileName
  10. Dim contrPoint,contrMoney,contrAuditPoint,contrAuditMoney,Rs,MainID
  11. 'Admin_Login_State'判断是否登陆
  12. MF_User_Conn
  13. MF_Default_Conn
  14. MF_Session_TF
  15. if not MF_Check_Pop_TF("NS_Constr") then Err_Show
  16. Set info_Rs=Server.CreateObject(G_FS_RS)
  17. Set news_Rs=Server.CreateObject(G_FS_RS)
  18. Set FS_News=New Cls_News
  19. FS_News.GetSysParam()
  20. values=NoSqlHack(request.QueryString("values"))
  21. values=DelHeadAndEndDot(values)'去处首尾逗号
  22. action=NoSqlHack(request.QueryString("act"))
  23. Set Rs=User_Conn.execute("Select top 1 contrPoint,contrMoney,contrAuditPoint,contrAuditMoney from FS_ME_SysPara")
  24. if Rs.eof then
  25. Response.Redirect("../error.asp?ErrCodes=<li>请先设置会员参数</li>&ErrorUrl=")
  26. ELse
  27. contrPoint=Rs("contrPoint")
  28. if not isnumeric(contrPoint) then contrPoint=0
  29. contrMoney=Rs("contrMoney")
  30. if not isnumeric(contrMoney) then contrMoney=0
  31. contrAuditPoint=Rs("contrAuditPoint")
  32. if not isnumeric(contrAuditPoint) then contrAuditPoint=0
  33. contrAuditMoney=Rs("contrAuditMoney")
  34. if not isnumeric(contrAuditMoney) then contrAuditMoney=0
  35. End if
  36. Rs.close
  37. Set Rs=nothing
  38. '审核
  39. if action="audit" then
  40. if not MF_Check_Pop_TF("NS030") then Err_Show
  41. sql_news_cmd="select id,NewsID,NewsTitle,CurtTitle,Content,Keywords,Editor,isPicNews,Author,classID,Templet,NewsPicFile,SaveNewsPath,FileName,FileExtName,addtime,NewsProperty from FS_NS_News"
  42. if instr(values,",")=0 then
  43. sql_cmd="select AuditTF,ContTitle,SubTitle,ContContent,KeyWords,UserNumber,MainID,PicFile from FS_ME_InfoContribution where contid="&values
  44. info_Rs.open sql_cmd,User_Conn,1,3
  45. news_Rs.open sql_news_cmd ,Conn,1,3
  46. news_Rs.addNew
  47. if not info_Rs.eof then
  48. news_Rs("NewsTitle")=info_Rs("ContTitle")
  49. news_Rs("CurtTitle")=info_Rs("SubTitle")
  50. news_Rs("Content")=info_Rs("ContContent")
  51. news_Rs("Keywords")=info_Rs("KeyWords")
  52. if trim(info_Rs("PicFile"))<>"" then
  53. news_Rs("NewsPicFile")=info_Rs("PicFile")
  54. news_Rs("isPicNews")=1
  55. ENd if
  56. news_Rs("Author")=FS_News.GetUserName(info_Rs("userNumber"))
  57. news_Rs("Editor")=session("Admin_Name")
  58. if not isnull(info_Rs("MainID")) and not info_Rs("MainID")="" then
  59. Set Rs= Conn.execute("select Classid from FS_NS_NewsClass where id="&info_Rs("MainID"))
  60. if not Rs.eof then
  61. MainID=Rs("Classid")
  62. Else
  63. MainID="0"
  64. End if
  65. Else
  66. MainID="0"
  67. End If
  68. If MainID="0" Then
  69. Response.Redirect("lib/error.asp?ErrCodes=<li>请选择栏目n</li>")
  70. Response.End()
  71. End if
  72. news_Rs("classID")=MainID
  73. news_Rs("NewsID")=FS_News.getRamCode(15)
  74. news_Rs("SaveNewsPath") = Fs_news.SaveNewsPath(Fs_news.fileDirRule)
  75. news_Rs("FileName")=Fs_news.strFileNameRule(Fs_news.fileNameRule,0,0)
  76. news_Rs("NewsProperty")="0,1,1,1,0,0,0,0,1,0,0"
  77. if trim(request.Form("NewsTemplet"))<>"" then
  78. news_Rs("Templet")=request.Form("NewsTemplet")
  79. Else
  80. news_Rs("Templet")=Replace("/"& G_TEMPLETS_DIR &"/NewsClass/news.htm","//","/")
  81. ENd if
  82. Dim fileExtName
  83. select case Fs_news.fileExtName
  84. case 1 fileExtName="htm"
  85. case 2 fileExtName="shtml"
  86. case 3 fileExtName="shtml"
  87. case 4 fileExtName="shtm"
  88. case else fileExtName="html"
  89. End select
  90. news_Rs("FileExtName")=fileExtName
  91. news_Rs("addtime")=Now()
  92. news_Rs.update
  93. if G_IS_SQL_DB = 0 then'是否是sqlserver
  94. newsID = news_Rs("ID")
  95. Else
  96. 'select ident_current('FS_NS_News') 有待修正
  97. newsID = ""
  98. End if
  99. str_FileName=news_Rs("FileName")
  100. Dim TempRsObj
  101. If Instr(str_FileName,"自动编号ID") Then
  102. str_FileName = Replace(str_FileName,"自动编号ID",newsID)
  103. Set TempRsObj=server.CreateObject(G_FS_RS)
  104. TempRsObj.open "select FileName From [Fs_NS_News] where NewsID='"&news_Rs("NewsID")&"' and ID="&Clng(newsID)&"",Conn,1,3
  105. if not TempRsObj.eof Then
  106. TempRsObj("FileName") = Replace(TempRsObj("FileName"),"自动编号ID",newsID)
  107. TempRsObj.update
  108. End If
  109. TempRsObj.Close
  110. End IF
  111. Dim TempRsObj_1
  112. If Instr(str_FileName,"唯一NewsID") Then
  113. str_FileName = Replace(str_FileName,"唯一NewsID",news_Rs("NewsID"))
  114. Set TempRsObj_1=server.CreateObject(G_FS_RS)
  115. TempRsObj_1.open "select FileName From [Fs_NS_News] where NewsID='"&news_Rs("NewsID")&"'",Conn,1,3
  116. if not TempRsObj_1.eof Then
  117. TempRsObj_1("FileName") = str_FileName
  118. TempRsObj_1.update
  119. End If
  120. TempRsObj_1.Close
  121. End IF
  122. User_Conn.execute("Update FS_ME_InfoContribution set NewsID="&newsID)
  123. User_Conn.execute("Update FS_ME_Users set Integral=Integral+"&(contrAuditPoint)&" , FS_Money=FS_Money+"&(contrAuditMoney)&",ConNumberNews=ConNumberNews+1 where usernumber='"&info_Rs("UserNumber")&"'")
  124. Else
  125. Response.Redirect("lib/error.asp?ErrCodes=<li>投稿数据异常</li>")
  126. Response.End()
  127. End if
  128. info_Rs.close
  129. news_Rs.close
  130. else
  131. if not MF_Check_Pop_TF("NS030") then Err_Show
  132. Dim i,contID_Array'稿件id数组,
  133. contID_Array=split(values,",")
  134. for i =0 to Ubound(contID_Array)
  135. sql_cmd="select AuditTF,ContTitle,SubTitle,ContContent,KeyWords,UserNumber,MainID,PicFile from FS_ME_InfoContribution where contid="&contID_Array(i)
  136. info_Rs.open sql_cmd,User_Conn,1,3
  137. if not info_Rs.eof then
  138. news_Rs.open sql_news_cmd,Conn,1,3
  139. news_Rs.addNew
  140. news_Rs("NewsTitle")=info_Rs("ContTitle")
  141. news_Rs("CurtTitle")=info_Rs("SubTitle")
  142. news_Rs("Content")=info_Rs("ContContent")
  143. news_Rs("Keywords")=info_Rs("KeyWords")
  144. if trim(info_Rs("PicFile"))<>"" then
  145. news_Rs("NewsPicFile")=info_Rs("PicFile")
  146. news_Rs("isPicNews")=1
  147. ENd if
  148. news_Rs("Author")=FS_News.GetUserName(info_Rs("UserNumber"))
  149. news_Rs("Editor")=session("Admin_Name") 
  150. if not isnull(info_Rs("MainID")) and not info_Rs("MainID")="" then
  151. Set Rs= Conn.execute("select Classid from FS_NS_NewsClass where id="&info_Rs("MainID"))
  152. if not Rs.eof then
  153. MainID=Rs("Classid")
  154. Else
  155. MainID="0"
  156. End if
  157. Else
  158. MainID="0"
  159. End If
  160. If MainID="0" Then
  161. Response.Redirect("lib/error.asp?ErrCodes=<li>请选择栏目a</li>")
  162. Response.End()
  163. End if
  164. news_Rs("classID")=MainID
  165. news_Rs("NewsID")=FS_News.getRamCode(15)
  166. news_Rs("SaveNewsPath") = Fs_news.SaveNewsPath(Fs_news.fileDirRule)
  167. news_Rs("FileName")=Fs_news.strFileNameRule(Fs_news.fileNameRule,0,0)
  168. news_Rs("NewsProperty")="0,1,1,1,0,0,0,0,1,0,0"
  169. if trim(request.Form("NewsTemplet"))<>"" then
  170. news_Rs("Templet")=request.Form("NewsTemplet")
  171. Else
  172. news_Rs("Templet")=Replace("/"& G_TEMPLETS_DIR &"/NewsClass/news.htm","//","/")
  173. ENd if
  174. select case Fs_news.fileExtName
  175. case 1 fileExtName="htm"
  176. case 2 fileExtName="shtml"
  177. case 3 fileExtName="shtml"
  178. case 4 fileExtName="shtm"
  179. case else fileExtName="html"
  180. End select
  181. news_Rs("FileExtName")=fileExtName
  182. news_Rs("addtime")=Now()
  183. news_Rs.update
  184. if G_IS_SQL_DB = 0 then'是否是sqlserver
  185. newsID = news_Rs("ID")
  186. Else
  187. 'select ident_current('FS_NS_News') 有待修正
  188. newsID = ""
  189. End if
  190. User_Conn.execute("Update FS_ME_InfoContribution set NewsID="&newsID&" where ContID="&contID_Array(i))
  191. str_FileName=news_Rs("FileName")
  192. If Instr(str_FileName,"自动编号ID") Then
  193. str_FileName = Replace(str_FileName,"自动编号ID",newsID)
  194. Set TempRsObj=server.CreateObject(G_FS_RS)
  195. TempRsObj.open "select FileName From [Fs_NS_News] where NewsID='"&news_Rs("NewsID")&"' and ID="&Clng(newsID)&"",Conn,1,3
  196. if not TempRsObj.eof Then
  197. TempRsObj("FileName") =str_FileName
  198. TempRsObj.update
  199. End If
  200. TempRsObj.Close
  201. End IF
  202. If Instr(str_FileName,"唯一NewsID") Then
  203. str_FileName = Replace(str_FileName,"唯一NewsID",news_Rs("NewsID"))
  204. Set TempRsObj_1=server.CreateObject(G_FS_RS)
  205. TempRsObj_1.open "select FileName From [Fs_NS_News] where NewsID='"&news_Rs("NewsID")&"'",Conn,1,3
  206. if not TempRsObj_1.eof Then
  207. TempRsObj_1("FileName") =str_FileName
  208. TempRsObj_1.update
  209. End If
  210. TempRsObj_1.Close
  211. End if
  212. User_Conn.execute("Update FS_ME_InfoContribution set NewsID="&newsID)
  213. User_Conn.execute("Update FS_ME_Users set Integral=Integral+"&Clng(contrAuditPoint)&" , FS_Money=FS_Money+"&Clng(contrAuditMoney)&",ConNumberNews=ConNumberNews+1 where usernumber='"&info_Rs("UserNumber")&"'")
  214. Else
  215. Response.Redirect("lib/error.asp?ErrCodes=<li>投稿数据异常</li>")
  216. Response.End()
  217. ENd if
  218. info_Rs.close
  219. news_Rs.close
  220. next
  221. End if
  222. User_Conn.execute("Update FS_ME_InfoContribution set audittf=1 where ContID in("&values&")")
  223. '撤消审核
  224. elseif action="recall" then
  225. if not MF_Check_Pop_TF("NS030") then Err_Show
  226. sql_cmd_1="update FS_ME_InfoContribution set AuditTF=0 where ContID in("&values&")"
  227. User_Conn.execute(sql_cmd)
  228. '管理员锁定
  229. elseif action="lock" then
  230. if not MF_Check_Pop_TF("NS031") then Err_Show
  231. sql_cmd="update  FS_ME_InfoContribution set AdminLock=1 where ContID in("&values&")"
  232. '解除锁定
  233. elseif action="unlock" then
  234. if not MF_Check_Pop_TF("NS030") then Err_Show
  235. sql_cmd="update  FS_ME_InfoContribution set AdminLock=0 where ContID in("&values&")"
  236. User_Conn.execute(sql_cmd)
  237. '设为推荐
  238. elseif action="tf" then
  239. sql_cmd="update FS_ME_InfoContribution set isTF=1 where ContID in("&values&")"
  240. User_Conn.execute(sql_cmd)
  241. '取消推荐
  242. elseif action="untf" then
  243. if not MF_Check_Pop_TF("NS_Constr") then Err_Show
  244. sql_cmd="update FS_ME_InfoContribution set isTF=0 where ContID in("&values&")"
  245. User_Conn.execute(sql_cmd)
  246. '删除
  247. ElseIf action="delete" Then
  248. if not MF_Check_Pop_TF("NS032") then Err_Show
  249. sql_cmd="delete From FS_ME_InfoContribution where ContID in ("&values&")"
  250. User_Conn.execute(sql_cmd)
  251. ElseIf action="deleteAll" Then
  252. if not MF_Check_Pop_TF("NS032") then Err_Show
  253. sql_cmd="delete From FS_ME_InfoContribution where isLock=0"
  254. User_Conn.execute(sql_cmd)
  255. '退稿
  256. elseif action="untread" then
  257. if not MF_Check_Pop_TF("NS033") then Err_Show
  258. sql_cmd="update FS_ME_InfoContribution Set untread=1  where ContID in("&values&")"
  259. User_Conn.execute("Update FS_ME_Users set Integral=Integral-"&Clng(contrAuditPoint)&" , FS_Money=FS_Money-"&Clng(contrAuditMoney)&" where usernumber in (select usernumber from FS_ME_InfoContribution where ContID in ("&values&"))")
  260. User_Conn.execute(sql_cmd)
  261. '编辑审核
  262. elseif action="editaudit" then
  263. if not MF_Check_Pop_TF("NS030") then Err_Show
  264. Dim ContID,NewsTitle,CurtTitle,Content,Keywords,Author,ClassID
  265. ContID=Request.Form("hid_contID")
  266. NewsTitle=Request.Form("txt_newsTitle")
  267. CurtTitle=Request.Form("txt_curtTitle")
  268. Content=Request.Form("txt_content")
  269. Keywords=Request.Form("txt_keywords")
  270. Author=Request.Form("hid_Author")
  271. ClassID=Request.Form("hid_ClassID")
  272. 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"
  273. sql_cmd="select audittf,PicFile,UserNumber,MainID from FS_ME_InfoContribution where ContID="&ContID
  274. news_Rs.open sql_news_cmd,Conn,1,3
  275. info_Rs.open sql_cmd,User_Conn,1,3
  276. news_Rs.addNew
  277. news_Rs("NewsID")=FS_News.GetRamCode(15)
  278. news_Rs("NewsTitle")=NewsTitle
  279. news_Rs("CurtTitle")=CurtTitle
  280. news_Rs("Content")=Content
  281. news_Rs("Keywords")=Keywords
  282. news_Rs("Author")=Author
  283. news_Rs("Editor")=session("Admin_Name") 
  284. news_Rs("NewsProperty")="0,1,1,1,0,0,0,0,1,0,0"
  285. news_Rs("Templet")=request.Form("NewsTemplet")
  286. news_Rs("classID")=classid
  287. if trim(info_Rs("PicFile"))<>"" then
  288. news_Rs("NewsPicFile")=info_Rs("PicFile")
  289. news_Rs("isPicNews")=1
  290. ENd if
  291. news_Rs("Author")=FS_News.GetUserName(info_Rs("UserNumber"))
  292. if trim(ClassID)="" then
  293. Response.Redirect("lib/error.asp?ErrCodes=<li>请选择栏目</li>")
  294. Response.End()
  295. End if
  296. news_Rs("classID")=ClassID
  297. news_Rs("SaveNewsPath") = Fs_news.SaveNewsPath(Fs_news.fileDirRule)
  298. news_Rs("FileName")=Fs_news.strFileNameRule(Fs_news.fileNameRule,0,0)
  299. select case Fs_news.fileExtName
  300. case 1 fileExtName="htm"
  301. case 2 fileExtName="shtml"
  302. case 3 fileExtName="shtml"
  303. case 4 fileExtName="shtm"
  304. case else fileExtName="html"
  305. End select
  306. news_Rs("FileExtName")=fileExtName
  307. news_Rs("AddTime")=Now()
  308. news_Rs.update
  309. if G_IS_SQL_DB = 0 then'是否是sqlserver
  310. newsID = news_Rs("ID")
  311. Else
  312. 'select ident_current('FS_NS_News') 有待修正
  313. newsID = ""
  314. End if
  315. str_FileName=news_Rs("FileName")
  316. If Instr(str_FileName,"自动编号ID") Then
  317. str_FileName = Replace(str_FileName,"自动编号ID",newsID)
  318. Set TempRsObj=server.CreateObject(G_FS_RS)
  319. TempRsObj.open "select FileName From [Fs_NS_News] where NewsID='"&news_Rs("NewsID")&"' and ID="&Clng(newsID)&"",Conn,1,3
  320. if not TempRsObj.eof Then
  321. TempRsObj("FileName") = str_FileName
  322. TempRsObj.update
  323. End If
  324. TempRsObj.Close
  325. End IF
  326. If Instr(str_FileName,"唯一NewsID") Then
  327. str_FileName = Replace(str_FileName,"唯一NewsID",news_Rs("NewsID"))
  328. Set TempRsObj_1=server.CreateObject(G_FS_RS)
  329. TempRsObj_1.open "select FileName From [Fs_NS_News] where NewsID='"&news_Rs("NewsID")&"'",Conn,1,3
  330. if not TempRsObj_1.eof Then
  331. TempRsObj_1("FileName") = str_FileName
  332. TempRsObj_1.update
  333. End If
  334. TempRsObj_1.Close
  335. End IF
  336. news_Rs.close
  337. info_Rs("audittf")=1
  338. info_Rs.update
  339. info_Rs.close
  340. '删除投稿
  341. elseif action="delete" then
  342. if not MF_Check_Pop_TF("NS032") then Err_Show
  343. Dim Temp_Rs,NewsID
  344. Set Temp_Rs=User_Conn.execute("Select NewsID From FS_ME_InfoContribution where ContID in("&values&")")
  345. while not Temp_Rs.eof
  346. NewsID=Temp_Rs("NewsID")&","&NewsID
  347. Temp_Rs.movenext
  348. wend 
  349. NewsID=DelHeadAndEndDot(NewsID)
  350. User_Conn.Execute("Delete *  From FS_ME_InfoContribution where ContID in("&values&")")
  351. Conn.Execute("Delete *  From FS_NS_News where ID in("&NewsID&")")
  352. Set Temp_Rs=nothing
  353. End if
  354. if err.number=0 then
  355. Response.Redirect("lib/success.asp?ErrCodes=<li>操作成功</li>&ErrorURL=../Constr_List.asp")
  356. Response.End()
  357. else
  358. Response.Redirect("lib/error.asp?ErrCodes=<li>请检查输入是否合法</li>")
  359. Response.End()
  360. end if
  361. %>
  362. <%
  363. Conn.close
  364. User_Conn.close
  365. Set Conn=nothing
  366. Set User_Conn=nothing
  367. Set info_Rs=nothing
  368. %>
  369. <!-- Powered by: FoosunCMS4.0系列,Company:Foosun Inc. -->