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

📄 admin_product.asp

📁 该软件是帮助大学生更好的生活
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!-- #INCLUDE FILE="inc/conn.asp" -->
<!--#include file="inc/config.asp"-->
<!-- #include file="Ad_ChkPurview.asp"-->
<!-- #include file="inc_shop/onlogin.asp" -->
<!-- #include file="inc_shop/jk_pagecute.asp" -->
<%
dim article_menu,nsort,sql2,rs2,del_temp,data_name,cid,sid,nid,ncid,nsid,id,left_type,now_id,nummer,sqladd,page,rssum,thepages,viewpage,pageurl
dim name,csid,remark_1,remark_2,price_1,price_2,smallimg,bigimg,serial,brand,stock,isgood,hidden,ispic,pic,down_url,down_remark
article_menu="&nbsp;<a href='admin_product.asp?action=add'>添加新产品</a> | " & _
             "<a href='admin_product.asp'>产品管理</a> | " & _
 	        "<a href='admin_nsort.asp?nsort=pro'>产品分类管理</a>"
response.write header("产 品 管 理",article_menu)
action=trim(request.querystring("action"))
pageurl="?action="&action&"&":nsort="pro":data_name="product":sqladd="":nummer=18
cid=trim(request.querystring("c_id"))
sid=trim(request.querystring("s_id"))
if not(isnumeric(cid)) then cid=0
if not(isnumeric(sid)) then sid=0
cid=int(cid):sid=int(sid)

if trim(request("del_ok"))="ok" then
  response.write del_select(trim(request.form("del_id")))
end if

function del_select(delid)
  dim del_i,del_num,del_dim,del_sql,fobj,picc
  if delid<>"" and not isnull(delid) then
    delid=replace(delid," ","")
    del_dim=split(delid,",")
    del_num=UBound(del_dim)
    for del_i=0 to del_num
      call upload_del(data_name,del_dim(del_i))
      del_sql="delete from "&data_name&" where id="&del_dim(del_i)
      conn.execute(del_sql)
    next
    Erase del_dim
    del_select=vbcrlf&"<script language=javascript>alert(""共删除了 "&del_num+1&" 条记录!"");</script>"
  end if
end function

id=trim(request.querystring("id"))
if (action="hidden" or action="isgood") and isnumeric(id) then
  sql="select "&action&" from "&data_name&" where id="&id
  set rs=conn.execute(sql)
  if not(rs.eof and rs.bof) then
    if action="hidden" then
      if rs(action)=true then
        sql="update "&data_name&" set "&action&"=0 where id="&id
      else
        sql="update "&data_name&" set "&action&"=1 where id="&id
      end if
    else
      if rs(action)=false then
        sql="update "&data_name&" set "&action&"=1 where id="&id
      else
        sql="update "&data_name&" set "&action&"=0 where id="&id
      end if
    end if
    conn.execute(sql)
  end if
  rs.close
  action=""
end if

select case action
case "add"
  call news_add()
case "edit"
  if not(isnumeric(id)) then
    call news_main()
  else
    set rs=server.createobject("adodb.recordset")
    sql="select * from "&data_name&" where id="&id
    rs.open sql,conn,1,3
    call news_edit()
  end if
case else
  call news_main()
end select

closeconn()
response.write ender()

sub news_edit()
  dim rs3,sql3
  if trim(request.querystring("edit"))="chk" then
    name=code_admin(request.form("name"))
    csid=trim(request.form("csid"))
    remark_1=request.form("remark_1")
    remark_2=request.form("remark_2")
    price_1=trim(request.form("price_1"))
    price_2=trim(request.form("price_2"))
    smallimg=trim(request.form("pics"))
    bigimg=trim(request.form("picb"))
    serial=code_admin(request.form("serial"))
    brand=code_admin(request.form("brand"))
    stock=code_admin(request.form("stock"))
    isgood=trim(request.form("isgood"))
    hidden=trim(request.form("hidden"))
    down_url=code_admin(request.form("down_url"))
    down_remark=code_admin(request.form("down_remark"))
    if isnumeric(csid) or len(csid)<1 then
      response.write "<font class=red_2>请选择产品类型!(二级分类)</font><br><br>"&go_back
    elseif len(name)<1 or not(isnumeric(price_1)) or not(isnumeric(price_2)) then
      response.write "<font class=red_2>产品名称和产品价格不能为空!</font><br><br>"&go_back
    elseif len(remark_1)>250 then
      response.write "<font class=red_2>产品简介不能超过250个字!</font><br><br>"&go_back
    else
      cid=mid(csid,1,instr(csid,"-")-1)
      sid=mid(csid,instr(csid,"-")+1,len(csid))
      rs("c_id")=cid
      rs("s_id")=sid
      rs("name")=name
      rs("remark_1")=remark_1
      rs("remark_2")=remark_2
      rs("price_1")=price_1
      rs("price_2")=price_2
      if len(smallimg)<3 then smallimg="no_pic.gif"
      rs("smallimg")=smallimg
      if len(bigimg)<3 then bigimg="no_pic.gif"
      rs("bigimg")=bigimg
      rs("serial")=serial
      rs("brand")=brand
      rs("stock")=stock
      rs("down_url")=down_url
      rs("down_remark")=down_remark
      if isgood="yes" then
        rs("isgood")=true
      else
        rs("isgood")=false
      end if
      if hidden="yes" then
        rs("hidden")=false
      else
        rs("hidden")=true
      end if
      rs("tim")=now_time
      rs.update
      rs.close:set rs=nothing
      call upload_note(data_name,id)
      response.write "<font class=red>已成功修改了一篇动态!</font><br><br><a href='?c_id="&cid&"&s_id="&sid&"'>点击返回</a><br><br>"
    end if
  else
%>
<form name='add_frm' action='<%response.write pageurl%>c_id=<%response.write cid%>&s_id=<%response.write sid%>&id=<%response.write id%>&edit=chk' method=post>
<table width="80%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<tr><td colspan=10 class="title" align=center height=22><b>修改产品资料</b><input type=hidden name=upid value=''></td></tr>
  <tr class="tdbg">
    <td width='40%' align=right>产品名称:</td>
    <td width='60%'><input type=text size=70 name=name value='<%response.write rs("name")%>' maxlength=50><%=redx%></td></tr>
  <tr class="tdbg">
    <td align=right>产品类型:</td>
    <td><select name=csid size=1><%
sql3="select c_id,c_name from product_class where nsort='"&nsort&"' order by c_order,c_id"
set rs3=conn.execute(sql3)
do while not rs3.eof
  nid=int(rs3(0))
  response.write vbcrlf&"<option value='"&nid&"' class=bg_2>"&rs3(1)&"</option>"
  sql2="select s_id,s_name from product_sort where c_id="&nid&" order by s_order,s_id"
  set rs2=conn.execute(sql2)
  do while not rs2.eof
    now_id=int(rs2(0))
    response.write vbcrlf&"<option value='"&nid&"-"&now_id&"'"
    if cid=nid and sid=now_id then response.write " selected"
    response.write "> "&rs2(1)&"</option>"
    rs2.movenext
  loop
  rs2.close:set rs2=nothing
  rs3.movenext
loop
rs3.close:set rs3=nothing
%></select><%=redx%>选择二级目录才有效&nbsp;&nbsp;&nbsp;&nbsp;<input type=checkbox name=isgood<%if rs("isgood")=true then response.write " checked"%> value='yes'>选为推荐&nbsp;&nbsp;&nbsp;&nbsp;<input type=checkbox name=hidden<%if rs("hidden")=false then response.write " checked"%> value='yes'>选为隐藏</td></tr>
  <tr class="tdbg"><td align=right>市场价格:</td><td><input type=text size=15 name=price_1 value='<%response.write rs("price_1")%>' maxlength=10>&nbsp;&nbsp;&nbsp;&nbsp;会员价格:<input type=text size=15 name=price_2 value='<%response.write rs("price_2")%>' maxlength=10>&nbsp;&nbsp;<%response.write redx%>(价格只能为数字)</td></tr>
  <tr class="tdbg"><td align=right>产品品牌:</td><td><input type=text size=15 name=brand value='<%response.write rs("brand")%>' maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;产品编号:<input type=text size=15 name=serial value='<%response.write rs("serial")%>' maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;库存:<select name=stock size=1>
<%pic=rs("stock")%><option<%if pic="有货" then response.write " selected"%>>有货</option>
<option<%if pic="紧张" then response.write " selected"%>>紧张</option><option<%if pic="暂缺" then response.write " selected"%>>暂缺</option>
</select></td></tr>
  <tr class="tdbg"><td align=right>相关下载:</td><td><input type=text size=70 name=down_url value='<%response.write rs("down_url")%>' maxlength=100></td></tr>
  <tr class="tdbg"><td align=right>下载说明:</td><td><input type=text size=70 name=down_remark value='<%response.write rs("down_remark")%>' maxlength=50></td></tr>
  <tr class="tdbg"><td valign=top align=right><br>产品简介:<br>(少于100个汉字)</td><td><textarea name=remark_1 rows=5 cols=70><%response.write rs("remark_1")%></textarea></td></tr>
  <tr class="tdbg" height=35<%response.write format_table(3,1)%>><td align=right><%call frm_ubb_type()%></td><td><%call frm_ubb("add_frm","remark_2","&nbsp;&nbsp;")%></td></tr>
  <tr class="tdbg"><td valign=top align=right><br>详细说明:</td><td><textarea name=remark_2 rows=8 cols=70><%response.write rs("remark_2")%></textarea></td></tr>
<tr class="tdbg"><td align=right>上传到内容</td><td >
<iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload_product.asp?uppath=product&upname=a&uptext=remark_2'></iframe></td></tr>
<%
pic=rs("smallimg")
if pic="no_pic.gif" then pic=""
ispic=pic
if Instr(ispic,"/")>0 then ispic=right(ispic,len(ispic)-Instr(ispic,"/"))
if Instr(ispic,".")>0 then ispic=left(ispic,Instr(ispic,".")-1)
if len(ispic)<1 then ispic=upload_time(now_time)
%>  <tr class="tdbg"><td align=right>小 图 片:</td><td>
<input type=text name=pics value='<%response.write pic%>' size=40 maxlength=50>
<iframe frameborder=0 name=upload_frames width='100%' height=30 scrolling=no src='upload_product.asp?uppath=product&upname=<%response.write "ps"&ispic%>&uptext=pics'></iframe></td></tr>
<%
pic=rs("bigimg")
if pic="no_pic.gif" then pic=""
ispic=pic
if Instr(ispic,"/")>0 then ispic=right(ispic,len(ispic)-Instr(ispic,"/"))
if Instr(ispic,".")>0 then ispic=left(ispic,Instr(ispic,".")-1)
if len(ispic)<1 then ispic=upload_time(now_time)
%> 
<tr class="tdbg"><td align=right>大 图 片:</td><td>
<input type=text name=picb value='<%response.write pic%>' size=40 maxlength=50><br>
<iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='upload_product.asp?uppath=product&upname=<%response.write "pb"&ispic%>&uptext=picb'></iframe></td></tr>
<tr class="tdbg"><td colspan=2 align=center height=25><input type=submit value=' 修 改 产 品 '></td></tr>
</table></form><%
  end if
end sub

sub news_add()
  if trim(request.querystring("add"))="chk" then
    name=code_admin(request.form("name"))
    csid=trim(request.form("csid"))
    remark_1=request.form("remark_1")
    remark_2=request.form("remark_2")
    price_1=trim(request.form("price_1"))
    price_2=trim(request.form("price_2"))
    smallimg=trim(request.form("pics"))
    bigimg=trim(request.form("picb"))
    serial=code_admin(request.form("serial"))
    brand=code_admin(request.form("brand"))
    stock=code_admin(request.form("stock"))
    isgood=trim(request.form("isgood"))
    hidden=trim(request.form("hidden"))
    down_url=code_admin(request.form("down_url"))

⌨️ 快捷键说明

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