%
if session("editor") = "" then
response.Redirect("index.asp")
end if
tipo = cint(Request.QueryString("tipo"))
if not verifica(tipo) then
response.Redirect("menu.asp")
end if
enviarForma = Trim(Request.Form("enviarForma"))
if enviarForma = "true" then
principalTxt = Trim(Request.Form("principalTxt"))
if principalTxt = "si" then
principalTxt = true
elseif principalTxt = "no" then
principalTxt = false
end if
fecha = Trim(Request.Form("hoyEs"))
tituloTxt = Trim(Request.Form("tituloTxt"))
pieTxt = Trim(Request.Form("pieTxt"))
introTxt = Trim(Request.Form("introTxt"))
notaTxt = Trim(Request.Form("nota2Txt"))
response.Write(fecha & "
" & tituloTxt & "
" & pieTxt & "
" & introTxt & "
" & notaTxt)
Set DB = Server.CreateObject("ADODB.Connection")
set rs=Server.CreateObject("ADODB.Recordset")
set rs1=Server.CreateObject("ADODB.Recordset")
DB.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:\Inetpub\vhosts\sportstime.com.mx\httpdocs\db\" & DB_)
if principalTxt = true then
response.Write("
Si es principal
")
SQL ="Update " & tipos(tipo) & " Set principal=false where principal=true"
response.Write("
" & SQL & "
")
DB.Execute(SQL)
end if
SQL = "INSERT INTO " & tipos(tipo)
SQL = SQL & " (principal,titulo,fecha,introduccion,nota,status,pie) "
SQL = SQL & "VALUES "
SQL = SQL & "(" & principalTxt & ",'"& tituloTxt &"','"& fecha &"','"& introTxt &"','"& notaTxt &"','A','"& pieTxt &"')"
response.Write(SQL)
DB.execute(SQL)
SQL = "SELECT * FROM " & tipos(tipo) & " WHERE titulo = '" & tituloTxt & "'"
rs.open SQL, DB, 3, 3
'rs.movefirst
'rs.movelast
id = rs.fields("id")
response.Write(id & "
")
rs.close
'Inicia eliminacion de archivos de mas
rs.Open SQL, DB, 1, 2
iCuantos = rs.RecordCount
while iCuantos > 16
rs.MoveFirst
dim fs
Set fs=Server.CreateObject("Scripting.FileSystemObject")
foto = rs.fields("foto")
Folder = "C:\Inetpub\vhosts\sportstime.com.mx\httpdocs\web\imagenes\" & tipos(tipo) & "\"
ruta = Folder & "\" & foto
if fs.FileExists(ruta) then
'fs.DeleteFile(ruta)
end if
set fs=nothing
rs.Delete
rs.Update
iCuantos = iCuantos - 1
wend
rs.Close
'Termina eliminacion de archivos de mas
response.Redirect("noticiasAgregaImg.asp?id=" & id & "&tipo=" & tipo)
end if
%>