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

数据库编程

开发平台:

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. <%
  8. response.buffer=true
  9. Response.CacheControl = "no-cache"
  10.  
  11. MF_Default_Conn
  12. Dim Conn,User_Conn
  13. Dim Configobj,PageS,sql,MSTitle,ShowIP,s_IsUser,Style
  14. Set Configobj=server.CreateObject (G_FS_RS)
  15. sql="select ID,Title,IPShow,IsUser,IsAut,PageSize,Style From FS_WS_Config"
  16. configobj.open sql,Conn,1,1
  17. if not configobj.eof then
  18. PageS=configobj("PageSize")
  19. MSTitle=configobj("Title")
  20. ShowIP=configobj("IPShow")
  21. s_IsUser = configobj("IsUser")
  22. Style = configobj("Style")
  23. if Style<>"" then
  24. Style = Style
  25. else
  26. Style = "3"
  27. end if
  28. end if
  29. Response.Cookies("FoosunUserCookies")("UserLogin_Style_Num") = Style
  30. set configobj=nothing
  31. if s_IsUser <> "0" then
  32. if session("FS_UserName")="" then
  33. response.Write"未开放匿名发布帖!"
  34. response.end
  35. end if
  36. end if
  37. dim ClassID,ClassRs,ClassName
  38. ClassID=NoSqlHack(Request.querystring("ClassID"))
  39. ClassName=NoSqlHack(Request.querystring("ClassName"))
  40. %>
  41. <html>
  42. <HEAD>
  43. <TITLE>FoosunCMS留言系统</TITLE>
  44. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  45. </HEAD>
  46. <link href="../<% = G_USER_DIR %>/images/skin/Css_<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>/<%=Request.Cookies("FoosunUserCookies")("UserLogin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  47. <script language="javascript">
  48. <!--
  49. function check(){
  50. if (document.WriteNote.Topic.value==""){
  51. alert("留言标题不能为空!");
  52. document.WriteNote.Topic.focus();
  53. return false;
  54. }
  55. if (document.WriteNote.Content.value==""){
  56. alert("留言内容不能为空");
  57. document.WriteNote.Content.focus();
  58. return false;
  59. }
  60. return true;
  61. }
  62. -->
  63. </script>
  64. <body>
  65. <form id="WriteNote" name="WriteNote" action="SaveNotes.asp?Act=Add" method="post">
  66.   <table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" class="table">
  67.     <tr class="hback"
  68. >
  69.       <td height="30" colspan="4" align="left" class="xingmu"><img src="images/Forum_nav.gif"><a href="index.asp" class="Top_Navi"><b><%=MSTitle%></b></a> -> <a href="DefNoteList.asp?ClassID=<%=ClassID%>" class="Top_Navi"><b><%=ClassName%></b></a></td>
  70.     </tr>
  71.     <tr>
  72.       <td class="hback"
  73.  align="right" width="18%">贴子标题:</td>
  74.       <td width="82%" class="hback"
  75.  >
  76.         <input type="test" name="Topic" size="20" maxlength="50">
  77.         &nbsp;&nbsp;
  78.         <input type="checkbox" id="IsAdmin" name="IsAdmin" value="1">
  79.       管理员可见</td>
  80.     </tr>
  81.     <tr class="hback"
  82. >
  83.       <td class="hback"
  84.  align="right" width="18%">当前表情:</td>
  85.       <td class="hback"
  86.  align="left">
  87.         <table width="100%" border="0" cellspacing="0" cellpadding="0">
  88.           <tr>
  89.             <td>
  90.               <input name="FaceNum" type="radio" value="1" checked="checked">
  91.               <img src="Images/face1.gif" width="22" height="22"> </td>
  92.             <td>
  93.               <input type="radio" name="FaceNum" value="2" >
  94.               <img src="Images/face2.gif" width="22" height="22"> </td>
  95.             <td>
  96.               <input type="radio" name="FaceNum" value="3" >
  97.               <img src="Images/face3.gif" width="22" height="22"> </td>
  98.             <td>
  99.               <input type="radio" name="FaceNum" value="4" >
  100.               <img src="Images/face4.gif" width="22" height="22"> </td>
  101.             <td>
  102.               <input type="radio" name="FaceNum" value="5" >
  103.               <img src="Images/face5.gif" width="22" height="22"> </td>
  104.             <td>
  105.               <input type="radio" name="FaceNum" value="6">
  106.               <img src="Images/face6.gif" width="22" height="22"></td>
  107.             <td>
  108.               <input type="radio" name="FaceNum" value="7" >
  109.               <img src="Images/face7.gif" width="22" height="22"> </td>
  110.             <td>
  111.               <input type="radio" name="FaceNum" value="8" >
  112.               <img src="Images/face8.gif" width="22" height="22"> </td>
  113.             <td>
  114.               <input type="radio" name="FaceNum" value="9" >
  115.               <img src="Images/face9.gif" width="22" height="22"></td>
  116.           </tr>
  117.           <tr>
  118.             <td>
  119.               <input type="radio" name="FaceNum" value="10" >
  120.               <img src="Images/face10.gif" width="22" height="22"></td>
  121.             <td>
  122.               <input type="radio" name="FaceNum" value="11" >
  123.               <img src="Images/face11.gif" width="22" height="22"> </td>
  124.             <td>
  125.               <input type="radio" name="FaceNum" value="12">
  126.               <img src="Images/face12.gif" width="22" height="22"></td>
  127.             <td>
  128.               <input type="radio" name="FaceNum" value="13" >
  129.               <img src="Images/face13.gif" width="22" height="22"> </td>
  130.             <td>
  131.               <input type="radio" name="FaceNum" value="14">
  132.               <img src="Images/face14.gif" width="22" height="22"></td>
  133.             <td>
  134.               <input type="radio" name="FaceNum" value="15" >
  135.               <img src="Images/face15.gif" width="22" height="22"></td>
  136.             <td>
  137.               <input type="radio" name="FaceNum" value="16" >
  138.               <img src="Images/face16.gif" width="22" height="22"></td>
  139.             <td>
  140.               <input type="radio" name="FaceNum" value="17" >
  141.               <img src="Images/face17.gif" width="22" height="22"> </td>
  142.             <td>
  143.               <input type="radio" name="FaceNum" value="18" >
  144.               <img src="Images/face18.gif" width="22" height="22"> </td>
  145.           </tr>
  146.         </table>
  147.       </td>
  148.     </tr>
  149.     <tr class="hback"
  150. >
  151.       <td class="hback"
  152.  align="right" width="18%">贴子类型:</td>
  153.       <td class="hback"
  154.  align="left">
  155.         <input type="radio" name="Style" value="1">
  156.         推荐帖子
  157.         <input type="radio" name="Style" value="0" checked>
  158.         普通帖子</td>
  159.     </tr>
  160.     <tr class="hback"
  161. >
  162.       <td class="hback"
  163.  align="right">帖子内容:</td>
  164.       <td class="hback"
  165.  valign="top" >
  166.         <textarea name="Content" cols="25" rows="10" id="Content" style="width:90%"></textarea>
  167.       </td>
  168.     </tr>
  169.     <tr class="hback"
  170. >
  171.       <td class="hback"
  172. >&nbsp;
  173.           <input type="hidden" name="ClassID" id="ClassID" value="<%=ClassID%>">
  174.       </td>
  175.       <td class="hback"
  176. >
  177.         <input type="submit" name="submit" value="OK发表贴子" onClick="return check()">
  178.         &nbsp;&nbsp;
  179.         <input type="reset" name="reset" value=" 清  空 ">
  180.       </td>
  181.     </tr>
  182.   </table>
  183. </form>
  184. <%
  185. dim NoteRs,Topic,Content,Face,IsUser,isTop,IsAdmin
  186. if NoSqlHack(Request.QueryString("Act"))="Add" then
  187. Set NoteRs=Server.CreateObject(G_FS_RS)
  188. ClassID=Request.form("ClassID")
  189. Topic=NoHtmlHackInput(trim(Replace(Request.form("Topic"),"'","")))
  190. IsTop=NoHtmlHackInput(trim(Request.form("Style")))
  191. Content=NoHtmlHackInput(Trim(Request.form("Content")))
  192. IsAdmin=NoHtmlHackInput(Trim(Request.form("IsAdmin")))
  193. Face=NoHtmlHackInput(Trim(Request.Form("FaceNum")))
  194. if IsAdmin="" then
  195. IsAdmin="0"
  196. end if
  197. if ClassID="" then
  198. Response.write("<script>alert('参数出错!');</script>")
  199. response.end
  200. end if
  201. if Topic="" then
  202. Response.write("<script>alert('标题不能为空');</script>")
  203. Response.end
  204. end if
  205. if isTop="" then
  206. Response.write("<script>alert('帖子类型值没传过来');</script>")
  207. Response.end
  208. end if
  209. if Content="" then
  210. Response.write("<script>alert('内容不能为空');</script>")
  211. response.end
  212. end if
  213. NoteRs.open "Select * from FS_WS_BBS ",Conn,3,3
  214. NoteRs.Addnew
  215. NoteRs("ClassID")=ClassID
  216. NoteRs("User")=session("FS_UserName")
  217. NoteRs("Topic")=Topic
  218. NoteRs("Body")=Content
  219. NoteRs("AddDate")=now()
  220. NoteRs("IsTop")=IsTop
  221. NoteRs("Style")="普通"
  222. NoteRs("IsAdmin")=IsAdmin
  223. NoteRs("LastUpdateUser")=session("FS_UserName")
  224. NoteRs("Face")=Face
  225. NoteRs("IP")=Request.ServerVariables("REMOTE_ADDR")
  226. NoteRs.update
  227. Set NoteRs=nothing
  228. Response.write "<script>location.href='DefNoteList.asp?ClassID='"&ClassID&"';</script>"
  229. end if
  230. Response.end
  231. Set Conn=nothing
  232. %>
  233. </body>
  234. </html>