www.gusucode.com > 站长俱乐部新闻发布系统精简版 1.01源码程序 > admin/admin_item_delete.asp
<!--#include file="admin_scripts.asp" --> <!--#include file="admin_top.asp" --> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } 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_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <% ' *** Edit Operations: declare variables ' set the form action variable dim MM_editAction MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Request.QueryString End If ' boolean to abort record edit dim MM_abortEdit MM_abortEdit = false ' query string to execute dim MM_editQuery MM_editQuery = "" dim MM_editCmd, MM_editConnection, MM_editTable, MM_editColumn, MM_recordId dim MM_editRedirectUrl, MM_fieldsStr, MM_columnsStr %> <% ' *** Delete Record: declare variables if (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") Then MM_editConnection = MM_oConn_STRING MM_editTable = "ac_item" MM_editColumn = "ID" MM_recordId = "" + Request.Form("MM_recordId") + "" MM_editRedirectUrl = "default.asp" ' 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 %> <% ' *** Delete Record: construct a sql delete statement and execute it If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then ' create the sql delete statement MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId If (Not MM_abortEdit) Then ' execute the delete 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 %> <% dim myParam myParam = "1" if (Request.Form("ID") <> "") then myParam = Request.Form("ID") end if %> <% dim ItemDelete, Item_numRowsDelete set ItemDelete = Server.CreateObject("ADODB.Recordset") ItemDelete.ActiveConnection = MM_oConn_STRING ItemDelete.Source = "SELECT * FROM ac_item WHERE ID = "& myParam & "" ItemDelete.CursorType = 0 ItemDelete.CursorLocation = 2 ItemDelete.LockType = 1 ItemDelete.Open() Item_numRowsDelete = 0 'check that the user is allowed to edit this page if (Session("MM_UserAuthorization") = 3) AND (ItemDelete.Fields.Item("User_ID").Value) <> (Session("MM_UserID")) then Response.Redirect(MM_authFailedURL) end if %> <% dim CategoryDelete, Category_numRowsDelete set CategoryDelete = Server.CreateObject("ADODB.Recordset") CategoryDelete.ActiveConnection = MM_oConn_STRING CategoryDelete.Source = "SELECT * FROM ac_category" CategoryDelete.CursorType = 0 CategoryDelete.CursorLocation = 2 CategoryDelete.LockType = 1 CategoryDelete.Open() Category_numRowsDelete = 0 %> <table width="100%" border="0" cellpadding="5" cellspacing="0" class="ac_admin_main"> <tr><td><img src="../images/blank.gif" width="18" height="6" alt="" /></td></tr> <tr valign="baseline"><td><%= adminHeading(2,lang_admin_default_001,"icons/garbage_empty_24.gif",lang_admin_item_delete_001,"#") %></td></tr> <tr><td bgcolor="#FFE7EF" class='contentarea'><form name="form1" method="POST" action="<%=MM_editAction%>"> <table width="100%" align="center" border="0"> <tr valign="baseline"> <td align="right" nowrap class="content_titles"><%= lang_admin_cat_delete_002 %></td> <td class="content_right" width="100%"> <%= lang_admin_item_delete_002 %> <%=(ItemDelete.Fields.Item("Title").Value)%> </td> </tr> <tr><td align="right" class="content_titles"><%= lang_admin_item_edit_002 %></td><td class="content_right"> <%=(ItemDelete.Fields.Item("Updated").Value)%></td> </tr> <input type="hidden" name="MM_delete" value="form1"> <input type="hidden" name="MM_recordId" value="<%= ItemDelete.Fields.Item("ID").Value %>"> <tr><td align="right" class="content_apply"><%= lang_admin_config_008 %></td><td bgcolor="#6E7B83" class='contentarea2'><INPUT TYPE="image" SRC="images/save_out.gif" HEIGHT="39" WIDTH="39" BORDER="0" ALT="<%= lang_admin_config_009 %>" value="Delete" name="Submit" id="Image1" onMouseOver="MM_swapImage('Image1','','images/save_over.gif',1)" onMouseOut="MM_swapImgRestore()"></td></tr> </form> </table> </td> </tr> </table> <% ItemDelete.Close() Set ItemDelete = Nothing CategoryDelete.Close() Set CategoryDelete = Nothing %> <!--#include file="admin_bottom.asp" -->