select case action Case "edit" call edit() Case "add" call add() Case "editok" call editok() call list() Case "addok" call addok() call list() Case "delok" call delok() call list() Case "list" call list() Case else call list() end select
%> <%sub list()%> <table class="Border" width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr class="title"> <td colspan="7"><%=lanmusort%>管理</td> </tr> <tr class="tr"> <td colspan="6" align="center" nowrap="nowrap" ><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="17%"><input type="submit" name="Submit" value="添加<%=lanmusort%>" onclick="window.location.href='?action=add'" /></td> <td width="52%"> </td> <td width="31%"> <select name="SortID" onChange="if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}" > <option value="?sortid=''" >全部<%=lanmusort%></option> <% Set rsselect=Server.Createobject("Adodb.Recordset") sql="select * from LinkSort order by SortID" rsselect.open sql,conn,1,1 for i=1 to rsselect.recordcount if rsselect.eof then exit for %> <option value="?sortid=<%=rsselect("sortid")%>" <%if saferequest("sortid")<>"" then : if int(request("sortid"))=rsselect("sortid") then response.write " selected" end if%>><%=rsselect("txtSort")%></option> <% rsselect.movenext next %> </select></td> </tr> </table></td> </tr> <tr class="tr"> <td width="5%" align="center" nowrap="nowrap" >排序</td> <td width="13%" align="center" nowrap="nowrap" ><%=lanmusort%>名称</td> <td width="13%" align="center" nowrap="nowrap" ><%=lanmusort%>地址</td> <td width="54%" align="center" nowrap="nowrap" ><%=lanmusort%>图片</td> <td width="54%" align="center" nowrap="nowrap" ><%=lanmusort%>位置</td> <td width="9%" align="center" nowrap="nowrap" >操作</td> </tr> <% set rs=server.CreateObject("adodb.recordset") sql="select * from Links as a,LinkSort as b where a.SortID=b.SortID " if SafeRequest("SortID")<>"" then sql=sql&" and a.SortID="&SafeRequest("SortID")
if SafeRequest("SortID")<>"" then sql=sql&" order by OrderID" else sql=sql&" order by a.id desc" end if
select case action case "add" call add() case "edit" call edit() case "addsave" call addsave() case "edit" call editsave() case "del" call del() case else call add()
<%sub addsave%> <% Set rs=Server.Createobject("Adodb.Recordset") sql="select * from " rs.open sql,conn,1,1 rs.addnew rs("")=saferequest("") rs.update rs.close %> <%end sub%>
<%sub editsave%> <% Set rs=Server.Createobject("Adodb.Recordset") sql="select * from where id="&ID rs.open sql,conn,1,1 If Not rs.EOF Then rs("")=saferequest("") rs.update Else errormsg "此记录已经不存在!" End IF rs.close %> <%end sub%>
<%sub del%> <%conn.execute ("delete from Links where ID="&ID)%> <%end sub%> </body> </html>
<%sub delok()%> <%conn.execute ("delete from Links where ID="&ID)%> <%end sub%>