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

📄 m_up.asp

📁 生活者姿态整站程序 生活者姿态整站程序 生活者姿态整站程序
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%@LANGUAGE="VBSCRIPT" codepage=936 %> 
<!--#include file="Connections/news.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="default.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<%
' *** Edit Operations: declare variables

MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_news_STRING
  MM_editTable = "news"
  MM_editColumn = "n_id"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "m_list.asp"
  MM_fieldsStr  = "b_id|value|n_com|value|n_i|value|n_title|value|n_author|value|n_path|value|n_content|value"
  MM_columnsStr = "b_id|none,none,NULL|n_com|none,1,0|n_i|none,none,NULL|n_title|',none,''|n_author|',none,''|n_path|',none,''|n_content|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql update statement
  MM_editQuery = "update " & MM_editTable & " set "
  For i = LBound(MM_fields) To UBound(MM_fields) Step 2
    FormVal = MM_fields(i+1)
    MM_typeArray = Split(MM_columns(i+1),",")
    Delim = MM_typeArray(0)
    If (Delim = "none") Then Delim = ""
    AltVal = MM_typeArray(1)
    If (AltVal = "none") Then AltVal = ""
    EmptyVal = MM_typeArray(2)
    If (EmptyVal = "none") Then EmptyVal = ""
    If (FormVal = "") Then
      FormVal = EmptyVal
    Else
      If (AltVal <> "") Then
        FormVal = AltVal
      ElseIf (Delim = "'") Then  ' escape quotes
        FormVal = "'" & Replace(FormVal,"'","''") & "'"
      Else
        FormVal = Delim + FormVal + Delim
      End If
    End If
    If (i <> LBound(MM_fields)) Then
      MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal
  Next
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
set rsb = Server.CreateObject("ADODB.Recordset")
rsb.ActiveConnection = MM_news_STRING
rsb.Source = "SELECT * FROM big"
rsb.CursorType = 0
rsb.CursorLocation = 2
rsb.LockType = 3
rsb.Open()
rsb_numRows = 0
%>
<%
Dim rsn__MMColParam
rsn__MMColParam = "1"
if (Request.QueryString("n_id") <> "") then rsn__MMColParam = Request.QueryString("n_id")
%>
<%
set rsn = Server.CreateObject("ADODB.Recordset")
rsn.ActiveConnection = MM_news_STRING
rsn.Source = "SELECT * FROM news WHERE n_id = " + Replace(rsn__MMColParam, "'", "''") + ""
rsn.CursorType = 0
rsn.CursorLocation = 2
rsn.LockType = 3
rsn.Open()
rsn_numRows = 0
%>
<!--#include file="code.asp" -->
<html>
<head>
<title>业一新闻系统2.9增强版</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="intohz.css" type="text/css">
<script language="JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="760" border="1" align="center" height="30">
  <tr> 
    <td bgcolor="#99CC00"> 
      <div align="center"><a href="m_add_d.asp">添加新闻</a></div>
    </td>
    <td bgcolor="#99CC00"> 
      <div align="center"><a href="m_list.asp">新闻管理</a></div>
    </td>
    <td bgcolor="#99CC00"> 
      <div align="center"><a href="m_big.asp">大类管理</a></div>
    </td>
    <td bgcolor="#99CC00"> 
       <div align="center"><a href="m_user.asp">用户管理</a></div>
    </td>
    <td bgcolor="#99CC00"> 
      <div align="center"><a href="m_review.asp">评论管理</a></div>
    </td>
    <td bgcolor="#99CC00"> 
      <div align="center"><a href="aboutme.asp">系统说明</a></div>
    </td>
    <td bgcolor="#99CC00"> 
      <div align="center"><a href="logout.asp">退出管理</a></div>
    </td>
  </tr>
</table>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="myform" onSubmit="MM_validateForm('n_title','','R','n_author','','R','n_content','','R');return document.MM_returnValue">
  <table align="center" width="600">
    <tr> 
      <td nowrap align="right">新闻类别:</td>
      <td> 
        <select name="b_id">
          <option value="<%=(rsn.Fields.Item("b_id").Value)%>" selected>默认类别</option>
          <%
While (NOT rsb.EOF)
%>
          <option value="<%=trim(rsb.Fields.Item("b_id").Value)%>" ><%=trim(rsb.Fields.Item("b_type").Value)%> </option>
          <%
  rsb.MoveNext()
Wend
If (rsb.CursorType > 0) Then
  rsb.MoveFirst
Else
  rsb.Requery
End If
%>
        </select>
      </td>
    </tr>
    <tr> 
      <td nowrap align="right" height="21">是否推荐:</td>
      <td height="21"> 
        <input type="checkbox" name="n_com" value=true >
          </td>
    </tr>
    <tr> 
      <td nowrap align="right">首页新闻:</td>
      <td> 
        <select name="n_i">

⌨️ 快捷键说明

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