<% if session("autorizado") = "" then response.Redirect("index.asp") end if guardar=request.QueryString("guardar") deporte=request.QueryString("deporte") if deporte = "" then response.Redirect("menu.asp") end if primer=Form("primer") if primer = "si" then primer = true end if if primer = "no" then primer = false end if titulo=Form("titulo") fecha=.Form("fecha") introduccion=Form("introduccion") foto=Form("foto") pie=Form("pie") nota=Form("nota") primer_ni=Form("primer") if guardar = "si" then if titulo="" then errText = "- Falta el titulo.
" guardar = "no" end if if fecha="" or fecha = "dd/mm/aaaa" then errText = errText & "- Falta la fecha.
" guardar = "no" end if if introduccion="" then errText = errText & "- Falta introduccion.
" guardar = "no" end if if foto="" then errText = errText & "- Falta foto.
" guardar = "no" end if if pie="" then errText = errText & "- Falta pie de foto.
" guardar = "no" end if if nota="" then errText = errText & "- Falta nota.
" guardar = "no" end if end if if guardar = "si" then Server.ScriptTimeout = 5000 Dim Form: Set Form = New ASPForm Server.ScriptTimeout = 1000 Form.SizeLimit = 10240*1024'10MB '{b}Set the upload ID for this form. 'Progress bar window will receive the same ID. if len(Request.QueryString("UploadID"))>0 then Form.UploadID = Request.QueryString("UploadID")'{/b} end if 'was the Form successfully received? Const fsCompletted = 0 If Form.State = fsCompletted Then 'Completted ruta = "../imagenes/" & deporte & "/" response.Write " ruta: " & ruta VirtualFolder = ruta 'Create destination path+filename for the source file. 'Create an URL for image. Dim DestinationPath, virtDestinationPath DestinationPath = Server.mapPath(VirtualFolder) & "\" virtDestinationPath = "http://" + Request.ServerVariables("SERVER_NAME") _ + GetPath(Request.ServerVariables("SCRIPT_NAME") ) _ + "/" + VirtualFolder + "/" 'Open recordset to store uploaded data Dim RS: Set RS = OpenUploadRS Dim FileField, datos(2), c c = 1 For Each FileField in Form.Files.Items 'Fo each file sent if len(FileField.FileName)> 0 then 'File is specified. Dim DestinationFileName DestinationFileName = DestinationPath & FileField.FileName 'Save file to physical location FileField.SaveAs DestinationFileName datos(c) = FileField.FileName response.Write(datos(c) & " ") c = c+1 response.Write(c & " ") end if Next 'Store extra info about upload to database if guardar = "si" then rs1.AddNew rs1("titulo") = titulo rs1("fecha") = fecha rs1("introduccion") = introduccion rs1("nota") = nota rs1("foto") = datos(1) rs1("pie") = pie rs1("principal") = primer rs1("status") = "A" rs1("fechahora") = now rs1.Update titulo="" fecha="" introduccion="" foto="" foto_thumb="" pie="" nota="" rs1.close rs1.Open SQL, DB, 1, 2 iCuantos = rs1.RecordCount while iCuantos > 16 rs1.MoveFirst rs1.Delete rs1.Update iCuantos = iCuantos - 1 wend rs1.Close end if 'What to do with Form("Description")? Response.write "
Source file names:" Dim Field: For Each Field in Form.Files.Items Response.write "
 " & Field.FileName Next ElseIf Form.State > 10 then Const fsSizeLimit = &HD Select case Form.State case fsSizeLimit: response.write "
Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)
" case else response.write "
Some form error.
" end Select End If'Form.State = 0 then Function OpenUploadRS() Dim rs1 : Set rs1 = CreateObject("ADODB.Recordset") if primer = true then SQL ="Update " & deporte & " Set principal=false where principal=true" set rs1 = DB.Execute(SQL) end if 'Open dynamic recordset, table Upload SQL ="select * from " & deporte & "" 'RS.Open "ListFiles", GetConnection, 2, 2 rs1.Open SQL, GetConnection, 3,3 Set OpenUploadRS = rs1 end Function Function GetConnection() dim Conn: Set Conn = CreateObject("ADODB.Connection") Conn.Provider = "Microsoft.Jet.OLEDB.4.0" Conn.open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:/websites/sportstime.com.mx/httpdocs/db/_spmdb.mdb") set GetConnection = Conn end function Function SplitFileName(FullPath) Dim Pos, PosF PosF = 0 For Pos = Len(FullPath) To 1 Step -1 Select Case Mid(FullPath, Pos, 1) Case ":", "/", "\": PosF = Pos + 1: Pos = 0 End Select Next If PosF = 0 Then PosF = 1 SplitFileName = PosF End Function Function GetPath(FullPath) GetPath = left(FullPath, SplitFileName(FullPath)-1) End Function '{b}get an unique upload ID for this upload script and progress bar. Dim UploadID, PostURL UploadID = Form.NewUploadID 'Send this ID as a UploadID QueryString parameter to this script. PostURL = Request.ServerVariables("SCRIPT_NAME") & "?UploadID=" & UploadID'{/b} end if %> Editor de noticias de <%=deporte%>

<%=errText%>

Noticias de <%=deporte%>

Noticia de primer página: Si No
Titulo:
Fecha:
Foto:
Pie de Foto:
Introducción:
Nota Completa:
<<Regresar al menu