کد ها
ببینید این کد خود فرم هست که از این صفحه وقتی روی حذف کلیک می شه می ره صفحه دیگه که کد اونم می گذارم براتون :
<%@ LANGUAGE = "VBScript" %>
<% Option Explicit %>
<% Response.Buffer = True %>
<% Response.Expires = -1 %>
<% Response.CacheControl = "Public" %>
<!--#include file="common.asp"-->
<%
Dim intTypeID
Dim intCatID
Dim strMode
Dim strTypeName
Dim strInputCategoryName
Dim strInputCategoryDescription
Dim blnInputSubmitEntries
Dim saryCatPermissions
If blnAdmin = False Then
adoCon.Close
Set rsCommon = Nothing
Set adoCon = Nothing
Response.Redirect("forum/insufficient_permission.asp")
End If
intTypeID = Clng(Request.QueryString("TYP"))
intCatID = Clng(Request.QueryString("CatID"))
strMode = Request.QueryString("Mode")
strSQL = "SELECT " & strDbTable & "EntryType.* FROM " & strDbTable & "EntryType "
strSQL = strSQl & "WHERE " & strDbTable & "EntryType.Type_ID = " & intTypeID & ";"
rsCommon.Open strSQL, adoCon
If rsCommon.EOF Then
strTypeName = "No Category"
Else
strTypeName = rsCommon("Type_name")
End If
rsCommon.Close
saryCatPermissions = "0"
If strMode = "Edit" Then
strSQL = "SELECT " & strDbTable & "EntryCategory.* FROM " & strDbTable & "EntryCategory "
strSQL = strSQL & "WHERE " & strDbTable & "EntryCategory.Cat_ID = " & intCatID & ";"
rsCommon.Open strSQL, adoCon
If rsCommon.EOF Then
Response.Write("invalid id")
Response.End
End If
intTypeID = Clng(rsCommon("Type_ID"))
strInputCategoryName = rsCommon("Cat_name")
strInputCategoryDescription = rsCommon("Cat_description")
blnInputSubmitEntries = CBool(rsCommon("Submit_entry"))
saryCatPermissions = rsCommon("Cat_permissions")
rsCommon.Close
End If
saryCatPermissions = Split(saryCatPermissions, ",")
%>
<html dir="rtl">
<head>
<title><% = strTxtAdminCategoryForm %></title>
<!--#include file="includes/skin_file.asp"-->
<!-- Check the from is filled in correctly before submitting -->
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<script language="JavaScript">
<!-- Hide from older browsers...
//Function to check form is filled in correctly before submitting
function CheckForm () {
//Initialise variables
var errorMsg = "";
var errorMsgLong = "";
if (document.frmAddCategory.name.value.length <= 3){
errorMsg += "\n\tCategory \t- The Category Name Must Be At Least 1 Character %>";
}
//If there is aproblem with the form then display an error
if (errorMsg != ""){
msg = "<% = strTxtErrorDisplayLine %>\n\n";
msg += "<% = strTxtErrorDisplayLine1 %>\n";
msg += "<% = strTxtErrorDisplayLine2 %>\n";
msg += "<% = strTxtErrorDisplayLine %>\n\n";
msg += "<% = strTxtErrorDisplayLine3 %>\n";
errorMsg += alert(msg + errorMsg + "\n\n");
return false;
}
return true;
}
// -->
</script>
</head>
<body bgcolor="<% = strBgColour %>" text="<% = strTextColour %>" background="<% = strBgImage %>">
<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
<tr>
<td class="bold"><img src="<% = strImagePath %>open_folder_icon.gif" align="absmiddle"><% = strTxtAddingCategoryTo & " " & strTypeName %></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="<% = strTableBorderColour %>" align="center" class="text">
<form method="post" name="frmAddCategory" action="admin_category.asp" onSubmit="return CheckForm();" onReset="return confirm('<% = strResetFormConfirm %>');">
<input type="hidden" name="mode" value="<% = strMode %>">
<input type="hidden" name="CID" value="<% = intCatID %>">
<input type="hidden" name="TID" value="<% = intTypeID %>">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="3" height="14" bgcolor="<% = strTableBgColour %>">
<tr>
<td bgcolor="<% = strTableTitleColour %>" background="<% = strTableTitleBgImage %>" colspan="2" class="tHeading"> <img src="<% = strImagePath %>arrow.gif" align="absmiddle"> <% = strTxtAdminAddCategoryForm %></td>
</tr>
<tr>
<td bgcolor="<% = strTableColour %>" align="right"><% = strTxtCategoryName %></td>
<td bgcolor="<% = strTableColour %>"><input type="text" name="name" value="<% = strInputCategoryName %>" size="40"></td>
</tr>
<tr>
<td bgcolor="<% = strTableColour %>" align="right"><% = strTxtSection %></td>
<td bgcolor="<% = strTableColour %>">
<select name="type_id">
<option> <% = strTxtSelectType %> </option><%
strSQL = "SELECT " & strDbTable & "EntryType.* FROM " & strDbTable & "EntryType;"
rsCommon.Open strSQL, adoCon
DO UNTIL rsCommon.EOF
Response.Write(vbCrLf & "<option value=""" & rsCommon("Type_ID") & """")
If rsCommon("Type_ID") = intTypeID Then Response.Write(" selected")
Response.Write(">" & rsCommon("Type_name") & "</option>")
rsCommon.Movenext
Loop
rsCommon.Close
%>
</select>
</td>
</tr>
<tr>
<td bgcolor="<% = strTableColour %>" align="right" valign="top"><% = strTxtCategoryDescription %></td>
<td bgcolor="<% = strTableColour %>"><textarea name="description" cols="30" rows="6"><% = strInputCategoryDescription %></textarea></td>
</tr>
<tr>
<td bgcolor="<% = strTableColour %>" align="right" valign="top">دسترسی
اعضاء:</td>
<td bgcolor="<% = strTableColour %>">
<select name="saryCatPermissions" multiple size="6">
<option value="0" <% If UBound(saryCatPermissions) = 0 Then Response.Write("selected") %>>-- همه گروه ها --</option><%
Dim intLoop
strSQL = "SELECT " & strDBTable & "Group.* FROM " & strDBTable & "Group ORDER BY " & strDBTable & "Group.Group_ID;"
rsCommon.Open strSQL, adoCon
DO UNTIL rsCommon.EOF
Response.Write(vbCrLf & "<option value=""" & rsCommon("Group_ID") & """")
If UBound(saryCatPermissions) <> 0 Then
For intLoop = 0 TO UBound(saryCatPermissions) - 1
If Clng(saryCatPermissions(intLoop)) = Clng(rsCommon("Group_ID")) Then
Response.Write(" selected")
Exit For
End If
Next
End If
Response.Write(">" & rsCommon("Name") & "</option>")
rsCommon.MoveNext
Loop
rsCommon.Close
%>
</select>
</td>
</tr>
<tr>
<td bgcolor="<% = strTableColour %>" align="right"><% = strTxtAllowSubmitting %></td>
<td bgcolor="<% = strTableColour %>"><input type="checkbox" name="submit" value="True" <% If strMode = "New" Then Response.Write("checked") %><% If strMode = "Add" OR blnInputSubmitEntries = True Then Response.Write("checked") %>></td>
</tr>
<tr>
<td bgcolor="<% = strTableColour %>" colspan="2">
<table cellpadding="1" cellspacing="1" width="100%">
<tr>
<td><input type="submit" value="<%
If strMode = "New" Then
Response.Write(strTxtAddCategory)
Else
Response.Write(strTxtEditCategory)
End If
%>"></td>
</form>
<td><input type="reset" value="<% = strTxtResetForm %>"></td>
<% If NOT strMode = "New" Then %>
<form method="post" name="frmDeleteCategory" action="admin_category.asp" onSubmit="return confirm('حذف؟');">
<input type="hidden" name="mode" value="Delete">
<input type="hidden" name="catid" value="<% = intCatID %>">
<td><input type="submit" value="Delete"></td>
</form>
<% End If %>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<center><a href="JavaScript:window.close()"><% = strTxtCloseWindow %></a></center>
<br>
</body>
</html>
<%
Set rsCommon = Nothing
adoCon.Close
Set adoCon = Nothing
%>
اینم صفحه که مشکل داره همه عملیات ها رو انجام مثلا edit ولی وقتی میاد رو Delete ارور Invalid id میده...
<%@ LANGUAGE = "VBScript" %>
<% Option Explicit %>
<% Response.Buffer = True %>
<% Response.Expires = -1 %>
<% Response.CacheControl = "Public" %>
<!--#include file="common.asp"-->
<!--#include file="forum/functions/functions_send_mail.asp" -->
<!--#include file="forum/functions/functions_format_post.asp" -->
<%
Dim intTypeID
Dim intCatID
Dim strMode
Dim strInputCategoryName
Dim strInputCategoryDescription
Dim blnInputSubmitEntries
Dim intOldTypeID
Dim rsEntryUpdate
Dim intSubID
Dim intEntryID
Dim saryCatPermissions
If blnAdmin = False Then
adoCon.Close
Set rsCommon = Nothing
Set adoCon = Nothing
Response.Redirect("forum/insufficient_permission.asp")
End If
intTypeID = Clng(Request.Form("TID"))
intCatID = Clng(Request.Form("CID"))
strMode = Request.Form("mode")
strInputCategoryName = formatSQLInput(Request.Form("name"))
strInputCategoryDescription = formatSQLInput(Request.Form("description"))
blnInputSubmitEntries = "" & CBool(Request.Form("submit")) & ""
saryCatPermissions = Request.Form("saryCatPermissions")
saryCatPermissions = Replace(saryCatPermissions, " ", "")
If saryCatPermissions <> "0" Then saryCatPermissions = saryCatPermissions & ","
If strMode = "New" Then
'//--- Create the category
strSQL = "INSERT INTO " & strDbTable & "EntryCategory (Type_ID, Cat_name, Cat_Description, Cat_permissions, Submit_entry) VALUES (" & intTypeID & ", '" & strInputCategoryName & "', '" & strInputCategoryDescription & "', '" & saryCatPermissions & "', " & CBoolConvert(blnInputSubmitEntries) & ");"
adoCon.Execute(strSQL)
ElseIf strMode = "Edit" Then
strSQL = "SELECT " & strDbTable & "EntryCategory.* FROM " & strDbTable & "EntryCategory "
strSQL = strSQL & "WHERE " & strDbTable & "EntryCategory.Cat_ID = " & intCatID & ";"
rsCommon.Open strSQL, adoCon, 3, 3
If rsCommon.EOF Then
Response.Write("invalid id")
Response.End
End If
intOldTypeID = rsCommon("Type_ID")
With rsCommon
.Fields("Type_ID") = intTypeID
.Fields("Cat_name") = strInputCategoryName
.Fields("Cat_Description") = strInputCategoryDescription
.Fields("Submit_entry") = blnInputSubmitEntries
.Fields("Cat_permissions") = saryCatPermissions
.Update
.Requery
End With
rsCommon.Close
If intOldTypeID <> intTypeID Then
Set rsEntryUpdate = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT " & strDBTable & "EntrySubCategory.* FROM " & strDBTable & "EntrySubCategory "
strSQL = strSQL & "WHERE " & strDBTable & "EntrySubCategory.Cat_ID = " & intCatID & ";"
rsCommon.Open strSQL, adoCon, 3, 3
If NOT rsCommon.EOF Then
DO UNTIL rsCommon.EOF
'//--- Update all the sub categories
With rsCommon
.Fields("Type_ID") = intTypeID
.Update
.Requery
End With
'//--- Update all the links in the sub category
strSQL = "SELECT " & strDBTable & "Entry.* FROM " & strDBTable & "Entry "
strSQL = strSQL & "WHERE " & strDBTable & "Entry.Sub_ID = " & rsCommon("Sub_ID") & ";"
rsEntryUpdate.Open strSQL, adoCon, 3, 3
If NOT rsEntryUpdate.EOF Then
DO UNTIL rsEntryUpdate.EOF
With rsEntryUpdate
.Fields("Type_ID") = intTypeID
.Update
.Requery
End With
rsEntryUpdate.Movenext
Loop
End If
rsEntryUpdate.Close
rsCommon.Movenext
Loop
End If
rsCommon.Close
Set rsEntryUpdate = Nothing
End If
ElseIf strMode = "Delete" Then
strSQL = "SELECT " & strDbTable & "EntryCategory.* FROM " & strDbTable & "EntryCategory "
strSQL = strSQL & "WHERE " & strDbTable & "EntryCategory.Cat_ID = " & intCatID & ";"
rsCommon.Open strSQL, adoCon
If rsCommon.EOF Then
rsCommon.Close
Set rsCommon = Nothing
adoCon.Close
Set adoCon = Nothing
Response.Write("invalid id")
Response.End
End If
rsCommon.Close
Set rsEntryUpdate = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT " & strDBTable & "Entry.* FROM " & strDBTable & "Entry "
strSQL = strSQL & "WHERE " & strDBTable & "Entry.Cat_ID = " & intCatID & ";"
rsCommon.Open strSQL, adoCon
If NOT rsCommon.EOF Then
DO UNTIL rsCommon.EOF
intEntryID = rsCommon("Entry_ID")
'//--- delete the link
strSQL = "DELETE FROM " & strDBTable & "Entry WHERE " & strDBTable & "Entry.Entry_ID = " & intEntryID & ";"
adoCon.Execute(strSQL)
'//--- delete all reviews for the link
strSQL = "DELETE FROM " & strDBTable & "EntryComment WHERE " & strDBTable & "EntryComment.Entry_ID = " & intEntryID & ";"
adoCon.Execute(strSQL)
rsCommon.MoveNext
Loop
End If
rsCommon.Close
strSQL = "SELECT " & strDBTable & "EntrySubCategory.* FROM " & strDBTable & "EntrySubCategory "
strSQL = strSQL & "WHERE " & strDBTable & "EntrySubCategory.Cat_ID = " & intCatID & ";"
rsCommon.Open strSQL, adoCon
If NOT rsCommon.EOF Then
DO UNTIL rsCommon.EOF
intSubID = rsCommon("Sub_ID")
'//--- delete the sub category
strSQL = "DELETE FROM " & strDBTable & "EntrySubCategory WHERE " & strDBTable & "EntrySubCategory.Sub_ID = " & intSubID & ";"
adoCon.Execute(strSQL)
'//--- delete all the links in the sub category
strSQL = "SELECT " & strDBTable & "Entry.* FROM " & strDBTable & "Entry "
strSQL = strSQL & "WHERE " & strDBTable & "Entry.Sub_ID = " & intSubID & ";"
rsEntryUpdate.Open strSQL, adoCon, 3, 3
If NOT rsEntryUpdate.EOF Then
DO UNTIL rsEntryUpdate.EOF
intEntryID = rsEntryUpdate("Entry_ID")
'//--- delete the link
strSQL = "DELETE FROM " & strDBTable & "Entry WHERE " & strDBTable & "Entry.Entry_ID = " & intEntryID & ";"
adoCon.Execute(strSQL)
'//--- delete all reviews for the link
strSQL = "DELETE FROM " & strDBTable & "EntryComment WHERE " & strDBTable & "EntryComment.Entry_ID = " & intEntryID & ";"
adoCon.Execute(strSQL)
rsEntryUpdate.Movenext
Loop
End If
rsEntryUpdate.Close
rsCommon.Movenext
Loop
End If
rsCommon.Close
Set rsEntryUpdate = Nothing
'//--- delete the link
strSQL = "DELETE FROM " & strDBTable & "EntryCategory WHERE " & strDBTable & "EntryCategory.Cat_ID = " & intCatID & ";"
adoCon.Execute(strSQL)
End If
%>
<html>
<head>
<title><% = strTxtAdminCategory %></title>
<!--#include file="includes/skin_file.asp"-->
</head>
<body bgcolor="<% = strBgColour %>" text="<% = strTextColour %>" background="<% = strBgImage %>">
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="<% = strTableBorderColour %>" align="center">
<tr>
<td bgcolor="<% = strTableColour %>" height="50" align="center">
<br><br><%
If strMode = "New" Then
Response.Write(strTxtCategoryAdded)
ElseIf strMode = "Edit" Then
Response.Write(strTxtCategoryUpdated)
ElseIf strMode = "Delete" Then
Response.Write(strTxtCategoryDeleted)
End If
%>
<br><br>
<center><a href="JavaScript:window.close()"><% = strTxtCloseWindow %></a></center>
<br>
</td>
</tr>
</table>
</body>
</html>
<%
Set rsCommon = Nothing
adoCon.Close
Set adoCon = Nothing
%>
در کد بالا از خط 116 به بعد مشکل داره.
لطفا کمک کنید.