⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setnews.asp

📁 程序介绍: 1、内嵌式投票系统
💻 ASP
字号:
<%
''''''''''''''''''''''''''''''''''''''''''''
'
'  TXSite / 通用网站系统
'
'  版本    :v1.8.20
'
'  制作人  :milp(milp@21cn.com)
'
'  版权所有:源码之家(http://www.21tx.com)
'
'  主页地址:http://www.21tx.com
'            http://www.bestnets.net
'            http://www.soucn.com
'
'  技术支持:http://www.21tx.com/bbs
'
''''''''''''''''''''''''''''''''''''''''''''
'程序创建时间  23:59 2001-8-5
'程序完成时间  11:18 2001-8-6
'最后修改时间  11:18 2001-8-6
if session("adminflag")="" then Response.Redirect "default.asp"
dim action,id,name,addate,click,isUse,content
action=request("action")

const thisprog="setnews.asp"
dim sqlfenye,txtitle
txtitle=request("searchtxt")
if txtitle<>"" then
  sqlfenye="select * from news where name like '%"&trim(txtitle)&"%' order by id desc"
else
  sqlfenye="select * from news order by id desc"
end if
Sub deleteid(id)
  conn.execute "delete from news where id="&cstr(id)
End sub
Sub isUseid(id)
  if session("adminflag")>2 then PrintMsg(NotAdmin)
  conn.execute "update news set isUse=True where id="&cstr(id)
End Sub
Sub notisUseid(id)
  if session("adminflag")>2 then PrintMsg(NotAdmin)
  conn.execute "update news set isUse=False where id="&cstr(id)
End Sub
%>
<!--#include file=base.asp-->
<!--#include file="char.asp"-->
<!--#include file="subs.asp"-->
<%
if session("adminflag")>2 then Call PrintMsg(NotAdmin)

if action="" then action="add"
if action="saveadd" or action="savemod" then
  Call savenews
elseif action="fenye" then
  Call fenye
elseif action="mod" then
  Call modnews
else
  Call addnews
end if
%>
<!--#include file=end.asp-->

<%Sub modnews
rSub.open "select * from news where id="&request("id"),conn,1,1
if rSub.bof and rSub.eof then Call PringMsg("操作错误!")
id=rSub("id")
name=rSub("name")
addate=rSub("addate")
isUse=rSub("isUse")
click=rSub("click")
content=rSub("content")
rSub.close
Call addnews
End Sub%>

<%Sub addnews()%>
<br><p align=center><font color=red><b><%=request("msg")%></b></font></p>
<form name=txForm method="post" action="<%=thisprog%>?action=save<%=action%>&id=<%=id%>">
  <div align="center"><center><table border="1" cellspacing="0" width="95%" bordercolorlight="#000000" bordercolordark="#FFFFFF" cellpadding="0">
    <tr>
      <td width="100%" bgcolor="#D0D0D0" height="20"><div align="center"><center><p><b>新 闻 管 理</b></td>
    </tr>
    <tr align="center">
      <td width="100%"><table border="0" cellspacing="1" width="100%">
        <tr>
          <td width="15%" align="right" height="30"><b>标题:</b></td>
          <td width="85%" height="30"><input type="text" name="name" size="70"
          maxlength="100" value=<%=name%>> <font color=red>**</font></td>
        </tr>
        <tr>
          <td width="15%" align="right" height="30"><b>选项:</b></td>
          <td width="85%" height="30">
<%if name="" then%>
是否显示:<input type="checkbox" name="isUse" checked>
<select name="checkbox" size="1">
  <option value=1>支持html</option>
  <option value=2>不支持ht</option>
  <option value=3>原样输入</option>
</select>
<%else%>
是否显示:<input type="checkbox" name="isUse" value="<%=isUse%>" <%if isUse then response.write "checked"%>>
<%end if%>
点击:<input type="text" name="click" size="5" maxlength="100" value=<%=click%>>
时间:<input type="text" name="addate" size="10" maxlength="100" value=<%=addate%>></td>
        </tr>
        <tr>
          <td width="15%" align="right" valign="top"><b>内容:</b></td>
          <td width="85%"><textarea rows="15" name="content" cols="68" class="smallarea" title=可以使用Ctrl+Enter快速提交><%=content%></textarea> <font color=red>**</font></td>
        </tr>
        <tr>
          <td width="15%" align="right" valign="top" height="20"></td>
          <td width="85%"></td>
        </tr>
      </table>
      </td>
    </tr>
  </table>
  </center></div><div align="center"><center><p><input type="submit" value=" 确 定 "
  name="cmdok">&nbsp; <input type="reset" value=" 清 除 "
  name="cmdcancel"> <font color=red>[可以使用Ctrl+Enter快速提交]</font></p>
  </center></div>
</form>
<p>说明<br><br>时间:如果为空则为系统默认时间<br>是否显示:是否在首页中显示<br>点击:新增请输入初始值,如果为空自动置为 1
<%
End Sub

Sub savenews
name=trim(request.form("name"))
isUse=trim(request.form("isUse"))
click=trim(request.form("click"))
addate=trim(request.form("addate"))
if addate="" then addate=now()
if request.form("checkbox")="1" then
  content=htmlencode(request.form("content"))
elseif request.form("checkbox")="2" then
  content=htmlencode2(request.form("content"))
else 
  content=request.form("content")
end if
if name="" then 
OutMsg=OutMsg+"<br>"+"<li>错误提示:请输入标题!"
founderr=true
end if
if not isDate(addate) then 
OutMsg=OutMsg+"<br>"+"<li>错误提示:你输入的时间非法!"
founderr=true
end if
if content="" then 
OutMsg=OutMsg+"<br>"+"<li>错误提示:请输入内容!"
founderr=true
end if
if founderr=true then Call PrintMsg(OutMsg)

if action="saveadd" then
  rSub.open "select * from news where id is null",conn,1,3
  rSub.AddNew
elseif action="savemod" then
  rSub.open "select * from news where id="&request("id"),conn,1,3
end if
rSub("name")=name
if click<>"" then
  rSub("click")=click
else
  rSub("click")=1
end if
if isUse="" then
  rSub("isUse")=False
else
  rSub("isUse")=True
end if
rSub("content")=content
rSub("addate")=addate
rSub.Update
id=rSub("id")
rSub.Close
response.redirect ""&thisprog&"?action=mod&id="&id&"&msg=操作成功!"
End Sub%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -