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

📄 foodmana.asp

📁 宁波娱乐在线城市,丰富的内容版块
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!-- #include file="shopconn.asp" -->
<%
if Request.Cookies("NC")="" or Request.Cookies("NC")="访客" then
		Response.Write("对不起,您不是社区用户,请先注册!")
        Response.End
else
dim act
dim maxlist,currentpage,pcount,page_count,endpage
dim foodnumber,foodid
maxlist=10
%><HTML><HEAD><title>超级市场 → 货仓管理</title><%call shophead()
if master then
act=request("act")
if act="addfood" then
call addfood()
elseif act="edit" then
call editfood()
elseif act="del" then
call deled()
elseif act="added" then
call added()
elseif act="delet" then
call deled()
elseif act="edited" then
call edited()
else
call main()
end if
else
response.write "<script>alert('您没有管理权限!');history.go(-1);</script>"
response.end
end if%></center></body></html>
<%
end if

sub main()
dim brs
%>
<TABLE cellpadding="2" cellspacing="1" width=100% bgcolor="#F2F8FF">
<TBODY bgcolor="#B7D3FF">
<TR>
<TD colspan="7" align="center" height="25"><%
set rs=server.createobject("adodb.recordset")
sql="select * from food order by id desc"
rs.open sql,connshop,1,1
if rs.eof and rs.bof then%><BR>本超市仓库里暂时没有任何商品!&nbsp;&nbsp;&nbsp;&nbsp;<a href=?act=addfood><font color=red>添加商品</font></a><BR><BR><%
else
foodnumber=rs.recordcount
currentpage=trim(request("page"))
if currentpage="" or not isinteger(currentpage) then
currentpage=1
else
currentpage=clng(currentpage)
if err then
currentpage=1
err.clear
end if
end if
if foodnumber mod maxlist=0 then
Pcount= foodnumber \ maxlist
else
Pcount= foodnumber \ maxlist+1
end if%>超市仓库目前共有 <font color=red><%=cstr(foodnumber)%></font> 商品&nbsp;&nbsp;&nbsp;&nbsp;<a href=?act=addfood><font color=red>添加商品</font></a></td></tr>
<TR>
<TD align="center" height="25">商品图例</TD>
<TD align="center">名称</TD>
<TD align="center">功能</TD>
<TD align="center">功能值</TD>
<TD align="center">价格</TD>
<TD align="center">有效期</TD>
<TD align="center">操作</TD>
</TR>
<%
RS.MoveFirst
if currentpage > Pcount then currentpage = Pcount
if currentpage<1 then currentpage=1
RS.Move (currentpage-1) * maxlist
page_count=0
do while not rs.eof and page_count < maxlist
%>
<tr>
<td align=center><img src=<%=rs("foodpic")%> alt=<%=rs("foodtext")%>></td>
<td align=center><%=rs("foodname")%></td>
<td align=center><%=rs("foodsx")%></td>
<td align=center><%=rs("foodvalue")%></td>
<td align=center><%=rs("foodmoney")%></td>
<td align=center><%=rs("foodlast")%></td>
<td align=center><a href=?foodid=<%=rs("id")%>&act=del><font color=red>删除</font></a>&nbsp;&nbsp;<a href=?foodid=<%=rs("id")%>&act=edit><font color=red>编辑</font></a></td>
<%
page_count=page_count+1
rs.movenext
loop
%>
<tr><td colspan="7" align="center" height="25">页次:<b><%=currentpage%></b>/<b><%=Pcount%></b>页&nbsp;
每页:<b><%=maxlist%></b> 总数:<b><%=foodnumber%></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;分页:
<%if currentpage > 4 then%>
<a href="?page=1">[1]</a>...
<%
end if
if Pcount>currentpage+3 then
endpage=currentpage+3
else
endpage=Pcount
end if
for i=currentpage-3 to endpage
if not i<1 then
if i = clng(currentpage) then%><font color=red>[<%=i%>]</font><%else
%>
<a href="?page=<%=i%>"><%=i%></a>
<%		end if
end if
next
if currentpage+3 < Pcount then%>... <a href=""?page=<%=Pcount%>>[<%=Pcount%>]</a><%end if
end if%></td></tr></TBODY></table><%
rs.close
set rs=nothing
end sub

sub addfood()
%>
<TABLE width=100% bgcolor="#B7D3FF" cellpadding="0" cellspacing="0">
<TR>
<TD align="center" height="25" colspan="2"><font color=red><b>添加商品</b></font></td></tr>
<TR><form method=post action=?act=added name=nowform onSubmit="yyy(this);return false;">
<td width=30% height="25" align="right">名&nbsp;&nbsp;称:</td>
<td width=70%><input type=text name=foodname size=8></td>
</tr>
<tr>
<td height="25" align="right">图&nbsp;&nbsp;例:</td>
<td><input type=text name=foodpic> 请填写商品的图片地址</td>
</tr>
<tr>
<td height="25" align="right">属&nbsp;&nbsp;性:</td>
<td><select name=foodsx><option value=JYZ>经验<option value=ML>魅力<option value=FTS>发帖数</select>&nbsp;&nbsp;属性值:<input type=text name=foodvalue size=5></td>
</tr>
<tr>
<td height="25" align="right">说&nbsp;&nbsp;明:</td>
<td><input type=text name=foodtext></td>
</tr>
<tr>
<td height="25" align="right">价&nbsp;&nbsp;格:</td>
<td><input type=text name=foodmoney size=5>&nbsp;商店进货的价格为设定价格的<font color=red>80%</font>,退货的价格为设定价格的<font color=red>50%</font>。</td>
</tr>
<tr>
<td height="25" align="right">有效期:</td>
<td><input type=text size=5 name=foodlast>&nbsp;单位:天</td>
</tr>
<tr><td align="center" height="25" colspan="2"><input type=submit value=添加>&nbsp;&nbsp;<input type=reset value=重置></td></form></tr></table>
<%
end sub

sub added()
if request("foodname")="" then
response.write "<script>alert('请输入商品名称!');history.go(-1);</script>"
elseif request("foodpic")="" then
response.write "<script>alert('请输入商品的图片地址!');history.go(-1);</script>"
elseif request("foodvalue")="" then
response.write "<script>alert('请输入属性值!');history.go(-1);</script>"
elseif not isnumeric(request("foodvalue")) then
response.write "<script>alert('请确认输入的属性值为数值!');history.go(-1);</script>"
elseif cint(request("foodvalue"))<=0 then
response.write "<script>alert('请确认输入的属性值大于0!');history.go(-1);</script>"
elseif request("foodtext")="" then
response.write "<script>alert('请输入商品说明!');history.go(-1);</script>"
elseif request("foodmoney")="" then
response.write "<script>alert('请输入商品价格!');history.go(-1);</script>"
elseif not isnumeric(request("foodmoney")) then
response.write "<script>alert('请确认输入的价格为数值!');history.go(-1);</script>"
elseif cint(request("foodmoney"))<=0 then
response.write "<script>alert('请确认输入的价格大于0!');history.go(-1);</script>"
elseif request("foodlast")="" then
response.write "<script>alert('请输入有效期!');history.go(-1);</script>"
elseif not isnumeric(request("foodlast")) then
response.write "<script>alert('请确认输入的有效期为数值!');history.go(-1);</script>"
elseif cint(request("foodlast"))<=0 then
response.write "<script>alert('请确认输入的有效期大于0!');history.go(-1);</script>"
end if
set rs=server.createobject("adodb.recordset")
sql="select * from food where (id is null)"
rs.open sql,connshop,1,3
rs.addnew
rs("foodname")=request("foodname")
rs("foodpic")=request("foodpic")
rs("foodsx")=request("foodsx")
rs("foodvalue")=request("foodvalue")
rs("foodmoney")=request("foodmoney")
rs("foodtext")=request("foodtext")
rs("foodlast")=request("foodlast")
rs.update
rs.close
%>
<table><tr><td align=center>恭喜,操作成功!</td></tr>
<%response.write "<meta http-equiv=refresh content=""1;url=foodmana.asp"">"%>
<tr><td>系统将自动在3秒后返回货仓管理,您现在可以选择下面操作:
<UL><li><a href=/><font color=#000000>返回中央广场</font></a></li>
<li><a href=shoped.asp><font color=#000000>返回我的购物车</font></a></li>
<li><a href=shop.asp><font color=#000000>返回商店列表</font></a></li></UL>
</td></tr></table>
<%
end sub

sub deled()
foodid=request("foodid")
set rs=server.createobject("adodb.recordset")
sql="delete from food where id="&foodid
rs.open sql,connshop,1,3
%>
<table><tr><td align=center>恭喜,操作成功!</td></tr>
<%response.write "<meta http-equiv=refresh content=""1;url=foodmana.asp"">"%>
<tr><td>系统将自动在3秒后返回货仓管理,您现在可以选择下面操作:
<UL><li><a href=/><font color=#000000>返回中央广场</font></a></li>
<li><a href=shoped.asp><font color=#000000>返回我的购物车</font></a></li>
<li><a href=shop.asp><font color=#000000>返回商店列表</font></a></li></UL>
</td></tr></table>
<%
end sub

sub editfood()
%>
<TABLE width=100% bgcolor="#B7D3FF" cellpadding="0" cellspacing="0">
<TR>
<TD align="center" height="25" colspan="2">
<%
foodid=request("foodid")
set rs=server.createobject("adodb.recordset")
sql="select * from food where id="&foodid
rs.open sql,connshop,1,3
%><font color=red><b>编辑商品</b></font></td></tr>
<TR><form method=post action=?foodid=<%=foodid%>&act=edited name=nowform1 onSubmit="xxx(this);return false;">
<td width=30% height="25" align="right">名&nbsp;&nbsp;称:</td>
<td width=70%><input type=text name=foodname size=8 value=<%=rs("foodname")%>></td>
</tr>
<tr>
<td height="25" align="right">图&nbsp;&nbsp;例:</td>
<td><input type=text name=foodpic value=<%=rs("foodpic")%>> 请填写商品的图片地址</td>
</tr>
<tr>
<td height="25" align="right">属&nbsp;&nbsp;性:</td>
<td><select name=foodsx><option value=JYZ <%if rs("foodsx")="JYZ" then response.write "selected"%>>经验<option value=ML <%if rs("foodsx")="ML" then response.write "selected"%>>魅力<option value=FTS <%if rs("foodsx")="FTS" then response.write "selected"%>>帖子数</select>&nbsp;&nbsp;属性值:<input type=text name=foodvalue size=5 value=<%=rs("foodvalue")%>></td>
</tr>
<tr>
<td height="25" align="right">说&nbsp;&nbsp;明:</td>
<td><input type=text name=foodtext value=<%=rs("foodtext")%>></td>
</tr>
<tr>
<td height="25" align="right">价&nbsp;&nbsp;格:</td>
<td><input type=text name=foodmoney size=5 value=<%=rs("foodmoney")%>>&nbsp;商店进货的价格为设定价格的<font color=red>80%</font>,退货的价格为设定价格的<font color=red>50%</font>。</td>
</tr>
<tr>
<td height="25" align="right">有效期:</td>
<td><input type=text size=5 name=foodlast value=<%=rs("foodlast")%>> &nbsp;单位:天</td>
</tr>
<tr><td align="center" height="25" colspan="2"><input type=submit value=编辑>&nbsp;&nbsp;<input type=reset value=重置></td></form></tr></table>

<%
end sub

sub edited()
if request("foodname")="" then
response.write "<script>alert('请输入商品名称!');history.go(-1);</script>"
elseif request("foodpic")="" then
response.write "<script>alert('请输入商品的图片地址!');history.go(-1);</script>"
elseif request("foodvalue")="" then
response.write "<script>alert('请输入属性值!');history.go(-1);</script>"
elseif not isnumeric(request("foodvalue")) then
response.write "<script>alert('请确认输入的属性值为数值!');history.go(-1);</script>"
elseif cint(request("foodvalue"))<=0 then
response.write "<script>alert('请确认输入的属性值大于0!');history.go(-1);</script>"
elseif request("foodtext")="" then
response.write "<script>alert('请输入商品说明!');history.go(-1);</script>"
elseif request("foodmoney")="" then
response.write "<script>alert('请输入商品价格!');history.go(-1);</script>"
elseif not isnumeric(request("foodmoney")) then
response.write "<script>alert('请确认输入的价格为数值!');history.go(-1);</script>"
elseif cint(request("foodmoney"))<=0 then
response.write "<script>alert('请确认输入的价格大于0!');history.go(-1);</script>"
elseif request("foodlast")="" then
response.write "<script>alert('请输入有效期!');history.go(-1);</script>"
elseif not isnumeric(request("foodlast")) then
response.write "<script>alert('请确认输入的有效期为数值!');history.go(-1);</script>"
elseif cint(request("foodlast"))<=0 then
response.write "<script>alert('请确认输入的有效期大于0!');history.go(-1);</script>"
end if
foodid=request("foodid")
set rs=server.createobject("adodb.recordset")
sql="select * from food where id="&foodid
rs.open sql,connshop,1,3
rs("foodname")=request("foodname")
rs("foodpic")=request("foodpic")
rs("foodsx")=request("foodsx")
rs("foodvalue")=request("foodvalue")
rs("foodmoney")=request("foodmoney")
rs("foodtext")=request("foodtext")
rs("foodlast")=request("foodlast")
rs.update
rs.close
%>
<table><tr><td align=center>恭喜,操作成功!</td></tr>
<%response.write "<meta http-equiv=refresh content=""1;url=foodmana.asp"">"%>
<tr><td>系统将自动在3秒后返回货仓管理,您现在可以选择下面操作:
<UL><li><a href=shoped.asp><font color=#000000>返回我的购物车</font></a></li>
<li><a href=shop.asp><font color=#000000>返回商店列表</font></a></li></UL>
</td></tr></table>
<%
end sub

connshop.close
set connshop=nothing
%>

⌨️ 快捷键说明

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