%
option explicit
Response.Buffer = true
if session("company_id") <> "" then
dim conn
dim rs
dim ssql
dim sProduct_Id
dim sProduct_Images
dim return_page
dim FileControler
dim TotalRecord
%>
<%
sProduct_Id = trim(Request.QueryString("product_id"))
sProduct_Images = trim(Request.QueryString("product_images"))
if len(sProduct_Images) > 0 then
ssql = "select product_id from tbl_product where product_images = '" & sProduct_Images & "'"
set rs = server.CreateObject("adodb.recordset")
rs.Open ssql,conn,3,3
if not rs.EOF then
TotalRecord = rs.RecordCount
if TotalRecord = 1 then
set FileControler = server.CreateObject("Scripting.FileSystemObject")
if FileControler.FileExists(session("images_folder") & "/" & sProduct_Images) = true then
FileControler.DeleteFile session("images_folder") & "/" & sProduct_Images
end if
set FileControler = nothing
end if
end if
end if
ssql = "delete from tbl_product where product_id = '" & sProduct_Id & "'"
conn.execute ssql
conn.Close
set conn = nothing
return_page = ""
Response.Write return_page
else
Response.Redirect "../../index.asp"
end if
%>