addsclass.asp

来自「体育商城」· ASP 代码 · 共 508 行 · 第 1/2 页

ASP
508
字号
If (Request.QueryString <> "") Then  
  if UploadQueryString <> "" then
	  GP_uploadAction = GP_uploadAction & "&" & UploadQueryString
  end if 
End If

If (CStr(Request.QueryString("GP_upload")) <> "") Then
  GP_redirectPage = ""
  If (GP_redirectPage = "") Then
    GP_redirectPage = CStr(Request.ServerVariables("URL"))
  end if
    
  RequestBin = Request.BinaryRead(Request.TotalBytes)
  Dim UploadRequest
  Set UploadRequest = CreateObject("Scripting.Dictionary")  
  BuildUploadRequest RequestBin, "images/sclassimg", "file", "900000", "uniq"
  
  '*** GP NO REDIRECT
end if  
if UploadQueryString <> "" then
  UploadQueryString = UploadQueryString & "&GP_upload=true"
else  
  UploadQueryString = "GP_upload=true"
end if  


%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="admin,class,product"
MM_authFailedURL="adminloginerr.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (false 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
%>
<!--#include file="ScriptLibrary/incPureUpload.asp" -->
<%
' *** Edit Operations: (Modified for File Upload) declare variables

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

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: (Modified for File Upload) set variables

If (CStr(UploadFormRequest("MM_insert")) <> "") Then

  MM_editConnection = MM_conn_STRING
  MM_editTable = "sclass"
  MM_editRedirectUrl = "upsclass.asp"
  MM_fieldsStr  = "sclassname|value|select|value|file|value|slcassjs|value"
  MM_columnsStr = "sclassname|',none,''|bclassid|none,none,NULL|sclassimg|',none,''|sclassjs|',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(UploadFormRequest(MM_fields(i)))
  Next

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

End If
%>
<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it

If (CStr(UploadFormRequest("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  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_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End if
    MM_tableValues = MM_tableValues & MM_columns(i)
    MM_dbValues = MM_dbValues & FormVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    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 Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM bclass"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<html>
<head>
<title>新增子类</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="ddd.css" type="text/css">
<script language="JavaScript">
<!--
function checkdata() {
if (document.form1.sclassname.value=="") {
window.alert ("请输子类名称 !")
return false
}
if (document.form1.slcassjs.value=="") {
window.alert ("请输入子类介绍文字 !")
return false
}
return true
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<!--#include file="manage.asp" -->
<!--#include file="top.asp" -->
<table width="771" border="0" cellspacing="0" cellpadding="0" align="center" class="bk">
  <tr> 
    <td><br>
      <form ACTION="<%=MM_editAction%>" METHOD="post" name="form1" enctype="multipart/form-data" onSubmit="return checkdata()">
        <table width="46%" border="1" cellspacing="2" cellpadding="0" align="center" bordercolor="#FFFFFF" class="dfont">
          <tr bgcolor="#99CC00"> 
            <td bordercolor="#000000" colspan="2"> 
              <div align="center"><font color="#FFCC00"><b><font size="3" color="#FF0000">新增子类</font></b></font></div>
            </td>
          </tr>
          <tr> 
            <td bordercolor="#000000" width="30%">大类名称: </td>
            <td bordercolor="#000000" width="70%"> 
              <input type="text" name="sclassname">
            </td>
          </tr>
          <tr> 
            <td bordercolor="#000000" width="30%">所属大类:</td>
            <td bordercolor="#000000" width="70%"> 
              <select name="select">
                <%
While (NOT Recordset1.EOF)
%>
                <option value="<%=(Recordset1.Fields.Item("bclassid").Value)%>" ><%=(Recordset1.Fields.Item("bclassname").Value)%></option>
                <%
  Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
  Recordset1.MoveFirst
Else
  Recordset1.Requery
End If
%>
              </select>
            </td>
          </tr>
          <tr> 
            <td bordercolor="#000000" width="30%">图片名称:</td>
            <td bordercolor="#000000" width="70%"> 
              <input type="file" name="file">
            </td>
          </tr>
          <tr> 
            <td bordercolor="#000000" colspan="2" height="6">介绍: </td>
          </tr>
          <tr> 
            <td bordercolor="#000000" colspan="2" height="76"> 
              <div align="center"> 
                <textarea name="slcassjs" cols="50" rows="4">子类介绍</textarea>
              </div>
            </td>
          </tr>
          <tr> 
            <td bordercolor="#000000" colspan="2" height="8"> 
              <div align="center"> 
                <input type="submit" value="增加" name="submit">
              </div>
            </td>
          </tr>
        </table>
        <br>
        <input type="hidden" name="MM_insert" value="true">
      </form>
    </td>
  </tr>
</table>
<br><!--#include file="bottom.asp" -->
</body>
</html>
<%
Recordset1.Close()
%>


<html></html>

⌨️ 快捷键说明

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